Merge lane-chat2: combine operator chat session management with live run updates

Both sides are reviewed work and both are kept:

- android/app/.../ui/AppViewModel.kt: HEAD's live-run push wiring
  (RunStreamState/_runStream, combine(connectionState, settings.workspace),
  subscribeRuns/streamDown/resync, applyRunEvent, scheduleRunsResync/
  scheduleRunDetailSync, observeRunEvents) together with lane-chat2's chat
  management (ChatStore overrides, observeChatOverrides, refreshChatDirectories,
  startNewChat/selectChatDirectory/cancelNewChat/createNewChat,
  renameChat/removeChat/undoRemoveChat). The only textual conflict was the
  import list; combine (HEAD) plus map and ui.chat.ChatSessionOverrides (lane)
  are all kept and all used. No duplicated definitions.
- android/README.md: HEAD's "Live run updates from the socket" section and
  lane-chat2's "Operator chat sessions: choose the directory, list only your
  own" section are both present once, in file order.
- The rest of lane-chat2's chat files (ChatDirectories.kt, ChatOverrides.kt,
  ChatStore.kt, ChatScreen.kt, ChatFormat.kt, protocol Chat/Message, repositories,
  tests) merge cleanly on top of HEAD's work.

Documentation check: android/README.md is updated by this merge and its new
section is consistent with HEAD's. docs/cli.md and
internal/author/skill/references/operations.md already describe the server's
chat_sessions/chat_create/chat_directories surface this client builds on, and
the authoring skill (SKILL.md, references/) contains no Android-client behaviour
to stale, so nothing there needed changing and no packaged reference or
inventory entry was touched. No server, installer or template change is part of
this merge.

Checks (android/, Gradle 8.11.1, --offline):
- gradle :app:testDebugUnitTest --offline --rerun-tasks -> BUILD SUCCESSFUL;
  test-results report 463 tests, 0 failures, 0 errors across 50 suites
  (including ChatDirectoriesTest and ChatSessionManagementTest).
- gradle :app:assembleDebug --offline -> BUILD SUCCESSFUL (debug APK built).

Not verified here: on-device picker/rendering, which the visual-review stage owns.
This commit is contained in:
2026-10-17 11:45:41 +01:00
14 changed files with 1036 additions and 42 deletions
+62
View File
@@ -5353,3 +5353,65 @@ owns the operator's Pixel 9 Pro XL): the on-device status change with no refresh
and the live/reconnecting badge rendering. The captures and the phone's
main-revision restore are that stage's evidence.
## Operator chat sessions: choose the directory, list only your own (17 Oct 2026)
The Chat destination now starts a chat by asking where it should live, and its
list is the operator's own sessions only. Before this change "New chat" created a
session with no directory of its own choosing (it passed the workspace, so the
session landed wherever the server happened to be) and the list was whatever
`chat_sessions` returned with no way to tell an operator chat from anything
run-related. The server change this builds on (operator sessions tagged
`operator`, `chat_sessions` returning exactly those with their directory and
recency, and a `chat_directories` request) is already in this revision; nothing in
the Pipelines server, its Go source, the installer or the Docker files was
touched, no dependency was added beyond the already-declared
material-icons-extended, and no run is started from the app.
- **Starting a chat asks where first.** `ChatScreen`'s level-1 pane is now the
directory picker while a create is in flight: the server's
`chat_directories` reply (the operator's home first, then the directories of
previous operator sessions, most recently used first) rendered through the
shared `ListRow`, each with its full path, home shown as `Home (~)` with its
absolute path beneath it. It is a normal pane of the chat stack, so Back, the
app bar's back control, the footer's Cancel and the predictive-back gesture all
leave it without creating anything — not a modal dead end.
- **The directory is always sent.** The picker starts on the operator's home
(`directoryChoices`/`defaultDirectoryChoice`) and `chat_create` is sent the
chosen directory — `~` for home, the absolute path for a recent — so a session
is never created in the server's own working directory. The server resolves or
rejects it, and its error is shown in the pane.
- **The list is the server's, and says so.** The list renders
`ChatState.visibleSessions`: exactly the server's `chat_sessions` (operator
sessions only — the app never guesses which session belongs to a run) with the
operator's own local changes applied. Each row carries its directory and the
kind chip derived from the server's own tag (`sessionTagLabel`, `operator` →
`Operator`), so an operator chat is tellable at a glance.
- **Managing a session, honestly.** The brokered protocol has no rename and no
delete for a chat session (there is no `chat_rename`/`chat_delete` type and the
native session endpoint is not exposed), so both are the operator's own,
device-local changes, persisted with the other settings
(`SettingsRepository.chat_overrides`, `ChatSessionOverrides`): rename stores a
local title that wins over the server's on every later list load, and "Remove
from list" hides the row and closes its conversation while a snackbar reports
it as a local, undoable change ("Removed from this list; the chat stays on the
server.") with an Undo action. Nothing is deleted on the server, and a refresh
cannot bring a removed row back.
- **Everything else is unchanged.** Multi-chat drafts/scroll/running, streaming,
tool chips, diff cards, approval cards, stop and the reconnect path are
untouched; the picker only reuses the stack's second level the conversation
already used.
Tests (`app/src/test`): `ChatDirectoriesTest` (home first and the default, the
recents' order and their full-path create value, an empty/blank reply still
yielding home), `ChatSessionManagementTest` (the chip from the server's tag, the
create flow's home default and chosen directory, rename winning over the server
title and surviving a refresh, removal hiding until undone and leaving the
server's list intact, the override encode/decode round trip) and the new
`ChatProtocolTest` cases for the `tag` field and the `chat_directories`
request/reply.
Not verified in this pass: the on-device picker, the tagged list and a session
open in a chosen directory — the brief keeps implementation verification to the
build and the unit tests, and visual review owns the device. The chip, menu and
dialog are Compose UI, which this module has no unit harness for; they are
covered by compilation only.