Report a busy chat on subscribe after a reload
The room that records a server-run turn is torn down when its last client leaves, so a page reload re-subscribed to a new room that no longer knew the turn was running and never replayed the step-started marker. Claude Code does not re-announce a running turn to a new stream either, so the activity row and Stop control vanished until the next streamed delta. chat_subscribe now also replays the marker when the room's stream announced a turn (CLI-originated or re-announced on attach) or when the broker reports its own turn in flight through the optional chatTurnReporter (Claude Code reads its in-process running flag; the chat manager routes it without I/O).
This commit is contained in:
@@ -297,6 +297,19 @@ func (c *Chat) Stream(ctx context.Context, id string, ready func(), emit func(pr
|
||||
}
|
||||
}
|
||||
|
||||
// TurnRunning reports whether the CLI is working on a turn for id, so a client
|
||||
// that attaches mid-turn (a page reload) still shows the turn running although
|
||||
// its step-started frame was emitted before that client subscribed.
|
||||
func (c *Chat) TurnRunning(id string) bool {
|
||||
s := c.session(id)
|
||||
if s == nil {
|
||||
return false
|
||||
}
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.running
|
||||
}
|
||||
|
||||
// Interrupt asks the CLI to cancel the in-flight turn, including queued turns.
|
||||
func (c *Chat) Interrupt(ctx context.Context, id string) error {
|
||||
s := c.session(id)
|
||||
|
||||
Reference in New Issue
Block a user