Skip to content

fix(orchestration): name a worker's mail by its Dispatch, recorded when it is written - #44472

Merged
Jinwoo-H merged 5 commits into
mainfrom
fix/orchestration-worker-identity-at-write
Nov 20, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
fix/orchestration-worker-identity-at-write

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

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.

before

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.

after

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.

Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​158 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​154
Prod 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​268 $\color{#cf222e}{\Huge{\mathbf{−}}}$​121 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147

…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.
@Jinwoo-H Jinwoo-H closed this Nov 19, 2026
@Jinwoo-H Jinwoo-H reopened this Nov 19, 2026
…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.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive 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 Passed checks: 3 passed

Check name Status Explanation
Title check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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

  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 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8751b91d-5564-4e07-a668-335762092215
Commits

Reviewing files that changed from the base of the PR and between a224efb and 4402ef4.

Files selected for processing: 3

  • src/main/runtime/orchestration/db/remote-owned/remote-owned-records.test.ts
  • src/main/runtime/orchestration/mailbox/senders/runtime-orchestration-sender-names.test.ts
  • src/main/runtime/orchestration/workers/identity/worker-identity.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a0742d74-6701-4e19-8099-a2c971d9ebde
Commits

Reviewing files that changed from the base of the PR and between 8bc232f and e784eed.

Files selected for processing: 23

  • src/main/runtime/construction/runtime-service-state.ts
  • src/main/runtime/orchestration/crew/crew-party-snapshot.ts
  • src/main/runtime/orchestration/crew/crew-read-dependencies.ts
  • src/main/runtime/orchestration/crew/crew-read-model.test-fixture.ts
  • src/main/runtime/orchestration/db/messages/message-insert.ts
  • src/main/runtime/orchestration/db/messages/message-sender-dispatch.ts
  • src/main/runtime/orchestration/db/orchestration-db.ts
  • src/main/runtime/orchestration/db/peer-runs/peer-run-queue-sql.ts
  • src/main/runtime/orchestration/db/peer-runs/peer-run-queue.test.ts
  • src/main/runtime/orchestration/db/remote-owned/remote-owned-import.ts
  • src/main/runtime/orchestration/db/remote-owned/remote-owned-records.test.ts
  • src/main/runtime/orchestration/federation/remote-owned/remote-owned-start.ts
  • src/main/runtime/orchestration/legacy-remote-home/federation-relay-import.ts
  • src/main/runtime/orchestration/mailbox/senders/agent-message-sender.ts
  • src/main/runtime/orchestration/mailbox/senders/orchestration-sender-name.ts
  • src/main/runtime/orchestration/mailbox/senders/runtime-orchestration-sender-names.test.ts
  • src/main/runtime/orchestration/mailbox/senders/runtime-orchestration-sender-names.ts
  • src/main/runtime/orchestration/mailbox/senders/sender-reported-dispatch.ts
  • src/main/runtime/orchestration/mailbox/structured-mail/structured-mail-source.ts
  • src/main/runtime/orchestration/workers/identity/worker-identity.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/reply-method.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send-group.ts
  • src/main/runtime/rpc/methods/orchestration/worker/session-workers-method.ts
Files with no reviewable changes: 1

  • src/main/runtime/orchestration/mailbox/senders/sender-reported-dispatch.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@Jinwoo-H
Jinwoo-H merged commit b9b1b51 into main Nov 20, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant