Chat: never drop a Claude turn's lifecycle frames; end a runner turn whose end was lost
emit now waits (bounded) for a full watcher to accept step and resync frames instead of dropping them. The turn runner also ends its turn once a harness that tracks its turn state has reported idle for the settle period and its probe confirms, asking clients to resync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -190,6 +190,22 @@ func errChatQueueFull(sessionID string) error {
|
||||
return errors.New("session " + sessionID + " already has the maximum number of prompts queued")
|
||||
}
|
||||
|
||||
// chatTurnTracker is implemented by a broker that routes to several harnesses
|
||||
// and knows whether the one serving a session reports its own turn state.
|
||||
type chatTurnTracker interface {
|
||||
TracksTurnState(sessionID string) bool
|
||||
}
|
||||
|
||||
// brokerTracksTurns reports whether brokerTurnRunning's answer for sessionID
|
||||
// comes from a harness that tracks its turn, rather than a constant false.
|
||||
func brokerTracksTurns(broker chatBroker, sessionID string) bool {
|
||||
if tracker, ok := broker.(chatTurnTracker); ok {
|
||||
return tracker.TracksTurnState(sessionID)
|
||||
}
|
||||
_, ok := broker.(chatTurnReporter)
|
||||
return ok
|
||||
}
|
||||
|
||||
// brokerTurnRunning asks a harness that knows its own turn state without I/O.
|
||||
func brokerTurnRunning(broker chatBroker, sessionID string) bool {
|
||||
reporter, ok := broker.(chatTurnReporter)
|
||||
|
||||
Reference in New Issue
Block a user