Repository navigation
Conversation
Add the evidence model behind a wedged-worker signal: a DB query for "ready" supervised dispatches with their heartbeat, worker-message and question timestamps, plus a pure classifier that turns those and a pane liveness sample into working, blocked, unknown or wedged. Absence of evidence classifies as unknown and never as wedged, and unknown is never promoted to working. Federated dispatches, unobservable panes and panes whose process was replaced all classify as unknown. Thresholds come from the environment with documented defaults and are clamped so a bad value cannot turn the detector into a spammer.
Synthesize one high-priority escalation into the owning Run's mailbox when a supervised worker shows no progress evidence past the threshold, then repeat only on the long cadence with a rising count. Resumed progress or a settled dispatch clears the cadence, and the count is read back from the last escalation so a runtime restart cannot restart it at one. Detection only. The path performs no process, terminal or filesystem action: it never stops, kills, restarts, interrupts, closes, focuses or writes to a worker. The escalation says so in its own body, and its taskId stays nested under payload.wedgedWorker so the retired coordinator loop cannot read it as a dispatch failure.
Arm the wedged-worker detector when a supervised worker becomes ready and when workers are adopted after a restart. The runtime supplies the two things the detector cannot see for itself: the worker pane's PTY output and harness turn boundaries, and whether a blocking ask or check --wait is parked on the dispatch's mailbox. The scan is off the hot path. It runs on its own unref'd timer, short-circuits on the DB's cached dispatch-emptiness probe, and stops itself as soon as a pass finds no supervised worker, so a runtime that never orchestrates pays nothing.
Record what counts as progress evidence, what classifies as unknown rather than wedged, why a blocked worker is never a wedge, the configurable cadence and its defaults, and the message shape. Tell coordinators in the orchestration guide how to read the signal: it is advisory, Orca took no action on the worker, and a rising escalationCount is the same wedge reported again. The existing rules stand — a check --wait timeout is still a checkpoint, and a slow worker is still not a failed one.
Five fixes from review on stablyai#13762, four of them correctness: - createStartingWorkerDispatch now marks the dispatch-context emptiness cache true. The agent-status publish path probes that cache on every frame, so a cached false was the normal state when a session's first worker started; the scan then reported zero candidates and the monitor disarmed itself. - A persisted escalation is discarded when the worker made progress after it, so a recovered-then-wedged dispatch escalates at once with the count back at 1 instead of inheriting a stale count and a stale cadence. The comparison allows a one-second margin because SQLite stamps whole seconds while pane evidence is millisecond-precise, and a truncated stamp would otherwise double-escalate an unchanged wedge. - A failed scan no longer disarms detection for every supervised worker. The timer keeps running and the next tick retries; five consecutive failures disarm it. - An exact process-incarnation match is now required whenever the dispatch recorded one, and both identity checks run before the harness-state check. A pane that reports no identity is unverified, so it stays unknown rather than lending its output to a working, blocked or wedged verdict. - Both guidance documents now name the wedged classification rather than "no progress evidence", because missing evidence is unknown and a worker on ask or check --wait is blocked. The escalation cadence tests now write to the Run mailbox instead of a memory-only stub, which is what hid the persisted-record defect.
…-worker signal The escalation record was read back off the message row stamp, which SQLite truncates to whole seconds. A one-second tolerance hid that loss, and the same tolerance rejected real progress made inside the second after an escalation: a worker that resumed was read as the same unchanged wedge, so its next wedge was suppressed by the old cadence or reported with an inflated repeat count. The signal payload now carries escalatedAtEpochMs, the instant the detector escalated, and the reader prefers it. The row stamp stays as the fallback for records written before the field existed, and a record read that way is marked truncated so the tolerance applies to it alone. An exact instant needs no margin. The reset test mixed a fake clock with the real row stamp: it set the worker's output to exactly the escalation instant, and that only read as later progress because the stamp came from real wall-clock time, minutes behind the fake clock. It now moves the clock first, so the output lands strictly after the escalation and the test asserts what it says it asserts. Also states the unknown-classification rule directly in the reference doc.
|
Warning Review limit reached
Next review available in: 23 minutes Limit details: You’ve used all 10 included reviews currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (18)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Carrying this over from #13762 as you asked, and thanks for the straight answer on the boundary. On the boundary. Understood, and I will keep #14897 open as a follow-up built on this classification rather than beside it. Your first reason is the one I had not thought through: a detector that writes ends up reading its own bytes back as evidence, so the nudge has to sit above the classifier or the classifier stops being trustworthy. That is a stronger argument for the split than the one I made, and I will state it that way on #14897 so the ordering is on the record and nobody has to reconstruct it from two threads. On the cadence. Agreed, and no second threshold — one cadence, On the The split is Your
One correction to something you wrote, in your favour. You mentioned the On the fork. Thanks for writing that up — I would not have guessed it, and it is worth knowing before anyone else sets one up under an organisation. |
|
thanks for reporting. looking into it |
|
Thank you — the port map is exactly what was needed, and your correction about #15274 is right: that branch does not touch What I did with the map. I ran the rebase to see how far it reaches, and it stops one commit in, on the whole-file conflict you would expect: One addition to your map, found while looking: my Also useful, and thank you for flagging it: What I am not doing today, and why. The port is six commits deep with the conflict recurring past the first, so I am not landing it inside a daily review pass where I would be half-finishing it. It is going on our side as its own piece of work, with your map as the specification. When it lands, this PR should read as an ordinary diff against current On the boundary and the cadence — agreed on all of it, and thank you for saying you will put the ordering argument on #14897. That is the right place for it: a reader of the ladder needs to know why the detector cannot own the nudge, and reconstructing it from two PR threads is exactly the kind of thing that gets lost. |
A supervised worker that hangs is indistinguishable from one that is thinking hard until the coordinator's own
check --waitwindow expires — routinely 15 to 60 minutes of nothing. The runtime already receives turn-boundary events from each worker's harness and already owns its PTY, so it can notice the silence far sooner.This adds that detection and nothing else.
What it does
readydispatch: harness turn boundaries, harness hook events, PTY output, accepted heartbeats, messages the worker itself sent, and recordedaskthreads.escalationinto the owning Run's mailbox when a dispatch stays quiet past the threshold, describing what was and was not observed, then repeats only on a long cadence with a rising count.What it deliberately does not do
taskIdstays nested underpayload.wedgedWorkerprecisely because the retired coordinator loop fails a dispatch on a top-levelpayload.taskId.ask, a liveaskorcheck --waiton the dispatch mailbox, and a harness reportingwaitingorblockedall classify as blocked. The dispatch preamble already tells workers those calls are themselves liveness signals; this honours that.check --waittimeout is still a checkpoint, not a failure, and heartbeats plus visible terminal activity still mean alive, not done. The escalation body says so, and the orchestration guide now says a rising count is the same wedge reported again.Delivery
The escalation reaches the coordinator through the same
notifyMessageArrivedpath thatworker_done,questionand setup-status messages already use, including push-on-idle into the coordinator's own pane. No such delivery is ever aimed at the worker.Cost
The scan runs on its own unref'd timer, short-circuits on the DB's cached dispatch-emptiness probe, and stops itself as soon as a pass finds no supervised worker. It adds no per-message work. The detector is armed when a supervised worker becomes ready and when workers are adopted after a restart.
Compatibility
No RPC shape and no stream opcode changes. It publishes new content of an existing message type on an existing path, which is a Rule 3 concern in
docs/reference/remote-wire-compatibility.md: an older paired client receives an ordinaryescalationit can read, print and acknowledge, and it ignores the payload key it does not know. Federated dispatches never produce this signal, so a mixed-version pair cannot see one attributed to a worker its own server does not own.Tests
src/main/runtime/orchestration/wedged-worker-detector.test.ts,wedged-worker-runtime-monitor.test.tsandworker-progress-thresholds.test.tscover wedged, working, blocked onask, blocked incheck --wait, harness waiting, settled, missing pane, disconnected pane, replaced process, federated, deduplication at the scan interval, the long re-escalation cadence, count reset after resumed progress, count resumption after a restart, and detection disabled.The monitor test drives the real runtime adapter behind a proxy that fails on any runtime call outside the four read-only ones this path is allowed to make, so "it touches no terminal" is machine-checked rather than asserted.
oxlint, the native and type-aware code-quality audits, the max-lines ratchet and the bundled-skill-guide check all pass. Nomax-linessuppression was added; the detector is split across four modules instead.Documentation
docs/reference/wedged-worker-detection.mdrecords what counts as progress, what classifies as unknown, why a blocked worker is never a wedge, the cadence and its defaults, and the message shape. It is linked fromAGENTS.md, which is what the.gitignoreallow-list for tracked reference docs requires.Moved from #13762, same commits, same head SHA. That pull request was opened from an organisation-owned fork, and GitHub refuses maintainer pushes on org-owned forks even when
maintainer_can_modifyreportstrue— so a maintainer could not push a fixup to it, only ask or rewrite. This one is on a personal fork, where a maintainer push works.The review history stays readable on #13762: #13762