Repository navigation
fix(orchestration): word the worker brief for a chat worker - #26036
Conversation
…ker-brief-wording
Status: ready for reviewThe problem. The brief Orca sends a worker agent was written for a terminal. A chat used as a worker, whether Orca started it for the task or a person already had it open (#22972), was told "the coordinator cannot see this terminal" and "Do not exit the shell. Your terminal stays available… re-engage this terminal". That is wrong for a chat, and because the brief also shows in the chat as the task message, a person reading the chat saw it too. The user-facing change. A chat worker's brief now says "this chat" in those places, and its last paragraph says: "If the coordinator has more for you, it will send this chat a fresh preamble + TASK block, which arrives as a new message." Terminal workers get exactly the same text as before. The choice is made from the worker's own name: a chat is named by its Orca session ID. The brief builder already used that to introduce the worker, so there is no new flag. Review.
Fixed:
Deferred. Not changed here, because rewording them would change terminal workers' text or a machine-readable field:
CI.
Verified:
Not verified:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughDispatch preambles now distinguish chat workers from terminal workers by their session handles. The generated instructions use mode-specific identity, visibility warnings, and post-completion guidance. Tests check the resulting preambles and verify that structured and terminal worker modes use their corresponding prompt senders. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The revised worker briefs are ready to merge after normal checks; no concrete issue remains identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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 |
ELI5
When a coordinator agent hands a task to a worker agent, Orca sends the worker a set of instructions (the "worker brief"). That brief was written for a worker running in a terminal. A worker can now also be a chat: either a chat Orca starts itself for the task, or a chat someone already had open that is used as a worker (#22972). Those chats were told things like "the coordinator cannot see this terminal" and "Do not exit the shell. Your terminal stays available…", which is wrong for a chat. This PR words those lines for a chat. Terminal workers get exactly the same text as before.
What Changed
Before: a chat worker's brief said:
After: a chat worker's brief says "this chat" in those places, and the last paragraph becomes:
"If the coordinator has more for you, it will send this chat a fresh preamble + TASK block, which arrives as a new message."
The brief also shows up as the task message in the chat, so a person reading that chat now sees this wording too.
Terminal workers' brief is unchanged, byte for byte. The existing snapshot test for it is untouched.
Mechanism: the brief builder (
src/main/runtime/orchestration/preamble.ts) already checks whether the worker is named by an Orca session ID (orca_session_id:…) to choose how to introduce the worker. Every caller names a worker that way only when it is a chat (one Orca started, or one adopted as a worker); a terminal is always named by its terminal handle. This PR moves that check into one function,isSessionHandle, and uses it for both the name and the new wording. Nothing else changes: no new setting or flag, no callers touched, and the CLI commands in the brief (including the--terminalflag name) are the same.Why
The worker's handle already says what kind of worker it is, and the builder already relies on it. Reading the same fact again means the name and the wording can't disagree. The other option was to add a "chat" value to the builder's
workerKindoption and have every caller set it. That adds a second flag that every caller would have to keep in step with the handle, and nothing setsworkerKindtoday.A chat that is passed
workerKind: 'bare-shell'still gets the chat wording, because a chat has no shell to exit.Linked Issue
Follow-up to #22972, which made a chat able to be a worker. That PR left this wording out of scope.
Visual Proof
This image shows the brief a chat worker receives, main (red) vs this PR (green). It is the brief builder's output, not a screenshot of a live chat. Unchanged lines are left out. The terminal worker brief is byte-identical on main and this PR (same sha256).
There is no layout, label or notice change; only the words of the brief differ. A live run was replaced by tests that read the text each real send path actually hands over (see Testing).
Testing
preamble.test.ts:workerKind: 'bare-shell'.The existing terminal snapshot is unchanged; the snapshot file only gained lines.
Tests that read the text each real send path hands over:
worker-start --terminal orca_session_id:…:structured-chat-worker-start.test.ts.orchestration dispatch --to orca_session_id:… --inject:structured-chat-dispatch-worker.test.ts.workerStarthandler:orchestration-worker-start-mode-selection.test.ts.workerStartand throughdispatch --inject: still gets "cannot see this terminal" and "Do not exit the shell. Your terminal stays available".Ablation: with the chat check forced off, every chat test failed (7) and both terminal tests passed. With the check restored, 100/100 pass.
orchestration-worker-mode-opacity.test.tschecks that a worker is taught the same thing whichever way it runs. It now treats the chat/terminal words and the last paragraph as expected differences, and checks that a chat gets the chat paragraph and a terminal keeps main's.356 tests passed across the 24 test files that build or check the brief. oxlint and the node typecheck are clean after merging current main.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
mode,reason: reused_terminal, effect kindterminal). These are machine values clients read, not wording. The human-readable line in that receipt already names the chat.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)X / Twitter: @BrennanKB5