Repository navigation
fix(server): stop no-longer-true events from waking the watcher - #108
Conversation
A lane-ended, stuck, promise or needs-person alert was judged once, when it fired, and then queued into the watcher thread behind whatever turn it was running. By the time the watcher read it the lane had often restarted, settled, registered a wait or had its question answered, and the coordinator spent a full-context turn learning nothing. Delivery now judges each thread event again, as of the time it fired, and drops it when that finding no longer holds. While the watcher is mid-turn, watcher deliveries are held (rechecked every 30 s, at most 10 minutes) so the check runs when the watcher can act, instead of when the message is queued. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hold A peer read that dies (not just fails) now delivers as if the watcher were idle. The delegated-completion tests now expect the second local alert to wait for the watcher's queued turn, and the remote stub answers the status read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Bot review (round 1, Claude Fable 5.2): Independent review of this pull request (the watcher fix that re-judges thread events at delivery and holds alerts while the watcher is mid-turn), at head Verdict (my judgment): nothing here blocks the merge. I found no case where the re-judge delivers something it should have dropped, and no case where a still-true alert is dropped in the ordinary path. The two findings worth acting on are 1 (the hold misses the watcher's most common busy state) and 2 (remote read cost); both are a few lines in the same place, so I would fix them in this pull request or a direct follow-up. The rest is low severity. What I ran: Findings, most severe first1. Medium, correctness gap: a watcher whose run is
Failure scenario: the Lead thread ends its turn waiting on delegates or a background command, so its run is Suggested fix, which differs by path:
Limits of my claim: read from code, not run end-to-end. Also, a wait can outlast the 10-minute cap, so this narrows the gap and does not close it. 2. Medium, cost: every watcher delivery to a remote watcher now makes a
Suggested fix: read the watcher's state once per flush (it is the same watcher for every entry) and pass it to both 3. Low, correctness: a drop at delivery keeps the dedupe signature, so an alert dropped for a state that then reverts is never sent for that run. Probe result: a lane that completed with an open pull request fires 4. Low, cost and duplication in
5. Low, maintainability: the signature is recovered by rebuilding the id string. 6. Low, behaviour the description and doc understate.
Do the tests exercise the behaviour?Partly. The two pure helpers are covered; the wiring is not.
Excess complexityNot over-built, in my view. Re-using Checked and found sound
Unverified: end-to-end delivery against a live remote watcher; finding 1 is traced through the code, not reproduced on a running server. |
- A watcher whose run is waiting also queues a sent alert, so it is held too. - One watcher read per flush is shared by every due alert and by the usage-limit hold. - currentAlert re-judges with the shared REJUDGE_TRIGGER map. - Keep rows for needs-person, promise-without-wake and lane-ended with an open PR. - Doc states the hold covers every alert kind and the 30-60 s recheck. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review fixes for the round-1 bot review above (head
Tests: keep rows were added for |
Problem. The watcher thread (Lead's Metathread) was woken by alerts that were already false when it read them. Each thread event was judged once, when it fired, then queued into the watcher behind whatever turn it was running. Observed on 2026-11-19: a
lane-endedalert for a lane that had already restarted itself, and alerts that sat in the Metathread's queue (runs 206 and 207 queued behind run 205) until long after the lane moved on. Each costs a full-context coordinator turn that learns nothing.Fix. Two deterministic checks before any model wakes, both in the existing outbox (no new service):
threadEventStillHolds(inThreadEventAlerts.ts) re-runsjudgeThreadon the lane's current shell, as of the time the event fired (so the 15-minute recent-run window does not expire while delivery waits), and keeps the alert only if the same finding, with the same signature, still holds. Dropped: the lane restarted or a newer run finished, was settled or archived, registered a PR watch or background wait, merged its PR, had its question answered, or showed new activity since astuckalert. This extends the existingcurrentAlertstaleness check, which only covered newer runs and archived threads.busyWatcherHoldholds watcher deliveries while the watcher thread ispreparing/queued/starting/running, rechecking every 30 s (the flush interval), for at most 10 minutes. A queued message waits for that turn anyway, so the latency cost is at most one flush; the gain is that check 1 runs when the watcher can act. Webhook deliveries are not held.Drops log
watcher alert no longer true; dropped without waking anyonewith type and kind, which is the count for the before/after measurement.Tests. Table rows for each drop reason and the keep cases (
ThreadEventAlerts.test.ts), plus the hold table (ModelAlertReactor.test.ts): 80 passing.check:changedagainstorigin/release/native-0.1.10: format, lint, graphql and typecheck pass. knip reports only the 4 unused upstream scripts already present on this base (committed with--no-verifyfor that, as #98 did).AgentContextBudget.test.tsfails identically on the base head1a634c53(mcpToolListJsonBytes53985 vs 53783), unrelated to this change.Part of the agent event and messaging lane (tracking: nullStack65/closura-agent-config#873).
Work by Claude Opus 5.5 in Claude Code (T3 lane on primary-r720).
🤖 Generated with Claude Code
Deploy: fleet