Chat queue: wake the runner when a scheduled head is unqueued; end a stale observed turn once the harness is idle

A prompt queued behind a scheduled prompt (the app's auto-continue at a
usage limit's reset) stayed queued after that head was removed: unqueue
never woke the runner, which slept until the removed prompt's send_at.
unqueue now wakes it, and the runner re-checks a scheduled head at least
every 30 s.

Safety net: a due prompt held by a turn the room only observed (its end
lost, or a reattach watcher that gave up) is delivered once the harness
reports itself idle for a settle period and its probe confirms it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 00:56:34 +00:00
parent 18e0e565ca
commit 364e0cb3c9
7 changed files with 280 additions and 17 deletions
-6
View File
@@ -30,12 +30,6 @@ func (c *restartChat) Messages(context.Context, string, int, string) (protocol.C
return protocol.ChatHistoryPage{Messages: append([]protocol.ChatMessage(nil), c.history...)}, nil
}
func (c *restartChat) setProbe(running bool) {
c.smu.Lock()
c.probe["ses_1"] = running
c.smu.Unlock()
}
// chatRestartServer is one server process over a shared database.
type chatRestartServer struct {
ctx context.Context