Chat list activity: turn running and background tasks on every row, pushed to every connection

chat_sessions rows carry activity (turn_running, background_tasks, seq) from
the hub's own state, and chat_activity is pushed to every connection when a
session's turn starts or ends or its running background-task count changes.
A room whose last viewer left stays observed while background tasks run,
bounded by the unattended limits; a Claude Code process exit ends its tasks.
This commit is contained in:
2026-11-03 19:45:43 +00:00
parent 35558fec07
commit 1b98877d88
26 changed files with 593 additions and 96 deletions
+2 -3
View File
@@ -11,7 +11,6 @@ import (
"time"
"github.com/coder/websocket"
"github.com/coder/websocket/wsjson"
"git.a-wan.net/alan/pipelines/internal/opencode"
"git.a-wan.net/alan/pipelines/internal/pipeline"
@@ -236,7 +235,7 @@ func TestChatSubscribeListsQueuedPromptsAndUnqueueRemoves(t *testing.T) {
sawUser := false
for {
var message protocol.Message
if err := wsjson.Read(server.ctx, reloaded, &message); err != nil {
if err := readTestFrame(server.ctx, reloaded, &message); err != nil {
t.Fatalf("no delivery reported: %v", err)
}
if event := message.ChatEvent; event != nil && event.Kind == protocol.ChatEventUser && event.OperationID == "op-3" {
@@ -259,7 +258,7 @@ func TestChatSubscribeListsQueuedPromptsAndUnqueueRemoves(t *testing.T) {
writeChat(t, server.ctx, reloaded, protocol.Message{Type: protocol.ChatUnqueue, ID: "rm-late", ChatUnqueue: &protocol.ChatUnqueueRequest{SessionID: "ses_1", OperationID: "op-3"}})
for {
var message protocol.Message
if err := wsjson.Read(server.ctx, reloaded, &message); err != nil {
if err := readTestFrame(server.ctx, reloaded, &message); err != nil {
t.Fatal(err)
}
if message.ID == "rm-late" {