Merge: chat list shows running turns and background tasks for every chat

This commit is contained in:
2026-11-03 19:54:35 +00:00
33 changed files with 1148 additions and 164 deletions
+14
View File
@@ -455,6 +455,20 @@ sessions pipeline runs create. The protocol types are:
for the run that owns them. The list is fail-closed: with no registry and no
store it returns an empty list, never the endpoint's whole session list. A
session is never marked `busy`: any number of clients may watch and write one.
Each row carries `activity` (`turn_running`, `background_tasks`, `seq`): the
server's live view of the session. An older server omits it.
- `chat_activity` is pushed to every open connection, not only the chat's
watchers, when a session's turn starts or ends or its count of running
background tasks changes (shells, background commands, Claude Code background
Bash and subagents, Codex command executions). The body is `chat_activity`
(`session_id`, `turn_running`, `background_tasks`, `seq`). It is sent on those
transitions only, never per output chunk. `seq` increases with every change
and keeps increasing across a restart, so a client keeps the snapshot (list
row or push) with the larger `seq`. Background tasks are counted only while
the server observes the session: after a chat's last viewer leaves, the
server keeps observing it while its tasks run (bounded like an unattended
turn: at most 16 such chats and 6 hours). Once released it reports none
rather than a stale count.
- `chat_subscribe` attaches a connection to one session's shared live stream (body
`session_id`) and replays the session's still-pending approval requests, so every
client that watches a session sees every frame any client's turn produces — the