Files
pipelines/docs/notes/chat-in-flight-tool-work.md
T
alan 597c7b5e76 android: show a chat's in-flight tool work instead of a bare Running
A session said "Running" with an empty tool chip while it worked, so a silent
wait was indistinguishable from a stuck one. Derive the in-flight work from the
stream the app already folds and show it on both surfaces.

- ChatFormat: runningToolCalls() reads the tool parts still running, in
  transcript order, so the conversation and the session row share one set;
  toolDetail() takes the command/description the part actually carries (the
  first of description/command/filePath/file_path/path/pattern/query/url),
  collapsed to one line and elided at 72 chars, and returns null rather than a
  fabricated summary; runningToolElapsedMillis() uses the protocol's own
  time.ran/created when present and the local per-part stamp otherwise;
  runningToolStamps() keeps a stable start per part across frames;
  TOOL_LONG_RUNNING_MILLIS (60s) and toolLongRunning() mark an unusually long
  call; sessionWorkLabel() names what a working session is doing while a
  text-streaming turn stays plain "Running" and a busy session never reads
  "Idle".
- ChatStore: ChatThread gains toolStartedAt, stamped when a part turns running
  and dropped when it settles, plus runningTools/toolElapsedMillis; history()
  and the frame fold maintain it; setRunning/turn end clear it.
- ChatTranscript: RunningIndicator lists one line per running call (name,
  detail where present, live elapsed) keyed by part id so concurrent calls
  render together without flicker; no percentage, ETA or progress bar.
- ChatListPane: the session row renders sessionWorkLabel(busy, thread).
- ChatRunningWorkTest covers name/detail/elapsed, clear on completion, error
  state, concurrent calls and the no-detail stream.

Only fields the harness reports are used: tool name, state.status and input;
the live brokered frame carries no timing envelope, so elapsed falls back to the
local stamp. Existing chips, INPUT/OUTPUT, reasoning blocks, stop control,
activity marks and scroll/follow behaviour are untouched.

Checked and unchanged: no packaged template or packaged authoring-skill
reference describes this app surface (the chat references in
internal/author/skill/references/ document the server's brokered chat_* protocol,
which this change does not touch), so none is stale. android/AGENTS.md already
names ui/chat/ and its files. The shared documents this change does make stale
are recorded, not edited, in docs/notes/chat-in-flight-tool-work.md: the
Running-indicator and session-status statements in android/README.md.
2026-10-18 00:05:07 +01:00

66 lines
3.5 KiB
Markdown

# Chat in-flight tool work
## What this item changed
`android/` only, the chat's two "working" surfaces.
- `ui/chat/ChatFormat.kt` adds `runningToolCalls` (the tool parts still
`running`, in transcript order), `toolDetail` (the command/description the
part's own input carries, from description/command/filePath/file_path/path/
pattern/query/url, one line, elided at 72 chars, `null` when absent),
`runningToolElapsedMillis` (the protocol's `time.ran`/`created` when present,
else the local per-part stamp), `runningToolStamps` (a stable start per part
across frames), `TOOL_LONG_RUNNING_MILLIS` = 60s with `toolLongRunning`, and
`sessionWorkLabel`.
- `ui/chat/ChatStore.kt`: `ChatThread.toolStartedAt` plus `runningTools` and
`toolElapsedMillis`; `history()`, the frame fold and `setRunning` maintain it.
- `ui/chat/ChatTranscript.kt`: `RunningIndicator` now also lists one line per
running call (name, detail where present, live elapsed), keyed by part id so
concurrent calls render together; a call past 60s is tinted and marked
`· long`.
- `ui/chat/ChatListPane.kt`: the session row renders
`sessionWorkLabel(session.busy, thread)`.
- `ui/chat/ChatRunningWorkTest.kt` covers it (name/detail/elapsed, clear on
completion, error state, concurrent calls, no-detail stream).
No percentage, ETA or progress bar is invented; only the reported fields (tool
name, `state.status`, `state.input`) are used.
## Shared documents this change makes stale
`android/README.md` documents the two surfaces this item changed, in the
`## Streaming replies (16 Oct 2026)` record. The note is written here rather
than edited in place; the `docs-fold` writer should update it.
- `android/README.md:4633` — the **Running indicator** bullet reads "The
transcript's indicator shows the spinner, `Working…` and the live elapsed
time (ticked once a second, never per frame, through the shared
`formatDuration`)." It should add that the indicator also lists, one line per
tool call still in flight, the call's name, the command/description the part
carries when it carries one, and that call's own live elapsed time; that a
call running 60 seconds or more is tinted and marked `· long`; that a call's
line drops out the moment it completes or errors, which is what clears the
indicator; and that no percentage, ETA or progress bar is shown. The rest of
the bullet (one-second tick, the tick loop keyed on the turn's start, the
elapsed count surviving a chat switch) is still true.
- `android/README.md:4454` — the session-list sentence "the list shows each
session's running/busy/read-only status" is now incomplete: a working session
row names what it is doing (`Running <tool>`, or `Running <n> tools` when
several run at once) instead of only `Running`, while a turn that is only
generating text still reads plain `Running`, so the two stay distinguishable;
a busy session with nothing running still reads `Busy · read-only`, and an
idle one `Idle`.
Dates, counts and capture names in those dated records are past evidence and
stay as they are; only the two behaviour statements above are now stale.
## Not stale
- No packaged OpenCode skill reference documents this app surface. The chat
references in `internal/author/skill/references/operations.md` document the
server's brokered `chat_*` protocol, which this change does not touch, and no
packaged template or `internal/author/` managed file names the app's chat
indicator or session label.
- `android/AGENTS.md` already lists `ui/chat/` and its files, so it needs no
change.