You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(orchestration): name a worker's mail by its Dispatch, recorded when it is written - #44472
A worker's message now records which Dispatch it was sent for, with a small snapshot of who the worker was (task title, agent, paired server), on every path that writes worker mail. Cards name the sender from that record once its chat or terminal no longer names it, so a worker that is gone shows its task, "Fix the login page", next to its agent's icon, and one on a paired server also shows the server's badge, instead of "an agent". Every surface that names a worker (message cards, crew rows, start cards) already shows the agent's icon, so the name is the task alone; the agent word stands in only for a task with no title. A live chat or terminal name still wins. "an agent" now only appears for mail that no worker sent.
Outcome
Sender
Before
After
Local worker, exit report Orca files after its terminal closed
"an agent" with a "?" icon
"Fix the login page" with the Claude icon
Local worker, mail read after its pane lost its tab
task title only, or "an agent"
"" with its agent icon
Worker on a paired server (imported mail)
task title only
"" + server badge
Worker on an older paired server (relayed mail)
"an agent"
"" + server badge
Worker whose chat or terminal is still open
its live name
unchanged
Crew row for a worker with no live name
display name, else task title
task title, same as its cards
A person's terminal, or any mail from no worker
its terminal name, else "an agent"
unchanged
Cards delivered before this change
saved name
unchanged (saved on the card)
How
Write (one record per worker message).message_dispatch_provenance was only filled for a server's own Runs. It now gets a row, plus a sender_snapshot column, for every worker message: sends, replies, group sends, questions, reports Orca files about a worker, mail imported from a paired server, and mail relayed by an older paired server. Heartbeats are skipped (never shown). The column is added in place on open, like answer_sender_snapshot; no schema version bump.
One lookup.workers/identity/worker-identity.ts resolves a Dispatch to {title, agent, hostLabel} for local, server-owned and relayed Dispatches. It builds the snapshot at write time, names dispatch: senders and old rows, and its title rule is now shared with sessionWorker().
Read. The card's sender snapshot reads the record (one primary-key read per message, replacing the existing import-only read). Live chat/terminal name → recorded worker → the existing lookup, in that order.
Removed: the remote start card's own agent override (the lookup now finds the server's Dispatch and its agent) and the import-only provenance reader.
Crew rows use the same lookup, by the Dispatch each row shows, so a worker has one name everywhere. A peer Run's queue carries a sender's Dispatch home only when that Dispatch belongs to the peer Run, so mail from another Run's worker never makes the coordinating Orca record a Dispatch it does not own. Not changed: the renderer's live-chat label lookup (it only applies live names, which still win).
Before / after (isolated dev Orca, coordinator chat)
Before (main): the local worker's exit report is "an agent"; the paired server's worker shows only its task.
After: every worker card names its task next to its agent's icon, the paired server's worker carries its server badge, and the person's terminal is unchanged.
Validation
Live e2e, isolated profiles and homes on one Mac: home Orca (hidden headed dev build, CDP) paired with a second Orca running orca serve. A coordinator chat started one local and one paired-server Claude worker; each sent a status, rested, then had its terminal closed so Orca filed its exit report; a plain terminal then mailed the coordinator.
main: local exit report "an agent"; server worker "Check the Windows build".
this branch: "Fix the login page"; "Check the Windows build" + devB badge, each with the Claude icon; person unchanged.
Upgrade: started on main, upgraded both sides in place. The column was added in place, rows written before it kept no snapshot (the reader names those from their Dispatch), saved cards were unchanged, and new mail on the upgraded pair was named as above.
The older relay protocol can't be paired live here (both builds speak the newer protocol), so it is covered by a unit test through the real relay import.
Tests that fail on revert: peer-run-queue.test.ts, mail from another Run's worker into a peer Run's mailbox goes home without its Dispatch (reverting carries it). runtime-orchestration-sender-names.test.ts: a crew row names a worker as its card does (reverting gives "Codex", or a newer Dispatch's task on the same terminal); worker mail read after its tab is gone (reverting the write gives name: null); relayed mail from an older server (reverting gives name: null). Existing paired-server tests were updated to the new wording.
Perf: one indexed read per card (SEARCH message_dispatch_provenance USING INDEX (message_id=?)), the same count as the import-only read it replaces. Nothing else is read when the record has a snapshot. Writes add a few primary-key reads per worker message (not per heartbeat), off the render path.
Risk
Medium-low. Card wording changes for workers that are no longer live. Rows without a record fall back to the existing lookup, and live names are untouched.
…en it is written
A worker's message now records the Dispatch it was sent for, with the worker's task, agent and paired server as they were then, on every path that writes worker mail: sends, replies, group sends, questions, reports Orca files, and mail imported from a paired server. Its card names the sender from that record once the worker's chat or terminal is gone ("Fix login · Codex", with the server's name for a worker on a paired server) instead of "an agent". A live chat or terminal name still wins, and mail from no worker is named as before.
…nd agent
A pane still registered when Orca files its exit report has no tab left to name it; the card now names it by its Dispatch, as it does once the pane is gone.
…peer Run; crew rows use the worker lookup
A worker in another Run mailing a peer Run's mailbox no longer carries its Dispatch home, so the
coordinating Orca cannot record a server Dispatch for a task it does not own. Crew rows name a
worker by the Dispatch they show through the same rule as its sender cards.
No actionable comments were generated in the recent review.
Walkthrough
The changes add worker identity lookup and snapshot storage to message dispatch provenance. Message insertion paths record sender dispatch data, and peer-run mail queries include dispatch details only when the dispatch belongs to the receiving run. Structured mail and sender snapshots use recorded worker identity to resolve names, agents, and host labels. Crew row naming now uses dispatch IDs, and session worker titles use the shared task-title helper.
Merge Risk: Minimal · up to 4402e
Worker mail and crew rows now take their names from the recorded Dispatch. No concrete merge-blocking risk was identified in the reviewed changes.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Description check
The description is thorough and covers the changes in depth. It has a clear What section, an Outcome table of before/after behavior, a How section with the mechanism, live e2e validation with an upgra…
1. Add an ELI5 section with a plain-language explanation. 2. Fill in the Linked Issue section with a real issue number in place of 'Fixes #', or confirm the author is a maintainer who needs no new issue. 3. Tick the Testing checklist items …
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: worker mail is now named by its Dispatch, with the Dispatch recorded when the message is written. The changeset adds a per-message provenance record with a sender snap…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: worker mail is now named by its Dispatch, with the Dispatch recorded when the message is written. The changeset adds a per-message provenance record with a sender snapshot (task title, agent, host), and the read path uses it to name sender cards and crew rows. The title follows the conventional commit format and is specific to the primary change, so it passes.
Full details: Description check
Explanation
The description is thorough and covers the changes in depth. It has a clear What section, an Outcome table of before/after behavior, a How section with the mechanism, live e2e validation with an upgrade test, unit tests that fail on revert, performance notes, and a risk statement with a level. It also includes a before/after image set. Some template sections are missing or incomplete. The ELI5 section is absent. The Linked Issue section is empty: 'Fixes #' has no issue number, and the template says outside contributors must link an actual issue. The Testing checklist boxes are unchecked, and the Review, Agent skill upstream boundary, and AI Disclosure sections are not addressed. The Checklist is not ticked, including the pnpm lint, typecheck, test, and build item. The Risk section gives a level and a backout plan is not stated explicitly.
Resolution
Add an ELI5 section with a plain-language explanation. 2. Fill in the Linked Issue section with a real issue number in place of 'Fixes #', or confirm the author is a maintainer who needs no new issue. 3. Tick the Testing checklist items that apply, or explain why not. 4. Complete the Agent skill upstream boundary checkbox. 5. Complete the AI Disclosure section if the contributor is not a stablyai team member. 6. State how to back out the change (a plain revert, or what a revert would not undo) in the Risk section. 7. Complete the Checklist, including confirming that pnpm lint, typecheck, test, and build pass.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving 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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A worker's message now records which Dispatch it was sent for, with a small snapshot of who the worker was (task title, agent, paired server), on every path that writes worker mail. Cards name the sender from that record once its chat or terminal no longer names it, so a worker that is gone shows its task, "Fix the login page", next to its agent's icon, and one on a paired server also shows the server's badge, instead of "an agent". Every surface that names a worker (message cards, crew rows, start cards) already shows the agent's icon, so the name is the task alone; the agent word stands in only for a task with no title. A live chat or terminal name still wins. "an agent" now only appears for mail that no worker sent.
Outcome
How
message_dispatch_provenancewas only filled for a server's own Runs. It now gets a row, plus asender_snapshotcolumn, for every worker message: sends, replies, group sends, questions, reports Orca files about a worker, mail imported from a paired server, and mail relayed by an older paired server. Heartbeats are skipped (never shown). The column is added in place on open, likeanswer_sender_snapshot; no schema version bump.workers/identity/worker-identity.tsresolves a Dispatch to{title, agent, hostLabel}for local, server-owned and relayed Dispatches. It builds the snapshot at write time, namesdispatch:senders and old rows, and its title rule is now shared withsessionWorker().Crew rows use the same lookup, by the Dispatch each row shows, so a worker has one name everywhere. A peer Run's queue carries a sender's Dispatch home only when that Dispatch belongs to the peer Run, so mail from another Run's worker never makes the coordinating Orca record a Dispatch it does not own. Not changed: the renderer's live-chat label lookup (it only applies live names, which still win).
Before / after (isolated dev Orca, coordinator chat)
Before (main): the local worker's exit report is "an agent"; the paired server's worker shows only its task.
After: every worker card names its task next to its agent's icon, the paired server's worker carries its server badge, and the person's terminal is unchanged.
Validation
orca serve. A coordinator chat started one local and one paired-server Claude worker; each sent a status, rested, then had its terminal closed so Orca filed its exit report; a plain terminal then mailed the coordinator.peer-run-queue.test.ts, mail from another Run's worker into a peer Run's mailbox goes home without its Dispatch (reverting carries it).runtime-orchestration-sender-names.test.ts: a crew row names a worker as its card does (reverting gives "Codex", or a newer Dispatch's task on the same terminal); worker mail read after its tab is gone (reverting the write givesname: null); relayed mail from an older server (reverting givesname: null). Existing paired-server tests were updated to the new wording.SEARCH message_dispatch_provenance USING INDEX (message_id=?)), the same count as the import-only read it replaces. Nothing else is read when the record has a snapshot. Writes add a few primary-key reads per worker message (not per heartbeat), off the render path.Risk
Medium-low. Card wording changes for workers that are no longer live. Rows without a record fall back to the existing lookup, and live names are untouched.