Skip to content

feat(terminal): persistent banner to restart a terminal daemon whose files are gone - #28021

Merged
OrcaWin merged 1 commit into
mainfrom
feat/severed-daemon-banner
Oct 12, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
feat/severed-daemon-banner

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​306 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​301

ELI5

#28011 taught Orca to recognise a Linux AppImage terminal daemon that keeps running after its program files have disappeared. Orca keeps that daemon so your running terminals stay alive, and opens new terminals elsewhere. Until now the only place this showed up was a CLI command. This PR adds a banner to the desktop sidebar. It explains what is happening and offers Restart terminal daemon. The banner stays until you restart the daemon or dismiss it.

What Changed

  • Before: desktop users had no way to see that their terminal daemon was running without its program files. They also could not see that new terminals would not survive a quit. The fix existed only as orca terminal-daemon restart.
  • After (Linux only): a banner at the top of the sidebar, shown in every sidebar view.
    • Title: "Terminal service is running without its program files"
    • Body: it is still running N running terminals, it can crash at any moment, and until it is restarted, new terminals are not kept when Orca quits.
    • Restart terminal daemon opens a confirmation. The confirmation says that restarting ends every running process, that agents which support resume can be resumed, and that shells and other jobs cannot. It suggests restarting when your agents are idle.
    • The restart sends the exact daemon incarnation the banner showed (pid, start ticks, boot id). The host re-checks it before stopping anything, using the same verified path as the CLI. If the daemon was already replaced, or cannot be verified, nothing is stopped and a short notice says so.
    • Dismiss hides the banner for that daemon incarnation only. A different severed daemon shows the banner again.
    • The banner polls when it mounts, on window focus, and every 60 seconds. It reads pty:management:severedDaemon, a new IPC that wraps the state from fix(daemon): stop giving new terminals to a daemon whose AppImage files are gone #28011.
  • Web and paired clients get a stub that reports nothing, because they cannot read the host's /proc. Headless and paired users have orca terminal-daemon status|restart.
  • macOS, Windows, and Linux without a severed daemon: nothing renders. The component returns early off Linux and never calls the IPC.

Why

  • The quarantine from fix(daemon): stop giving new terminals to a daemon whose AppImage files are gone #28011 means new terminals lose persistence until the user acts. A daemon that hosts long-running agents may never become idle, so a toast shown once is too easy to miss. The accepted UX is a persistent banner and no automatic migration.
  • The restart is irreversible for shells, so it sits behind a confirmation whose wording says exactly what ends.

Linked Issue

Part of #18200.

Visual Proof

No screenshot: this work had to run without launching Electron, so the banner was not rendered in a real window. The component test renders it in happy-dom and checks the copy, the confirmation, the incarnation that is sent, and the dismissal. It uses the existing sidebar alert styling of LocalGitToolchainScanBanner: the destructive border, TriangleAlert, and Button primitives.

Testing

  • SeveredTerminalDaemonBanner.test.tsx:
    • hidden off Linux, and when nothing is severed;
    • body copy;
    • the confirmation says a restart ends processes, and only resumable agents come back;
    • restart sends the exact incarnation;
    • dismissal is per incarnation.
  • pnpm tc, pnpm lint (including the localization catalogs), and pnpm run check:code-quality:changed.
  • Not covered by CI: a real severed daemon on a desktop. No CI lane can detach a FUSE mount under a live daemon.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots: not possible in this environment; component test instead
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered
  • pnpm lint, pnpm typecheck pass locally; CI covers the rest

@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 12, 2026 15:52
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

Adds typed APIs to report and restart a severed terminal daemon, with IPC validation of the requested daemon identity. Adds a Linux sidebar banner that displays daemon status, supports dismissal for a specific incarnation, and requires confirmation before restart. Adds web API stubs, English strings, and component tests.


Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to a6f59

The new banner can restart a different terminal daemon than the one the user confirmed, ending running shells and jobs without a matching warning. Status refreshes can also briefly hide the banner. Bind the confirmation to the daemon identity shown when the dialog opened before merging.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 8 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: a persistent banner that enables restarting a terminal daemon whose files are gone.
Description check Passed The description is mostly complete. It includes the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, and Checklist sections, and it explains the user impact, implementation, safety checks…
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: Docstring Coverage

Explanation

Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 8 files. (2 skipped: 2 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9093f4fb-7ee2-4659-a67b-b794aaad7a52
📥 Commits

Reviewing files that changed from the base of the PR and between fde0fe3 and a6f5989.

📒 Files selected for processing (10)
  • src/main/ipc/pty-management.ts
  • src/preload/api-types.ts
  • src/preload/api/pty-bridge-stream-and-serialization.ts
  • src/preload/api/pty-management-api.ts
  • src/renderer/src/components/sidebar/SeveredTerminalDaemonBanner.test.tsx
  • src/renderer/src/components/sidebar/SeveredTerminalDaemonBanner.tsx
  • src/renderer/src/components/sidebar/index.tsx
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/web/preload-api/web-terminal-api.ts

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

return
}
try {
setDaemon((await read()).severed)

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Ignore status results from older refreshes.

A focus refresh can finish after a later poll or post-restart refresh. Line 75 then replaces the newer status with an older daemon or null. A stale null can hide the warning until the next poll. Track a request sequence and apply only the latest result. Based on learnings, concurrent async refreshes must not apply out-of-order results.

Source: Learnings

Comment on lines +101 to +105
const result = await window.api.pty.management.restartSeveredDaemon({
pid: daemon.pid,
linuxStartTicks: daemon.linuxStartTicks,
bootId: daemon.bootId
})

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require a new confirmation if the daemon incarnation changes.

If a status refresh replaces daemon while the dialog is open, restart sends the new incarnation. The user confirmed the warning for the previous daemon, but the new request can end processes in another incarnation. Capture the confirmed identity when the dialog opens, and close the dialog or require confirmation again when that identity changes.

"resumed_other": "{{count}} agent sessions resumed."
},
"severedDaemonBanner": {
"unknownCount": "its running terminals",

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Correct the unknown-count wording.

When liveSessionCount is null, the banner says, “It still runs its running terminals.” The confirmation also uses that phrase. Change unknownCount to “its terminals” so both sentences read clearly.

@OrcaWin
OrcaWin merged commit 25f8754 into main Oct 12, 2026
30 checks passed
@smwbev

smwbev commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Small thing in the new banner: with exactly one live terminal it reads "It still runs 1 running terminals", and the confirm dialog says "Restarting ends every process running in 1 running terminals".

sessionsLabel (SeveredTerminalDaemonBanner.tsx:45) passes count to terminal.severedDaemonBanner.count, and en.json has only the one text, {{count}} running terminals. A second key for the singular, picked with count === 1 the way the rest of the app does it, would fix it. These strings are not in a release yet: v1.4.224 predates this PR.

Happy to send that as a PR if it helps.

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.

2 participants