From f34637303d3e299992d5957eb4929032a0e69f94 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Tue, 3 Nov 2026 19:27:18 +0000 Subject: [PATCH] Notes: session-list background-task indicator blocked on server data --- app/notes/session-list-background-tasks.md | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/notes/session-list-background-tasks.md diff --git a/app/notes/session-list-background-tasks.md b/app/notes/session-list-background-tasks.md new file mode 100644 index 00000000..bd62d7da --- /dev/null +++ b/app/notes/session-list-background-tasks.md @@ -0,0 +1,35 @@ +# Session list: background-task indicator (blocked on server data) + +Request: show a quieter indicator on a chat list row when the turn is not running +but the session still has live background work (shells, Claude background Bash, +subagents). The turn spinner would win. + +Not implemented. The client cannot know this per listed chat without guessing. + +## What exists +- Background work is modelled server-side as shells for all three harnesses + (OpenCode shell API, Codex `commandExecution` items, Claude background Bash + and Agent/Task in `internal/claude/translate.go`). +- `chat_event` kind `shell` frames: sent only to subscribers of that session's + room (`chatHub.emitRoom`, `internal/server/chat_room.go`). The app subscribes + only the chat it opens; subscriptions end when the socket closes. +- `chat_shells` (`handleChatShells`, `internal/server/chat_shell_output.go`): + an on-demand per-session readback. It is not pushed, and for Codex/Claude it + goes through `chatManager.harness`, which can start the harness. + +## What is missing +- `protocol.ChatSession` (`internal/protocol/chat.go`) has no background field, + and `handleChatSessions` (`internal/server/chat_sessions.go`) sets none. +- No push to every connection when a session's running-shell set changes + (`chat_session_changed` goes to all connections but carries no such field). +- `keepUnattendedLocked` (`internal/server/chat_unattended.go`) does not keep a + room alive for running shells, so after the last viewer leaves the server stops + observing that session's shell exits. + +A server change that adds a count to the list row, sends it with +`chat_session_changed` (or a dedicated frame) on each running-set change, and keeps +observing sessions with live shells would let the client draw this accurately +through `chatSessionFrameEffect` and `session_row_content.dart`. + +The existing turn spinner has the same limit: it follows only rooms this connection +subscribed to.