Repository navigation
Conversation
A worker_done that Orca refuses left its worker Dispatch at state=ready, stage=input_accepted — the same reading as a worker that is still thinking. Nothing else moved that row, so a lane whose worker had already finished stayed green for the rest of the wave. A refused report from the assigned pane now parks the lane at stop_unknown with stage=worker_report_rejected and the rejection reason in last_error, so an audit can tell an ended Dispatch from a live one. Reports from a terminal that is not the assignee leave the lane untouched. A later accepted report still settles a parked lane, and a parked lane that loses its terminal still requeues its Task. Refs stablyai#13364
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe orchestration runtime validates worker-report identity before recording rejection. Authorized invalid reports can park ready dispatches in Merge Risk: 🟡 Moderate · up to An assigned worker report with an invalid capability or malformed or mismatched payload can still move an active dispatch into stop_unknown, leaving valid work in the wrong state; merge should wait for this correctness issue to be fixed or explicitly accepted. 🚥 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: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c23b3789-d59f-4a4a-936d-89d5dfe9f321
📒 Files selected for processing (5)
src/main/runtime/orchestration/db.tssrc/main/runtime/orchestration/lifecycle-reconciliation.tssrc/main/runtime/orchestration/types.tssrc/main/runtime/rpc/methods/orchestration-rejected-worker-report-lane.test.tssrc/main/runtime/rpc/methods/orchestration.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review.
The capability-invalid branch parked the Dispatch on pane authority alone. Pane authority says the sender is the assignee; it says nothing about what the sender reported. An assigned terminal could therefore send a worker_done naming another task, or no task at all, and move its own healthy lane from ready to stop_unknown — the state that exists for a worker that really finished and could not be settled. isWorkerReportForDispatch applies the identity checks reconciliation already makes — right task, right Dispatch, real outcome — before the park. A report that fails them is still rejected as it was; it just leaves the lane where it found it, which is what the PR promises for unknown Dispatches, mismatched tasks and malformed payloads. The helper lives in its own module: lifecycle-reconciliation.ts is at the max-lines ceiling, and the identity question is shared by the send path and the reconciler rather than owned by either.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/orchestration/worker-report-identity.ts (1)
3-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten this block comment.
Keep the non-obvious rationale in one concise line. The helper name and predicates already show the behavior.
As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fe926958-02f0-4a93-83ac-41988f3971ec
📒 Files selected for processing (3)
src/main/runtime/orchestration/worker-report-identity.tssrc/main/runtime/rpc/methods/orchestration-rejected-worker-report-lane.test.tssrc/main/runtime/rpc/methods/orchestration.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
The repository asks for one concise non-obvious line; the block was restating what the predicates already show.
|
@coderabbitai nitpick taken — // Why: parking a lane on a rejected report needs the same identity proof reconciliation applies,
// or a report naming another task would move a lane it never worked.Eight lines down to two. What is kept is the only part the code cannot say: why a courtesy path needs reconciliation-grade proof. The three predicates already say which task, which Dispatch and which outcomes, so spelling them out in prose was a second copy that could rot away from the first. |
|
Tip For best results, initiate chat on the files or code changes.
🐇 ✓ 🧠 Learnings usedIf you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
What changes
A
worker_donethat Orca refuses now takes its worker Dispatch out ofready. A refused report from the assigned pane parks the lane atstate = stop_unknown,stage = worker_report_rejected, with the rejection reason inlast_error.Fixes #13364 (point 2 — "never leave the dispatch reading
ready").Evidence
Two traces of the same shape, from waves run against v1.4.176/v1.4.178.
2026-08-09. A supervised worker tried to report twice, twenty seconds apart. Both attempts came back rejected and were stored as
Rejected worker_done: … blocked at finish gatewith a body beginning "Orca rejected this worker_done". Its escalation went to the Run mailbox. The work itself was fine — the branch merged and the ticket closed three minutes later — butctx_5781041c767cstill readstate = ready, stage = input_acceptedhours afterwards, which is exactly what a live worker looks like. Two of that wave's nine dispatch contexts were in this state and nothing in Orca would ever have noticed.2026-08-10. Six workers finished their task and every
worker_donecame back rejected, because their dispatches had been revoked after a readiness timeout while the agents themselves ran to completion. The coordinator ended up detecting completion by reading files on disk, because the one channel that reports completion had refused all six.Why this branch and not the other one
The alternative was to leave the dispatch alone and make the rejection loud to the sender. That is already true on
main, so there was nothing to add:orchestration.sendreturnslifecycle: { action: 'rejected', code, reason }(orchestration.ts).Rejected <id>: <reason>(src/cli/handlers/orchestration.ts:592), covered byorchestration-lifecycle-rejection.test.ts.hasRemoteLifecycleRejection.The 2026-08-09 worker did learn — it retried, then escalated. What no one learned was that its lane had ended. So the gap is the dispatch row, not the sender.
How
markWorkerReportRejectedonOrchestrationDbis called from the two places aworker_donecan be refused after its sender has proved it owns the dispatch:orchestration.send. This branch returns beforereconcileLifecycleMessage, which is why the row was never touched. It is gated onhasLifecycleAuthority, so a terminal that is not the assignee cannot park someone else's lane by naming its dispatch id.settleWorkerReportInTransaction, forinactive_dispatchandstale_dispatch— the codes that mean this exact dispatch can no longer settle. This path is reached only after the authority check inreconcileWorkerDoneMessage, and it also covers reports that arrive over the federation relay.Rejections that cannot identify a lane the sender owns —
sender_not_assignee,unknown_dispatch,task_dispatch_mismatch, a malformed payload — leave the row alone.stop_unknownrather thanfailed:failedis inWORKER_RELEASABLE_STATES, so it would mark the agent's terminal reclaimable while the agent may still be running.stop_unknownkeeps the terminal retained and reads as "this ended and I do not know how", which is what a refused report actually tells us.worker-abandon— "fence a worker without claiming its process stopped" — still fences a parked lane in full.Two consequences handled in the same change, so the fix does not create a new way to strand things:
--dispatch-capability) still settles a parked lane, instead of completing the Task while the lane stays atstop_unknown.reconcileMissingWorkerTerminalstill requeues the Task for a parked lane. ItsstopWasPendingtest now excludes the report-rejected stage, because such a lane never had a stop requested.Nothing in readiness, revocation, the dispatch lifecycle, or the mailbox changes.
Test plan
New:
src/main/runtime/rpc/methods/orchestration-rejected-worker-report-lane.test.ts— 7 tests over a real supervised worker lane.Results on this branch:
The full
pnpm testrun also passed except for two timing assertions unrelated to this change (terminal-output-frame-chunks-equivalence,ai-vault-session-worktree-map), which the machine's load caused; both pass when re-run on their own.Moved from #13655, 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 #13655: #13655