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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds detection-only wedged-worker monitoring for supervised local workers. The change collects progress evidence, classifies worker states, resolves configurable thresholds, and queries eligible dispatches. It plans immediate and repeated escalation messages with restart-persistent counts. Runtime monitors start after workers become ready, re-arm after restart reconciliation, stop when no candidates remain, and suppress duplicate monitors. Tests cover classification, cadence, persistence, runtime lifecycle, and disabled detection. Documentation defines the behavior and operational handling. Merge Risk: ⚪ Minimal · up to This localized change adds wedged-worker detection and notification without changing worker control behavior; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
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 |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
src/main/runtime/orchestration/wedged-worker-runtime-monitor.test.ts (1)
126-137: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the re-arm path after the monitor stops itself.
The suite proves the monitor stops when no candidate exists. It does not prove that a later worker start arms it again. That transition is the whole reason the stop is considered safe. Add a test that stops the monitor through a zero-candidate scan, starts a ready worker, calls
ensureWedgedWorkerMonitoragain, and assertsrunWedgedWorkerScanreturns a summary instead ofnull.Also add a test for the scan-failure path once
runWedgedWorkerScankeeps the timer alive. See the comment onwedged-worker-runtime-monitor.tslines 90-102.src/main/runtime/orchestration/worker-progress-thresholds.test.ts (1)
40-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the re-escalation floor.
When
reEscalateAfterMsis belowwedgedAfterMs,resolveWorkerProgressThresholdsclamps it towedgedAfterMs. Add a case with900000and120000that expects both values to resolve to900_000.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a82cf7d9-abf7-42dd-8de3-9c2349d793f5
📒 Files selected for processing (17)
.gitignoreAGENTS.mddocs/reference/wedged-worker-detection.mdskill-guides/orchestration.mdsrc/cli/bundled-skill-guides.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration/db.tssrc/main/runtime/orchestration/types.tssrc/main/runtime/orchestration/wedged-worker-detector.test.tssrc/main/runtime/orchestration/wedged-worker-detector.tssrc/main/runtime/orchestration/wedged-worker-escalation.tssrc/main/runtime/orchestration/wedged-worker-runtime-monitor.test.tssrc/main/runtime/orchestration/wedged-worker-runtime-monitor.tssrc/main/runtime/orchestration/worker-progress-evidence.tssrc/main/runtime/orchestration/worker-progress-thresholds.test.tssrc/main/runtime/orchestration/worker-progress-thresholds.tssrc/main/runtime/rpc/methods/orchestration-workers.ts
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.
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: adb57ad6-6d38-42e9-8d6d-bf5ba6c13b6a
📒 Files selected for processing (11)
AGENTS.mddocs/reference/wedged-worker-detection.mdskill-guides/orchestration.mdsrc/cli/bundled-skill-guides.tssrc/main/runtime/orchestration/db.tssrc/main/runtime/orchestration/wedged-worker-detector.test.tssrc/main/runtime/orchestration/wedged-worker-detector.tssrc/main/runtime/orchestration/wedged-worker-escalation.tssrc/main/runtime/orchestration/wedged-worker-runtime-monitor.test.tssrc/main/runtime/orchestration/wedged-worker-runtime-monitor.tssrc/main/runtime/orchestration/worker-progress-evidence.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- skill-guides/orchestration.md
- AGENTS.md
- src/main/runtime/orchestration/wedged-worker-detector.ts
- src/main/runtime/orchestration/worker-progress-evidence.ts
- src/main/runtime/orchestration/db.ts
…-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.
|
I filed #14897 on 16 Aug proposing a nudge ladder for the same silence, before I had read this. Having now read Where the two meet. #14897's ladder is: Your evidence collector and classifier are exactly the input that ladder needs, and your escalation is exactly its ceiling. What neither of us has is the middle: a fixed, typed prod at the worker — you hold active dispatch X; if you finished, send That middle matters because the most common failure I hit is not a hung worker. It is a worker that finished and never sent The proposal, using your thresholds rather than new ones. I do not want a second cadence competing with yours. Instead, The honest cost is that your signal arrives later than it does today, by one nudge-confirmation window. I think that trade is worth it precisely because the escalation that survives it is the one a human actually needs to see, but it is your call before mine — it is your cadence. Three rules I would keep, and two of them you already have.
My question. Is "never writes to a worker" a permanent boundary for this feature, or the scope you set for this PR and intend to extend later? Both are reasonable and they lead to opposite things on my side:
I am not asking anyone to prioritise one over the other — this is your area and your PR, and I would rather ask than assume, which I have already got wrong once in this repo. One practical note, in case the notification did not reach you: this branch currently conflicts with |
|
Thanks for reading the doc before proposing on top of it — the ladder you drew is the right shape, and the boundary question deserves a straight answer. "Never writes to a worker" is the scope of this PR, and I do not intend to extend it. Take #14897 as a follow-up built on this classification; I will stay out of the nudge. Do not close it. Two reasons the boundary is where it is, in case they are useful when you build the middle:
On your cadence proposal — the trade is yours to make, and I think you are right about it. Making The one thing I would not fold in is a second threshold. If the nudge uses the same 15 minutes, a wedge costs the coordinator one nudge-confirmation window of extra latency, which is small next to the 15 that preceded it. If it gets its own, the two cadences drift the first time somebody tunes one. On the conflict: you are right, and your note is the first I knew of the One thing worth knowing before you spend time on it, since it is the reason these PRs have sat: our fork is owned by an organisation, and GitHub does not grant maintainer push on org-owned forks even though |
|
Moved to #15273 and closing this one — same branch, same commits, same head SHA, opened from a personal fork instead of an organisation-owned one. The reason is the one Jinwoo-H hit on #13639: GitHub does not grant maintainer push access on a fork owned by an organisation, even though the API reports Nothing about the change moved. This thread keeps the review history, and #15273 carries the code. @Tauri-EPO — your question and my answer are above and stay readable here; the code moved to #15273. Please carry the #14897 discussion there. The |
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.