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
feat(orchestration): report current coordinator in run-show - #49160
When one chat took over a run, another participant asking orca orchestration run-show saw coordinator_handle: null and could not tell who owned the run now. The response now names the current coordinator (a chat session address or a terminal handle), the run id, the generation and the runtime, so a second participant can check ownership before acting on a decision.
Files
Added
Deleted
Net
What Changed
Before:exposeRun() deliberately removed the coordinator's Orca session id from every run receipt, and a chat-owned run has no terminal handle, so run-show returned coordinator_handle: null with no replacement. Runtime id was only available in the RPC envelope (_meta), not in the result.
After:orchestration.runShow adds a top-level coordinator object with four values: run_id, actor, consumer_generation and runtime_id.
actor is the run's current coordinator: orca_session_id:<id> for a chat, or the terminal handle. It uses the existing generation fence, so a session id left behind by an older handover is not reported as current; in that case actor is null (explicit unknown).
runtime_id comes from the runtime that answered.
The CLI prints the actor in both default JSON and --full views, and adds an actor line to --full text.
The internal session id remains hidden; only its established mailbox address is exposed.
Why
The host already has the authoritative binding in the run row. Deriving the actor there avoids a second RPC, a chat wake, or trusting a caller-supplied identity, and keeps the existing read-only access check (access.kind: 'reads', permission: 'workspace') untouched. Reporting the generation alongside the actor makes it unambiguous which handover the answer belongs to.
Tests use a real in-memory OrchestrationDb and the same row the RPC reads; the stale-generation case bumps the row directly, so it fails if the generation fence is removed.
Platform: macOS, unit level. No platform-specific code.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None. The handler derives one address from fields already loaded with the run; no new query, message or wake. Runtime id was already available on the runtime object.
Risk
Level: Low
Worst case is a stale actor address for one generation after a handover: the generation fence and the existing handover bump keep that from happening, and null is returned when the host cannot tell. The change adds a field to a read response; older clients ignore unknown JSON fields. A plain revert removes the field and restores the previous output.
AI Disclosure
Implemented with the help of an AI coding agent (OpenCode, Hy4 flash model).
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
No SSH/remote, mobile, cross-platform or permission changes; the RPC stays read-only and uses the same workspace permission as before.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
orchestration.runShow now returns a coordinator receipt with the run ID, actor, consumer generation, and runtime ID. The actor is derived from the coordinator key and is null when the chat session belongs to an older consumer generation. The CLI displays coordinator metadata in compact and full output.
Severity of issue fixed: Low
Merge Risk: Low · up to 7dea2
The run-show --full text view can crash when the CLI talks to an older Orca host that does not return coordinator details. Other output modes keep working. A small guard in the formatter fixes it, and the rest of the change looks safe.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(orchestration): report current coordinator in run-show" matches the main change. The PR adds a top-level coordinator object to the orchestration run-show response, with the current act…
Description check
The description follows the repository template. It has ELI5, What Changed (before and after, plus mechanism), Why, a linked issue (Fixes #48312), Visual Proof marked N/A with a reason, Testing with t…
Linked Issues check
Issue #48312 asks that callers allowed to inspect a run receive run ID, current coordinator actor (including chat coordinators), consumer generation, and runtime ID in the normal run-show response, wi…
Out of Scope Changes check
All changes support the coordinator-reporting objective of #48312. The changes are: a new RunCoordinatorReceipt type and exposeRunCoordinator function; a coordinator field added to the runShow respons…
Full details: Title check
Explanation
The title "feat(orchestration): report current coordinator in run-show" matches the main change. The PR adds a top-level coordinator object to the orchestration run-show response, with the current actor, generation, and runtime ID. The title is short, specific, and follows a conventional-commit style.
Full details: Description check
Explanation
The description follows the repository template. It has ELI5, What Changed (before and after, plus mechanism), Why, a linked issue (Fixes #48312), Visual Proof marked N/A with a reason, Testing with the commands run, a Performance statement, a Risk section with level and revert plan, AI Disclosure, the upstream boundary checkbox, Notes, and a checklist. Minor gaps: the Risk level is set, but the Review section is empty and the lint/typecheck/test/build checklist item is unchecked, which the template allows when CI covers it. The Testing section also leaves the manual-test box unchecked without explanation.
Full details: Linked Issues check
Explanation
Issue #48312 asks that callers allowed to inspect a run receive run ID, current coordinator actor (including chat coordinators), consumer generation, and runtime ID in the normal run-show response, with an explicit unknown when the host cannot establish the actor. At head, orchestration.runShow in src/main/runtime/rpc/methods/orchestration/runs/runs.ts always returns a coordinator field built by exposeRunCoordinator(run, runtime.getRuntimeId()). run-coordinator-receipt.ts returns run_id, actor, consumer_generation, and runtime_id. The actor comes from mailboxAddressOf(runCoordinatorKey(run)). runCoordinatorKey (src/main/runtime/orchestration/addressing/orchestration-caller-identity.ts) takes the Orca session id from currentRunCoordinatorOrcaSessionId(run), which the code comments describe as excluding session ids left by older bindings. A chat coordinator therefore yields orca_session_id:<id>, a terminal coordinator yields its handle, and a stale binding yields null. The handler adds no query, message, or wake, and the diff leaves the existing access check untouched. Limitation: I did not open currentRunCoordinatorOrcaSessionId in src/main/runtime/orchestration/db/runs/run-coordinator-orca-session.ts, so the generation-fence behavior rests on its name and the documented comment. The reported tests for the stale-generation case were not re-run.
Full details: Out of Scope Changes check
Explanation
All changes support the coordinator-reporting objective of #48312. The changes are: a new RunCoordinatorReceipt type and exposeRunCoordinator function; a coordinator field added to the runShow response in runs.ts, with removedWork still conditional; CLI output of the actor in run-show views (run-handlers.ts); and unit tests for chat, terminal, and stale-generation actors (run-coordinator-receipt.test.ts). The runs.ts diff contains no unrelated edits. The PR description reports no changes to permissions, remote behavior, or UI. The CLI hunks were taken from the summary and were not diffed directly.
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; 6 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Guard coordinator in run-show --full for runtimes that omit it.
The --full text formatter reads r.coordinator.runtime_id, r.coordinator.actor, r.coordinator.run_id, and r.coordinator.consumer_generation with no check. A runtime that predates this change returns no coordinator. The CLI can still reach such a runtime, because the compatibility gate accepts protocol version 2 or later. The formatter then throws a TypeError before it prints the run. Default text output and --json output do not read these fields.
Declare coordinator as optional, and print unknown when it is absent:
Suggested fix
run: {
id: string
objective: string
consumer_generation: number
legacy: number
created_at: string
}
- coordinator: {+ coordinator?: {
run_id: string
actor: string | null
consumer_generation: number
runtime_id: string
}
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.
ELI5
When one chat took over a run, another participant asking
orca orchestration run-showsawcoordinator_handle: nulland could not tell who owned the run now. The response now names the current coordinator (a chat session address or a terminal handle), the run id, the generation and the runtime, so a second participant can check ownership before acting on a decision.What Changed
Before:
exposeRun()deliberately removed the coordinator's Orca session id from every run receipt, and a chat-owned run has no terminal handle, sorun-showreturnedcoordinator_handle: nullwith no replacement. Runtime id was only available in the RPC envelope (_meta), not in the result.After:
orchestration.runShowadds a top-levelcoordinatorobject with four values:run_id,actor,consumer_generationandruntime_id.actoris the run's current coordinator:orca_session_id:<id>for a chat, or the terminal handle. It uses the existing generation fence, so a session id left behind by an older handover is not reported as current; in that caseactorisnull(explicit unknown).runtime_idcomes from the runtime that answered.--fullviews, and adds an actor line to--fulltext.Why
The host already has the authoritative binding in the run row. Deriving the actor there avoids a second RPC, a chat wake, or trusting a caller-supplied identity, and keeps the existing read-only access check (
access.kind: 'reads',permission: 'workspace') untouched. Reporting the generation alongside the actor makes it unambiguous which handover the answer belongs to.Linked Issue
Fixes #48312
Visual Proof
N/A: this changes a CLI/RPC response, not rendered UI. The output shape is covered by the receipt tests below.
Testing
pnpm test src/main/runtime/rpc/methods/orchestration/runs/run-coordinator-receipt.test.ts --maxWorkers=2: 3/3 pass.orca_session_id:address with the run id, generation and runtime id.pnpm check:changed --base=HEAD: 28/28 checks pass.Tests use a real in-memory
OrchestrationDband the same row the RPC reads; the stale-generation case bumps the row directly, so it fails if the generation fence is removed.Platform: macOS, unit level. No platform-specific code.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None. The handler derives one address from fields already loaded with the run; no new query, message or wake. Runtime id was already available on the runtime object.
Risk
Level: Low
Worst case is a stale actor address for one generation after a handover: the generation fence and the existing handover bump keep that from happening, and
nullis returned when the host cannot tell. The change adds a field to a read response; older clients ignore unknown JSON fields. A plain revert removes the field and restores the previous output.AI Disclosure
Implemented with the help of an AI coding agent (OpenCode, Hy4 flash model).
Review
Agent skill upstream boundary
Notes
No SSH/remote, mobile, cross-platform or permission changes; the RPC stays read-only and uses the same workspace permission as before.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Reported by @taka0024brainbit