Repository navigation
Conversation
beginWorkerStop revokes the dispatch capability on intent, before the stop outcome is known. When the stop closes nothing — an external or otherwise unreachable terminal — it settles as stop_unknown, but the revocation stays: sends to the dispatch are still accepted while the worker's own reports are rejected, muting a worker that is still running. An unproven stop now takes nobody's authority. markWorkerStopUnknown hands the capability back while the dispatch is still pending or dispatched, the same principle as failWorkerStart's retainCapability (stablyai#16095): a worker that may still be running keeps the way to report. settleWorkerReport accepts a report from a stop_unknown worker the way it already accepts start_unknown — first-hand evidence outranks the unproven inference — gaining a stop_unknown -> ready edge and clearing the stale stop reason on re-entry. The remote attachment mirror cannot restore a nulled capability_hash (the token lives only with the worker), so the hash now survives the stop intent and is cleared only by proven outcomes: settleRemoteAttachmentStop and the relay settle. verifyRemoteAttachmentAuthority gains a stopping-state guard to keep the in-flight fence the nulled hash used to provide, and both relay settle paths — the modern ack settle and the legacy-protocol enqueue — admit stop_unknown. reconcileFederatedWorkerStop re-asserts revocation when a late remote report proves the stop after all, so a restored capability cannot still verify on a failed dispatch.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change restores capability state after unproven local worker stops and preserves revocation after confirmed stops. Worker reports from Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
ℹ️ No critical issues — one narrow edge case inline.
Reviewed changes
- Home-side capability restore on
stop_unknown—markWorkerStopUnknownclearscapability_revoked_atwhile the dispatch is stillpending/dispatched, guarded so a concurrently-settled dispatch keeps its revocation;reconcileFederatedWorkerStopre-asserts it when a late remote report proves the stop. stop_unknown → readyworker edge —settleWorkerReportInTransactionnow treats astop_unknownreport likestart_unknown: it settles a blocked dispatch, reopens the task, and clears the stale stop reason.- Remote attachment hash survives the intent —
beginRemoteAttachmentStopno longer nullscapability_hash;verifyRemoteAttachmentAuthorityfences an in-flight stop bystate === 'stopping', and the hash is cleared only by proven settles. - Relay settle admits
stop_unknown— both the ack-drivensettleRemoteAttachmentInRelayTransactionand the legacysettleRemoteAttachmentOutcomeenqueue gate. - Tests — new 13-case
db-worker-stop-capability-restore.test.tsplus twolifecycle-caller-edgesentries.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…a dispatched task The stop_unknown/start_unknown reconnect routed a succeeded report through ready only when the task was blocked. A legacy or context-only sibling dispatch can hold the task at dispatched through the unproven stop, so the report fell through to the ready-only fallback and threw lifecycle_conflict, losing first-hand evidence the worker never stopped. Key the worker-level ready -> succeeded reconnect on the worker's own unproven state instead of the task marker; the blocked -> dispatched task transition stays gated on the blocked shape.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Unproven-worker success reports reconnect through
readyregardless of task status — extractedunprovenWorker(start_unknown/stop_unknown) and added it to thesucceeded-report branch gate, so astop_unknownworker reporting success while a context-only sibling holds the Task atdispatchedno longer falls through to thefrom: 'ready'fallback and loses the report to alifecycle_conflict. The blocked-task reconnect (reconnectingWorker) is unchanged. - Regression coverage — the new case constructs the legacy sibling shape (raw
dispatch_contextsinsert) and asserts the report settles the dispatch and completes the Task; I verified it throwsworker ... is stop_unknown; expected readywhen the branch gate is reverted, then passes at head. The rest of the related lifecycle suites stay green (8 files, 107 tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
FYI: #23982 removes the per-dispatch capability from authorization and includes the settlement half of this PR (a |

ELI5
When you ask Orca to stop a supervised worker whose terminal it does not own (for example a terminal the worker was attached to rather than one Orca created), Orca cannot actually close anything, so it records the honest outcome
stop_unknown. But the stop had already taken away the worker's messaging capability up front — before knowing whether the stop worked. The worker is still alive, you can still send it messages, but everything it sends back (worker_done, heartbeats, questions) is rejected with "capability is revoked". The worker is effectively muted forever even though nothing was stopped.What Changed
An unproven stop no longer takes away a worker's authority, on both sides of the fence:
Local (home) side
markWorkerStopUnknownhands the dispatch capability back while the dispatch is stillpending/dispatched— the same principle asfailWorkerStart'sretainCapability([Bug]: agent_prompt_stalled for codex/kimi workers — fixed 5s confirmation window vs ~20s first hook-event latency (root-cause evidence) #16095): a worker that may still be running keeps the way to report, and re-arming one that did die costs nothing because the dead send no messages.settleWorkerReportaccepts a report from astop_unknownworker the way it already acceptsstart_unknown— first-hand evidence outranks the unproven inference. This gains astop_unknown → readylifecycle edge and clears the stale stop reason on re-entry.Remote (federated attachment) side — the mirror bug, where
capability_hashwas nulled on intent and cannot be restored (the token lives only with the worker):settleRemoteAttachmentStopand the relay settle.verifyRemoteAttachmentAuthoritygains astopping-state guard, keeping the in-flight stop fence the nulled hash used to provide.stop_unknown: the modern ack-driven settle and the legacy-protocolsettleRemoteOutcomeenqueue gate (without the second one, workers on older-protocol peers would stay muted).reconcileFederatedWorkerStopre-asserts revocation when a late remote report proves the stop after all, so a restored capability cannot still verify on a failed dispatch.Why
The alternative — not revoking until the stop is proven — would drop the in-flight fence: during
stopping, inbound worker reports would pass the authority gate and race the settle path. Revoking on intent and restoring only on the unproven outcome keeps the fence exactly as strong during the window that matters, while makingstop_unknownmean "unverifiable" rather than "dead to me", matching the vocabulary indocs/reference/ssh-execution-boundary.md.Not changed, deliberately:
retry-ofandtask-update --status readyon astop_unknownrow still refuse (retrying could duplicate a live worker — the clean exit remainsworker-abandonfirst), and a remote attachment that reachedstop_unknownviastart_unknownstays muted (its hash was cleared earlier byfailRemoteAttachment— the remote twin of #16095, a separate fix).Linked Issue
Fixes #21688
Visual Proof
N/A — orchestration state-machine change, no UI or interaction change.
Testing
New
db-worker-stop-capability-restore.test.ts(13 cases): capability revoked during in-flight stop and restored onstop_unknown; kept on proven stop; not restored onto an already-settled dispatch;worker_donesucceeded/failed reports settling the blocked dispatch; remote hash surviving intent / fenced by state / cleared on proven settle; relay settle acceptingstop_unknown; the legacy-protocol enqueue path; revocation re-asserted on a late-proven federated stop.Also ran:
lifecycle-caller-edges(updated with the new edges),db-stopping-worker-task-guard,orchestration-worker-dispatch-db,db-task-dispatch-lifecycle-guards,worker-start-unobserved-prompt-settlement,db-task-dispatch-invariant,db-task-dispatch-races,lifecycle-reconciliation,mailbox-consumer-lifecycle-fencing,dispatch-capability,federation-lifecycle-settlement,federation-liveness-verdict,worker-stop-liveness-verdict,worker-stop-exit-race,worker-stop-capability,structured-worker-stop-receipt,send,federated-dispatch-observation-fence,remote-dispatch-attachment-release— all green. Typecheck and the changed-file code-quality gate pass.Review
Agent skill upstream boundary
Notes
The remote/federated half was changed symmetrically and unit-tested at the DB layer; it was not exercised against a live relay. Cross-platform impact is nil (pure state machine). SSH/remote impact is the point of the remote half.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)