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(terminal): adopted daemon terminals take title and output from their stream - #38760
After orca serve restarts, terminals that kept running come back. Some of them came back named "shell" instead of their real title, and a terminal picked up again by a retried create never showed new output, so it looked idle and its agent status was unknown.
Files
Added
Deleted
Net
Test
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$58
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$58
Prod
3
$\color{#1a7f37}{\Huge{\mathbf{+}}}$5
$\color{#cf222e}{\Huge{\mathbf{−}}}$2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$3
What Changed
Before: a surviving terminal could be titled "shell" (a name Orca made up) and, when a terminal.create retry adopted it after a restart, its stream was never attached, so lastOutputAt stayed empty and its real title never arrived. After: surviving terminals take their title and output from their own stream, the same way for every adoption path.
The daemon adapter's session listing no longer invents a "shell" title; the listing carries no title, so it reports none. The attach snapshot's last title and the live stream stay the single source.
A terminal.create retry that adopts a survivor now attaches its stream through the same main-process attachment that inventory adoption already uses (mainDaemonAttachments.reconcile), which de-duplicates with any attach already in flight.
A new runtime record treats an empty title as unknown, as updates already do, so it never reads as a manual title.
Inventory adoption already attaches survivors (#36137); this closes the create-retry path and drops the made-up title.
Why
The made-up title and the missing attach were the two remaining causes after #36137. Reusing the existing attachment path keeps one owner for "attach a surviving session", instead of a second attach path for create retries.
This takes over #22834 by @mmarabel, who also reported the issue and found the inventory-title cause. Thank you @mmarabel! The core of that PR landed through #36137; this PR covers what was left.
N/A: the fix is in how the host restores terminal records after a server restart; covered by runtime tests.
Testing
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
terminal-subscriber-driven-daemon-attach.test.ts: a survivor adopted by a terminal.create retry gets attached, streams output and shows its real title.
daemon-pty-adapter-session-adoption.test.ts: the listing reports no made-up title.
Both fail on main and pass here. pnpm tc, lint and the changed-code quality gate pass.
Risk
Level: Low
No wire change: old and new daemons send the same listing. Consumers of the listing title already fall back (cwd/worktree label) when it is empty; nothing matched on "shell". SSH-relay sessions are not touched (reconcile skips them). Back out with a plain revert.
Review
Independent Opus review: no P0-P2. Codex review: no findings.
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
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)
No actionable comments were generated in the recent review.
Walkthrough
The change assigns empty titles to listed PTYs and converts empty PTY record titles to null. It reconciles main-daemon attachments after remote terminal-create adoption. A new restart-adoption test verifies that the runtime adopts and attaches a surviving session without spawning a replacement, then lists its handle, title, live-output preview, and last-output time.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 5d770
The change appears ready to merge after normal checks. The existing test-coverage concern about an idle survivor’s preview remains a useful follow-up.
Pre-merge checks: 4 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Linked Issues check
[#22809] The PR removes the invented inventory title, treats an empty title as unknown, and reconciles attachments for create-retry adoption. The tests cover the empty listing title and title and live…
Provide reviewable production code or automated test evidence that idle surviving terminals restore their pre-restart preview, title, agent identity, and status without new output.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly describes the main change to adopted daemon terminals.
Description check
The description is mostly complete and explains the change, issue, tests, and risk. It does not identify tested platforms, and the visual proof section does not show the user-visible behavior change.
Out of Scope Changes check
[#22809] The inventory title change, empty-title handling, attachment reconciliation, and supporting tests address restoration of surviving terminals. The available change summary shows no unrelated c…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Out of Scope Changes check
Explanation
[#22809] The inventory title change, empty-title handling, attachment reconciliation, and supporting tests address restoration of surviving terminals. The available change summary shows no unrelated changes.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 5 files.
Full details: Linked Issues check
Explanation
[#22809] The PR removes the invented inventory title, treats an empty title as unknown, and reconciles attachments for create-retry adoption. The tests cover the empty listing title and title and live output after retry adoption. The available evidence does not establish that inventory or retry adoption restores the pre-restart preview and title-based agent identity and status without new output. The runtime test model seeds the title itself, so it does not establish the production snapshot behavior.
Resolution
Provide reviewable production code or automated test evidence that idle surviving terminals restore their pre-restart preview, title, agent identity, and status without new output.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
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; 1 remain after this review.
The test can pass when an idle survivor’s prior preview is lost. Use a nonempty attach snapshot and assert the listing’s preview before emitting data. Exercise the production attach-result seeding path rather than seeding only in the mock.
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: 3d9f560c-bbed-4157-bef4-7786910d45e5
Commits
Reviewing files that changed from the base of the PR and between 6ff6b39 and fc6e960.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…eir stream
The daemon adapter's inventory listing reported every surviving session's
title as "shell", though the listing carries no title. That made-up value
became the fallback tab title when adoption ran before the attach seed, and a
terminal.create retry that adopted a survivor after a restart recorded it as
the terminal's observed title and returned it.
That create-retry adoption also never attached the session's stream, so the
adopted terminal's output never reached main: lastOutputAt stayed null and its
real title never landed until some later inventory refresh attached it.
- The daemon listing reports no title. The attach snapshot's lastTitle and the
stream stay the single source, as for every other terminal.
- A create retry that adopts a survivor attaches it through the same main
attachment inventory adoption uses.
- A new runtime record treats an empty title as unknown, as an update already
does, so it never reads as a manual title.
Inventory adoption already attaches survivors (#36137); this closes the create
retry path and drops the made-up title. No wire change: old and new daemons
send the same listing.
Fixes#22809
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
After
orca serverestarts, terminals that kept running come back. Some of them came back named "shell" instead of their real title, and a terminal picked up again by a retried create never showed new output, so it looked idle and its agent status was unknown.What Changed
Before: a surviving terminal could be titled "shell" (a name Orca made up) and, when a
terminal.createretry adopted it after a restart, its stream was never attached, solastOutputAtstayed empty and its real title never arrived. After: surviving terminals take their title and output from their own stream, the same way for every adoption path."shell"title; the listing carries no title, so it reports none. The attach snapshot's last title and the live stream stay the single source.terminal.createretry that adopts a survivor now attaches its stream through the same main-process attachment that inventory adoption already uses (mainDaemonAttachments.reconcile), which de-duplicates with any attach already in flight.Inventory adoption already attaches survivors (#36137); this closes the create-retry path and drops the made-up title.
Why
The made-up title and the missing attach were the two remaining causes after #36137. Reusing the existing attachment path keeps one owner for "attach a surviving session", instead of a second attach path for create retries.
This takes over #22834 by @mmarabel, who also reported the issue and found the inventory-title cause. Thank you @mmarabel! The core of that PR landed through #36137; this PR covers what was left.
Supersedes #22834
Linked Issue
Fixes #22809
Visual Proof
N/A: the fix is in how the host restores terminal records after a server restart; covered by runtime tests.
Testing
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
terminal-subscriber-driven-daemon-attach.test.ts: a survivor adopted by aterminal.createretry gets attached, streams output and shows its real title.daemon-pty-adapter-session-adoption.test.ts: the listing reports no made-up title.Both fail on main and pass here.
pnpm tc, lint and the changed-code quality gate pass.Risk
Level: Low
No wire change: old and new daemons send the same listing. Consumers of the listing title already fall back (cwd/worktree label) when it is empty; nothing matched on
"shell". SSH-relay sessions are not touched (reconcile skips them). Back out with a plain revert.Review
Independent Opus review: no P0-P2. Codex review: no findings.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)