Files
pipelines/app/notes/session-list-background-tasks.md
T

1.9 KiB

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.