Chat list: spinner and background-task badge from server activity on every row
The list applies chat_activity pushes and each row's activity by seq, so every listed chat shows a running turn, not only the chat open here. An idle chat with running background tasks wears a quiet badge with tooltip and semantics "Background tasks running (N)". Older servers keep the old behaviour. List rows that never changed carry the server's current seq so they order after snapshots kept from an earlier server process.
This commit is contained in:
@@ -65,13 +65,16 @@ func TestChatActivityReachesEveryConnection(t *testing.T) {
|
||||
viewer := dialChatConn(t, server.ctx, server.srv)
|
||||
list := dialChatConn(t, server.ctx, server.srv)
|
||||
|
||||
if got := listActivity(t, server.ctx, list); got == nil || got.TurnRunning || got.BackgroundTasks != 0 {
|
||||
t.Fatalf("idle row activity = %+v, want an empty summary", got)
|
||||
// A session that never changed still carries a sequence (this server's
|
||||
// current one), so it orders after anything kept from an earlier process.
|
||||
initial := listActivity(t, server.ctx, list)
|
||||
if initial == nil || initial.TurnRunning || initial.BackgroundTasks != 0 || initial.Seq == 0 {
|
||||
t.Fatalf("idle row activity = %+v, want an empty summary with a sequence", initial)
|
||||
}
|
||||
|
||||
sendPrompt(t, server.ctx, viewer, "p1", "build it", "op-1")
|
||||
started := readActivity(t, server.ctx, list)
|
||||
if started.SessionID != "ses_1" || !started.TurnRunning || started.BackgroundTasks != 0 || started.Seq == 0 {
|
||||
if started.SessionID != "ses_1" || !started.TurnRunning || started.BackgroundTasks != 0 || started.Seq <= initial.Seq {
|
||||
t.Fatalf("turn start push = %+v", started)
|
||||
}
|
||||
broker.push(stepFrameFor(protocol.ChatStepStarted, "turn_1"))
|
||||
|
||||
Reference in New Issue
Block a user