Repository navigation
fix(linux): launch the AppImage terminal daemon through its own mount - #23457
sergeytiron wants to merge 5 commits into
Conversation
In an AppImage the daemon ran from the window's FUSE mount, which the runtime unmounts when the window exits or the session ends; the surviving daemon then SIGBUSed on its next cold page and took every terminal with it. Launch it through $APPIMAGE instead so it gets its own runtime and mount, scoped with the daemon, falling back to the in-mount launch on failure. Part of stablyai#18200 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk | ⚪ Minimal · up to
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Linked Issues check | Issue [#22542] is an active directly linked issue. It requires a coding fix for the detached chrome_crashpad_handler so it does not execute from an AppImage mount after unmount. The reviewed changes… |
Implement and test the [#22542] crashpad-handler fix in this pull request, or remove the direct link to [#22542] if that issue is not a target. |
|
| Out of Scope Changes check | The changed daemon-launch implementation and related tests address durable terminal-daemon execution. The directly linked issue [#22542] concerns the unrelated chrome_crashpad_handler AppImage unmou… |
Limit this pull request to the [#22542] crashpad-handler fix, or link the daemon-launch work to an active issue that defines its requirements and remove [#22542] as the direct target. |
|
| Docstring Coverage | Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 8 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (2 passed)
-
Check name Status Explanation Title check ✅ Passed The title clearly and concisely identifies the main change: launching the Linux AppImage terminal daemon through its own mount. Description check ✅ Passed The description is complete and relevant. It covers the user impact, mechanism, rationale, fallback behavior, scope, testing, review considerations, linked issue, and checklist status. It also explain…
Full details: Linked Issues check
-
Explanation
Issue [
#22542] is an active directly linked issue. It requires a coding fix for the detachedchrome_crashpad_handlerso it does not execute from an AppImage mount after unmount. The reviewed changes implement terminal-daemon launch resolution, durable daemon identity, fallback behavior, and tests. They do not terminate or relocatechrome_crashpad_handler. A separate pull request reference does not establish that this fix is present.
Full details: Out of Scope Changes check
-
Explanation
The changed daemon-launch implementation and related tests address durable terminal-daemon execution. The directly linked issue [
#22542] concerns the unrelatedchrome_crashpad_handlerAppImage unmount race. The summary also states that helper-process changes are outside this change's scope. Therefore, the reviewed daemon changes are not within the coding scope established by the linked issue.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 6a1f3480-58a7-4ef5-be0b-97d441dd2c63
📒 Files selected for processing (7)
src/main/daemon/daemon-appimage-launch.test.tssrc/main/daemon/daemon-appimage-launch.tssrc/main/daemon/daemon-launched-child-identity.test.tssrc/main/daemon/daemon-launched-child-spawn.test.tssrc/main/daemon/daemon-launched-child-spawn.tssrc/main/daemon/daemon-launched-child.tssrc/main/daemon/daemon-out-of-process-launcher.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
ℹ️ No critical issues — prior feedback addressed; one design gap worth a look.
Reviewed changes
- Own-mount AppImage daemon launch — new
daemon-appimage-launch.tsresolves a validated FUSE-mounted AppImage launch and builds$APPIMAGE -e <bootstrap> -- <daemon args> --no-sandbox, scrubbing the parent mount from the child env. - Bootstrap + version guard — the inline
-escript resolvesdaemon-entry.jsagainst the child's exportedAPPDIRand exits when the file at$APPIMAGEis a different release. - Spawn wiring — the new
appImageoption routes the direct path throughspawnProcessand wraps the AppImage command in the durable scope when available. - Fallback + nonce isolation —
launchDaemonChilduses a fresh scope nonce per AppImage attempt and falls back to the in-mount launch on any retryable failure. - Cleanup-failure guard —
DaemonStartupCleanupError(extendsAggregateError) is now non-retryable in both the AppImage fallback and the scoped→unscoped retry, resolving the earlier CodeRabbit thread. - Pid-record unlink now uses
launched.identity.launchNonce, matching the nonce the daemon actually published.
ℹ️ The AppImage daemon records the window's ephemeral mount as its identity
The daemon still takes --entry-path (and --spawner-exec-path) from the launching window, whose AppImage mount path is a fresh mkdtemp mount on every launch. Now that the fix lets a daemon survive a window close, the next window's getDaemonLaunchIdentity compares a new mount against the recorded old one and always reports mismatch, so clean adoption depends entirely on the live-session probe and a daemon with no live sessions is replaced (billed to different_app_path). The live-session guard prevents session loss, so this is not a blocker — flagging it because the recorded identity never matches for AppImage.
Technical details
# AppImage daemon identity is ephemeral
`AppImage` type-2 mounts are `mkdtemp`-unique per run (`/tmp/.mount_<name>XXXXXX`), so an
`entryPath` captured from `getDaemonEntryPath()` cannot identify a release across launches.
## Affected sites
- `src/main/daemon/daemon-out-of-process-launcher.ts:120-139` — passes the window's `entryPath` into the AppImage resolution and into `launchDaemonChild`.
- `src/main/daemon/daemon-launched-child-spawn.ts:22-42` — `--entry-path` is `options.entryPath` (parent mount); `--spawner-exec-path` is the parent's `process.execPath` (also the parent mount).
- `src/main/daemon/daemon-pid-identity.ts:119-121` — `parsedPid.entryPath === expectedEntryPath ? 'match' : 'mismatch'`.
- `src/main/daemon/daemon-replacement-preflight.ts:93-128` — `mismatch` routes to replace unless `shouldPreserveDaemonWithLiveSessions` finds sessions.
- `daemon-tcc-attribution.ts`/`readDaemonOwnerMetadata` consume `spawnerExecPath` only on macOS/telemetry, so no Linux runtime fallout.
## Required outcome
- For a FUSE-mounted AppImage, the daemon should record an identity that is stable across launches (for example `$APPIMAGE`, or version-only) so `getDaemonLaunchIdentity` can return `match` for the surviving daemon instead of leaning on the live-session probe on every relaunch.
## Open questions for the human
- Is deferring to `shouldPreserveDaemonWithLiveSessions` on every AppImage relaunch intended, or should the AppImage path record the stable `$APPIMAGE` path?ℹ️ Nitpicks
- The JSDoc on
launchDaemonChildInEitherScopesays a scoped attempt "fails for any reason but a lost endpoint race [and] retries once, unscoped"; sincebeeaea4aDaemonStartupCleanupErroris also non-retryable. Consider updating the wording so the comment matchesisRetryableLaunchFailure.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Each AppImage launch mounts at a fresh random dir, so a daemon that now survives its window recorded an entry path the next window could never match, and an idle survivor was replaced as 'different app path'. Record and compare $APPIMAGE plus the in-image entry path instead; a new release at the same path is still caught by the app-version check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@pullfrog, thanks. Both items are addressed in a07406e. 1. Unstable identity: confirmed and fixed. You were right. The own-mount daemon now records a path built from the AppImage file (
Tests: spawn tests check which 2. JSDoc: fixed. The Checks: |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Delta since the prior pullfrog review (beeaea4): one commit, a07406e, giving an own-mount AppImage daemon a stable recorded identity.
- Stable AppImage daemon identity — new
appImageDaemonIdentityPath()returnsjoin($APPIMAGE, entryPathInAppDir). Both--entry-pathand the launcher's preflight now record this stable path instead of the window's ephemeralmkdtempmount, sogetDaemonLaunchIdentitycan returnmatchfor a surviving own-mount daemon rather than leaning on the live-session guard. The release is still swapped via the recorded--app-version. - Launcher wiring —
createOutOfProcessLauncherresolves the AppImage launch once up front and reuses the singlegetAppEnvironment()read; the relocated-host path is unchanged. - Tests — new
daemon-out-of-process-launcher-identity.test.tscovers the identity path for an AppImage and the unchanged entry path elsewhere; spawn tests cover the recorded identity for both the AppImage and in-mount paths. - Doc fix — the
launchDaemonChildInEitherScopeJSDoc now states that aDaemonStartupCleanupErroris not retried, matchingisRetryableLaunchFailure.
Verified locally: the four focused suites pass (21 tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Stable own-mount identity — new
appImageDaemonIdentityPathrecords$APPIMAGEjoined with the entry's in-image path as the daemon's--entry-path, so a surviving own-mount daemon is no longer keyed on a per-launch mount path. - Preflight alignment — the launcher resolves the AppImage launch before
prepareDaemonReplacementand passes that same identity path, sogetDaemonLaunchIdentitycan returnmatchinstead of alwaysmismatch. - Launch gating preserved — the launch-time
appImageoption is still suppressed when a relocated host exists, and the original in-mountentryPathstill backsforkEntryPath. - JSDoc —
launchDaemonChildInEitherScopenow names both non-retryable cases (lost endpoint race andDaemonStartupCleanupError) and points atisRetryableLaunchFailure. - Tests — added preflight identity coverage and
--entry-pathassertions for the AppImage and in-mount spawn paths.
Both items from the prior review are addressed. I traced the version path: a new release at the same $APPIMAGE still trips isDaemonStaleForCurrentBundle via the recorded --app-version, and the in-mount fallback deliberately keeps the mount identity so the next window replaces it when idle. The new tests would fail against the pre-fix code (the expected identity would be the mount path), and the changed daemon suites (21) plus daemon-init* (84) pass locally.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Thank you so much for this, @sergeytiron, and for the careful real-host testing. To save you another round, we brought it up to date with |

ELI5
Orca runs every terminal inside a background helper, the terminal daemon. That helper is designed to keep running after you close the window, so your shells and agents are still there when you reopen Orca.
On Linux, when Orca is installed as an AppImage, all of Orca's files (including the daemon's program code) live on a temporary virtual disk. That disk exists only as long as the Orca window that created it. Once the window closed, or you logged out, the disk went away while the daemon kept running. The next time the daemon needed a piece of its own code that wasn't already in memory, it crashed, and every terminal and agent in it died, sometimes hours later.
With this change the daemon is started from the
.AppImagefile itself, so it gets its own virtual disk that lasts exactly as long as the daemon does.What Changed
Before: in an AppImage, closing the Orca window (or logging out) left the terminal daemon running from a mount that no longer existed. It could keep going for minutes or hours, then die with
SIGBUSas soon as memory pressure or new work needed code that wasn't resident. That killed every terminal and agent session. Reopening Orca after that could not recover the sessions.After: the daemon survives window close, memory pressure and relaunch. The next window adopts it, the old terminals are restored with their scrollback, and new terminals work.
Mechanism. This only applies to a validated AppImage (
resolveAppImageRuntimeIdentity) whose files are on a FUSE mount (checked in/proc/self/mountinfo). The daemon is spawned as$APPIMAGE -e <bootstrap> -- <daemon args> --no-sandboxinstead of$APPDIR/orca-ide <entry> <args>. This works both inside the existingsystemd-run --user --scopeand on the plain-spawn path used when systemd isn't available.-ebootstrap findsdaemon-entry.jsrelative to theAPPDIRthe child runtime exports.$APPIMAGEis now a different release (for example, after a manual replace).--no-sandbox. AppRun inserts--no-sandboxin front of the script when unprivileged user namespaces are blocked (Ubuntu 24.04+), and Node rejects it as a bad option. Passing it last stops AppRun from adding it.PATH/LD_LIBRARY_PATH, andAPPIMAGE/APPDIR/ARGV0/OWDare dropped, reusingremoveAppImageRuntimeEnv. The daemon maps nothing from the window's mount.Unchanged: deb/rpm/tarball/dev builds, Windows, macOS, AppImages started with
APPIMAGE_EXTRACT_AND_RUN, and systems without FUSE.Not covered: helper processes that crash as the app quits, and
orca serve. The main process'schrome_crashpad_handlerstill runs from the window's mount and can outlive it. That is handled by a separate crashpad PR, #23459 (fixes #22542).Why
The other option considered was copying the runtime out of the mount to
~/.cache/orca/daemon-host/<profile>/<version>and running the daemon from there, reusing the Windows daemon-host relocation (#17865).Costs of the copy approach:
noexeccache, retry logic, and stripping the loader path.Launching through the AppImage file instead:
Remaining costs:
Linked Issue
Part of #18200 (the daemon part; helper processes crashing at quit and
orca serveare not covered here).Visual Proof
N/A: no UI change. The difference is whether terminals survive closing the window, which the VM matrix below checks.
Testing
I built test AppImages from this branch and ran them on two VMs, one at a time. This Fedora 44 host compiles
node-ptyagainst GLIBC_2.42, which fails the glibc-floor gate. So the test builds used thenode-ptybinaries from the official v1.4.214 release (same Electron and node-pty versions), repackaged withelectron-builder --prepackaged.Each run:
cp+mv -f, like the updater) while the daemon runs, then eviction + relaunchAPPIMAGE_EXTRACT_AND_RUN=1AppImage is 1.4.299, expected 1.4.214, then the retry from the current mount starts in its own scope unit; new terminal worksIn every run of this PR, the daemon's
/proc/<pid>/mapscontains nothing from the window's mount.Logout isn't scriptable on the test VMs. Tearing down GNOME Shell and the window's
app-orca-*.scopeleaves the daemon's ownorca-daemon-*.scope, which holds both the daemon and its mount server. Stopping the whole user manager stops both together.Local checks:
pnpm tc:node,tc:cli,tc:webdaemon-init*,daemon-entry*andappimage-terminal-envtestsoxlintcheck:code-quality:changedNew tests:
daemon-appimage-launch.test.ts: resolution rules, environment cleanup, and running the real bootstrap under Node, including the version-mismatch exit.The spawn test covers the scoped and direct AppImage paths.
The identity test covers the fallback and checks that the AppImage attempt's scope nonce differs from the retry's.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Implemented, VM-tested and written with Claude Code (Claude Opus 5.5), directed and reviewed by me.
Review
AI review: Codex (GPT-6 Sol, high), Claude Code
/code-review high, CodeRabbit, Pullfrog.$APPIMAGEis run, and the-escript contains only JSON-encoded values.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
$APPIMAGE, and the-escript contains only JSON-encoded paths and a version string./proc/self/mountinfoand the AppImage file per daemon launch.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred). I ran each typecheck project, the relevant tests and oxlint locally; the full suite and the release build are left to CI, because the local build fails the glibc gate on this host.🤖 Generated with Claude Code