Repository navigation
refactor(agent-launch): retire the duplicate worker-start mode decision - #20911
Conversation
`orchestration-worker-start-mode` becomes a thin adapter over `agent-launch/agent-launch-mode`, which already owns the same decision. Orchestration keeps its receipt vocabulary via WORKER_START_VOCABULARY, so every sentence a dispatch receipt prints is unchanged. Recovers the cutover written in f34d08a, which a later merge resolved in favour of main's side; the two added files survived, the deletion half did not.
|
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 (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No actionable regression is established in the worker launch-mode adapter; the change is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the implementation, compatibility, wording preservation, and verification results in detail. However, it omits several required template sections, including ELI5, Linked Issue, Visual Proof with N/A justification, Review, Agent skill upstream boundary, Notes, and the required checklist items. Resolution Update the description to follow the repository template. Add an ELI5 section, a Why section, the required Linked Issue with an issue reference, Visual Proof with exactly N/A and a reason because this is not a UI change, Testing checklist status, AI Disclosure if applicable, Review, Agent skill upstream boundary, Notes, and the remaining checklist items. ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 new issues found.
Reviewed changes
- Orchestration now delegates the mode decision —
orchestration-worker-start-mode.tsshrinks 217 → 82 lines, withdecideWorkerStartMode,resolveWorkerStartModeOnHost,downgradeWorkerStartModeForHostandreadWorkerStartModeSettingsforwarding to the sharedagent-launch/agent-launch-mode. WORKER_START_VOCABULARYrestores the exact receipt wording — supplies the worker nouns plusdetailOverridesforremote_execution_hostandreused_terminal, the only two downgrade strings where the shared default differs.- Types become aliases —
WorkerStartMode/WorkerStartModeReason/WorkerStartModeReceiptalias the sharedAgentLaunchMode*types; the never-exportedWorkerStartModeSettingsis dropped in favour of the structurally identicalAgentLaunchModeSettings. - Two stale “duplication still exists” comments corrected — in
agent-launch-executor.tsand the receipt-wording test header. No assertion changed;agent-launch-modeitself is untouched.
I independently confirmed the load-bearing claims: the adapter file hashes to 9cd9f51e0ac63d0c411951bee9979ca15772f80f (the byte-identical recovered blob), the old and new reason union / BLOCKER_REASON / HOST_SUPPORT_REASON / control flow and all nine downgrade strings match under the vocabulary overrides, and the four affected suites pass (47/47). Consumers across the workers path remain type-compatible.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Electron proof (review-only, isolated profile)Launched this PR worktree with Visible surface: Settings → Experimental. Configured the disposable structured-chat preference through the app UI:
Store confirmed Gap: |
Review status: LANDThe review/fix loop completed clean in one full round, followed by an independent re-audit and start/end readiness passes. No proven P0, P1, or P2 issue remains, and no production or test change was warranted. Architecture and correctness
Reliability and compatibility
Validation
Electron proofAn isolated background Electron run verified the exact PR worktree identity, enabled the real structured-chat preference through Settings → Experimental, confirmed the compiled worker vocabulary, and found no relevant console/app errors. Residual validation gap: the disposable profile did not execute No review fix was necessary, so the PR head remains |
#20911 retired the duplicated launch-mode policy, so main now describes `agent-launch-mode` as the single owner with `orchestration-worker-start-mode` as a thin adapter over it. The executor did NOT conflict. Main's only change there is the module header prose (lines 3-12); every change this branch makes to that file starts at line 81, so the two auto-merged cleanly. Verified both halves survived rather than assuming: main's "shared, not copied" wording is present, the stale "duplicated rather than shared" wording is gone, and combineLaunchWarnings is intact. Fifteen mobile RPC goldens conflicted, all on recorderSha256/adapterSha256 plus value-pool entries. Both sides had legitimately re-recorded them - this branch for the getAgentLaunchSupport adapter, main for its own new recordings - so NEITHER side's hashes are correct for the merged source and picking a side is wrong in both directions. Resolved by re-recording instead. Seeded from main's side deliberately, so a re-record that failed to run would drop this branch's agentLaunch fields and fail loudly rather than silently keeping stale local values. The re-record touched 16 files, not the whole corpus: the 15 conflicted plus tw-capabilities-cutover-retried.json, which auto-merged but still needed its hash refreshed. Proven behaviour-preserving by comparing added and removed content lines as multisets, with pool keys and hash fields normalised out: added 127 / removed 119 content lines net added: 8x "agentLaunch": false net removed: none So every value main recorded is preserved, and the only semantic delta is this branch's own adapter field. Goldens then re-validated in normal (non-record) mode: 17 files, 793 passed.
…on (stablyai#20911) `orchestration-worker-start-mode` becomes a thin adapter over `agent-launch/agent-launch-mode`, which already owns the same decision. Orchestration keeps its receipt vocabulary via WORKER_START_VOCABULARY, so every sentence a dispatch receipt prints is unchanged. Recovers the cutover written in f34d08a, which a later merge resolved in favour of main's side; the two added files survived, the deletion half did not.


What this does
maincurrently ships two implementations of one decision:src/main/runtime/rpc/methods/orchestration-worker-start-mode.ts(217 lines) — orchestration's original.src/main/agent-launch/agent-launch-mode.ts(248 lines) — the surface-neutral version landed by refactor(agent-launch): make the launch-mode decision surface-neutral #19848.They are parallel twins —
WorkerStartMode/AgentLaunchMode,WorkerStartModeReason/AgentLaunchModeReason,WorkerStartModeReceipt/AgentLaunchModeReceipt,decideWorkerStartMode/decideAgentLaunchMode,downgradeWorkerStartModeForHost/downgradeAgentLaunchModeForHost,readWorkerStartModeSettings/readAgentLaunchModeSettings— with the same ten-member reason vocabulary in the same order, and nothing enforcing that they agree.This reduces the orchestration module to an 82-line adapter over the shared one. It keeps
WORKER_START_VOCABULARYso orchestration's receipts read exactly as they do today.This recovers a cutover that was already written: commit
f34d08a452("refactor(agent-launch): make the launch-mode decision surface-neutral"). A later merge resolved that file in favour of main's side, so the deletion half was dropped while the two added files survived. The adapter committed here is byte-identical to the blob from that commit (9cd9f51e0ac6) — verified bygit hash-object.What I verified
API compatibility. Every import the adapter names still exists on the shared module with a compatible signature:
decideAgentLaunchMode({placement, settings, vocabulary?}),resolveAgentLaunchModeOnHost(runtime, receipt, worktreeId, agent, vocabulary?),downgradeAgentLaunchModeForHost(receipt, support, vocabulary?),readAgentLaunchModeSettings(runtime), plus the exported typesAgentLaunchMode,AgentLaunchModeReason,AgentLaunchModeReceipt,AgentLaunchModeSettings,AgentLaunchModeVocabulary. No adaptation was needed; the shared module is unchanged by this PR.No behavioural divergence. I diffed the two implementations with the type renames normalized. The reason union (all ten members, same order),
BLOCKER_REASON,HOST_SUPPORT_REASON, and every branch of the control flow are identical. The only substantive differences are the vocabulary parameterization and twoDOWNGRADE_DETAILstrings:remote_execution_hostthis worker runs on a remote execution hostthis launch runs on a remote execution hostdetailOverridesreused_terminal--terminal reuses a running terminal agentit reuses a running terminal agentdetailOverridesWORKER_START_VOCABULARYoverrides exactly those two, and supplies theworkernouns. The other seven downgrade details were already identical.Consumers. All importers of the orchestration module type-check unchanged:
src/main/runtime/rpc/methods/orchestration/worker/workers.ts—decideWorkerStartMode,readWorkerStartModeSettingssrc/main/runtime/rpc/methods/orchestration/worker/worker-start-agent-placement.ts—resolveWorkerStartModeOnHost,WorkerStartModeReceiptsrc/main/runtime/rpc/methods/orchestration/worker/local-worker-start.ts—resolveWorkerStartModeOnHost,WorkerStartModeReceiptsrc/main/runtime/rpc/methods/orchestration/worker/worker-start-receipt.ts—WorkerStartModeReceiptsrc/main/runtime/rpc/methods/orchestration/worker/worker-start-readiness-settlement.ts—WorkerStartModeReceiptorchestration-worker-start-mode.test.ts,orchestration-worker-start-receipt-wording.test.ts,orchestration-worker-support-unknown.test.tstests/e2e/structured-native-chat-routing-authority.unit.test.ts—decideWorkerStartModeThe one type the adapter stops declaring,
WorkerStartModeSettings, was never exported and has no consumer outside the module.Wording pin.
orchestration-worker-start-receipt-wording.test.tspasses unchanged in its assertions — every sentence in a dispatch receipt is identical to whatmainproduces today.Ablation. With the adapter in place, corrupting
WORKER_START_VOCABULARYone field at a time. Each edit asserts it matched exactly once, so a substitution that silently matched nothing cannot pass as an arm.structurednoun corruptedterminalnoun corruptedremote_execution_hostoverride droppedreused_terminaloverride droppedArms C and D are the load-bearing ones: they show that if the adapter had simply taken the shared module's default wording, the pin catches it.
Typecheck.
pnpm tcexits 0. I confirmed the gate actually covers this file rather than reporting a vacuous pass: injectingexport const TYPECHECK_CANARY: number = "not a number"producederror TS2322undertsconfig.node.jsonand exit 1.Tests.
src/main/runtime/rpc/methods/orchestration+src/main/agent-launch+ the four worker-start suites + the e2e routing-authority unit test: 87 files, 799 tests, 0 failing, 0 skipped. The six directly-affected suites were 69/69 before this change and 69/69 after.Quality gates.
pnpm run check:code-quality:changed— 0 new findings across 3 changed files (code quality, casting, type-aware, React Doctor, design system, casting SAFETY rationale).oxlintclean. Nomax-linesdisable added; the module shrinks 217 → 82 lines.Comment updates
Two comments on
mainassert the duplication still exists and become false with this change. Prose only — no test assertion was touched:agent-launch-executor.tssaid the mode decision "is duplicated rather than shared … with nothing enforcing agreement between them. That cutover is later stack work too."WORKER_START_VOCABULARYrestores it.