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(terminal): a terminal a worker creates closes with that worker - #47371
Terminals a worker's agent opens with orca terminal create (a test runner, a dev server) had no owner, so they stayed open after the worker closed.
Change
The host learns the caller from evidence the CLI already sends.terminal.create carried no caller, so the CLI now sends the same caller evidence it sends on orchestration.* calls (local requests only). The host binds the new terminal to a worker only when that evidence names a live worker's own terminal (its resource is owned, not released, and the handle still names the resource's pane) or a worker chat's session. Windows and phones send no caller, and other agents name no worker, so their terminals never get an owner.
--keep-open on terminal create creates an unbound terminal. TerminalCreateParams.keepOpen is optional; older hosts drop it and close nothing, and older CLIs send no evidence, so nothing changes for them.
orca terminal split from a worker binds the new pane the same way, with --keep-open. Its schema moves to terminal-split-params.ts (the params file hit its line limit).
A worker whose shell kept its pre-restart handle is still found by its pane (ORCA_PANE_KEY), so what it opens is bound.
A legacy paired host closes a stopped worker's bound terminals too, not only a released one's.
Workers get one line in their brief; the CLI help gets one line. The shared --keep-open flag help now reads for both commands.
Verification
worker-bound-terminals.test.ts (real orchestration DB): a terminal the worker's agent opened closes with it; one opened with --keep-open survives; terminals from a window or a non-worker agent's terminal get no owner. A worker whose shell outlived a restart still owns what it opens. A terminal a chat worker opens (named by its session) closes with it. The split and legacy-stop wiring reuse the tested binder and close helper; they have no test of their own.
Typecheck (node, web, cli) and oxlint on touched files pass locally.
Gaps
Not exercised in the app: it needs a live worker, which needs a real agent turn this rig does not run.
A terminal created in a workspace where no worker runs closes with its worker but shows no banner.
Performance
None, because binding is one indexed lookup and one row write per terminal create from an agent, and closing reuses the release path from #47370.
Risk
Level: Medium. A wrong owner would close a terminal with a worker it does not belong to. The host binds only when the caller evidence names a live worker's own terminal whose pane still matches, never for windows or phones, and --keep-open opts out. A plain revert backs it out.
orca terminal create run by an orchestration worker's own agent now binds
the new terminal to that worker, so it closes when the worker does, like
the setup terminal and startup tabs.
- The CLI sends the caller evidence it already sends for orchestration
calls; the host binds only when that evidence names a live worker's
own terminal or chat. Windows, phones and other agents bind nothing.
- --keep-open creates an unbound terminal. Older hosts drop the field
and close nothing, as before.
- Workers are told in one line; the CLI help says it in one line.
…s and stops on paired hosts
- orca terminal split from a worker binds the new pane to it; --keep-open
opts out. The split schema moves to its own file.
- A worker whose shell kept its pre-restart handle is still found by its
pane, so what it opens is bound.
- A legacy paired host closes a stopped worker's bound terminals.
No actionable comments were generated in the recent review.
Walkthrough
Terminal create and split requests now support --keep-open. Local CLI requests include orchestration compatibility evidence. Eligible terminals created by a worker can be bound to that worker, and remote worker release and stop paths close bound terminals. CLI specifications, worker guidance, and tests document and cover these behaviors.
Merge Risk: Low · up to 7c641
Terminals that a worker creates now close with that worker, and --keep-open opts out. Cleanup failures no longer break a settled release or stop. Two minor items remain. A --retry-split that omits --keep-open can bind a pane that the original split opted out of. The worker-stop CLI note still says setup terminals and configured tabs are never deleted, although stop now closes them. Neither is likely to affect users broadly, so this is mergeable with the follow-ups noted.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(terminal): a terminal a worker creates closes with that worker" matches the main change. The PR makes terminals created by a worker's agent (via orca terminal create and `orca termin…
Description check
The description follows the template's sections: ELI5 is absent, but the Problem/Change/Why content is present, along with Linked Issue, Testing, Performance, and Risk. The Problem and Change sections…
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 "feat(terminal): a terminal a worker creates closes with that worker" matches the main change. The PR makes terminals created by a worker's agent (via orca terminal create and orca terminal split) bind to that worker and close when it closes, with --keep-open as an opt-out. The title is one specific sentence, under 72 characters, and uses conventional-commit style. It does not cover the legacy-host, restart-handle, or chat-worker details, which is acceptable.
Full details: Description check
Explanation
The description follows the template's sections: ELI5 is absent, but the Problem/Change/Why content is present, along with Linked Issue, Testing, Performance, and Risk. The Problem and Change sections are clear. However, the template's required ELI5 section is missing, the Linked Issue section has no issue reference (it says 'Stacked on #47370' but there is no 'Fixes #' line filled in), Visual Proof is absent for a behavior change, the Review, Agent skill upstream boundary, and Checklist sections are not addressed, and the AI Disclosure section is left blank. Most of the core content is present, so the check is mostly complete.
Resolution
Add an ELI5 section in plain language. Fill in the Linked Issue line with an actual issue, or confirm the maintainer exemption applies. Add a Visual Proof entry for the terminal behavior change, or write N/A with a reason. Complete the Testing checkboxes, the Agent skill upstream boundary checkbox, and the AI Disclosure section if applicable.
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; 2 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Correct the worker-stop safety note. · orchestration-worker-specs.ts:100
src/cli/specs/orchestration-worker-specs.ts:100 Minor · Functional Correctness · Quick win
Correct the worker-stop safety note.
The new remote stop path calls closeStoppedWorkerTerminals. That helper closes bound setup terminals and configured tabs, except failed setups. This note still promises that worker-stop never deletes those terminals.
Update the note to describe those effects and exceptions. Users must not select a destructive command based on an incorrect preservation guarantee.
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: c8346422-f227-46d2-8497-a6628a7f79d6
Commits
Reviewing files that changed from the base of the PR and between faf054c and d348b51.
Files ignored due to path filters: 1
src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 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.
Stacked on #47370.
Problem
Terminals a worker's agent opens with
orca terminal create(a test runner, a dev server) had no owner, so they stayed open after the worker closed.Change
terminal.createcarried no caller, so the CLI now sends the same caller evidence it sends onorchestration.*calls (local requests only). The host binds the new terminal to a worker only when that evidence names a live worker's own terminal (its resource is owned, not released, and the handle still names the resource's pane) or a worker chat's session. Windows and phones send no caller, and other agents name no worker, so their terminals never get an owner.--keep-openonterminal createcreates an unbound terminal.TerminalCreateParams.keepOpenis optional; older hosts drop it and close nothing, and older CLIs send no evidence, so nothing changes for them.orca terminal splitfrom a worker binds the new pane the same way, with--keep-open. Its schema moves toterminal-split-params.ts(the params file hit its line limit).ORCA_PANE_KEY), so what it opens is bound.--keep-openflag help now reads for both commands.Verification
worker-bound-terminals.test.ts(real orchestration DB): a terminal the worker's agent opened closes with it; one opened with--keep-opensurvives; terminals from a window or a non-worker agent's terminal get no owner. A worker whose shell outlived a restart still owns what it opens. A terminal a chat worker opens (named by its session) closes with it. The split and legacy-stop wiring reuse the tested binder and close helper; they have no test of their own.Gaps
Performance
None, because binding is one indexed lookup and one row write per
terminal createfrom an agent, and closing reuses the release path from #47370.Risk
Level: Medium. A wrong owner would close a terminal with a worker it does not belong to. The host binds only when the caller evidence names a live worker's own terminal whose pane still matches, never for windows or phones, and
--keep-openopts out. A plain revert backs it out.