Skip to content

fix(linux): give the CLI one entrypoint by extracting the AppImage once - #15081

Merged
nwparker merged 10 commits into
mainfrom
nwparker/linux-cli-single-entrypoint
Sep 1, 2026
Merged

nwparker merged 10 commits into
mainfrom
nwparker/linux-cli-single-entrypoint

Conversation

@nwparker

@nwparker nwparker commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3273 $\color{#cf222e}{\Huge{\mathbf{−}}}$​105 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3168
Prod 23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2130 $\color{#cf222e}{\Huge{\mathbf{−}}}$​219 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1911

ELI5

The registered Linux CLI used to reopen the outer AppImage for every command. That path can require FUSE and can inject Chromium flags that Electron's Node mode rejects, so the CLI was broken on stock modern Ubuntu and in containers. Orca now extracts the payload once and installs one stable launcher whose target can move safely across app restarts and upgrades.

What Changed

One stable entrypoint

  • AppImage payloads live under ${XDG_CACHE_HOME:-~/.cache}/orca/appimage/<namespace>/<generation>.
  • The registered command points to launcher/orca-ide, never to the outer AppImage or a transient mount.
  • The stable launcher resolves only the installed endpoint; legacy live links are ignored by the launcher and removed during migration.
  • A short bounded wait bridges endpoint replacement without exposing a half-published target.

Extraction and publication are transactional

  • The namespace is derived from the AppImage path; the generation is derived from filesystem identity (dev, ino, size, mtime, and ctime).
  • Registration is serialized with a cache-scoped cross-process lock.
  • Extraction happens in a private staging directory, validates the executable launcher, rechecks that the AppImage generation is still current, and publishes with atomic renames.
  • A raced or malformed destination is displaced and inspected before Orca restores a valid winner or replaces an incomplete tree.
  • A generation change during extraction gets one bounded retry; failures never publish an endpoint.

Ownership, install, and removal are fenced

  • installed ownership is namespace-scoped, so one AppImage path cannot unregister or prune another path's payload.
  • Command inspection captures inode identity and, for regular files, a hash. Install/remove quarantines the observed entry before publishing and restores or preserves it if the path changed.
  • Privileged symlink transactions apply the same capture/verify/publish/rollback shape.
  • Legacy wrapper registrations remain detectable and migrate on the next install.

Cleanup preserves live work

  • Pruning retains the selected generation, the installed endpoint target, in-process extractions, and recent cross-process extraction markers.
  • Unregister removes only payloads owned by that AppImage namespace and leaves the live endpoint intact.
  • Managed terminal startup refreshes live without performing extraction, so PTY creation does not block on AppImage I/O.

Why

The old registered wrapper re-entered AppRun. On Ubuntu 24.04, restricted user namespaces make AppRun prepend --no-sandbox; Electron Node mode rejects that option before Orca runs (#11609). The same wrapper also depended on mounting the outer AppImage, so it failed where /dev/fuse was unavailable (#12530).

Extracting once removes both dependencies while preserving normal CLI latency. The cache cost is bounded to active/installed generations and reclaimed on later registration or unregister.

Linked Issue

Fixes #11609
Fixes #12530
Fixes #16650

Visual Proof

N/A — Linux packaging and CLI entrypoint behavior only; no rendered UI changes.

Testing

Stack readiness evidence on the published rebased stack (main@212c0e42): 56 changed test files, 785 tests passed, and 4 platform-gated skips. Typecheck, reliability/max-lines/runtime-Electron ratchets, changed-code quality/React Doctor, formatting, oxlint, shellcheck, and git diff --check passed. The full-suite control run had 7 failures in 3 untouched files: the zsh non-ASCII wrapper rename collision, the SSH host-key mock's missing ssh2.utils, and a renderer context-menu failure seen only in the full run (the isolated test passed). The zsh and SSH failures reproduce on pristine origin/main; fresh CI is running on the published heads.

The tests cover concurrent registration, AppImage replacement during extraction, partial/malformed destinations, endpoint publication races, namespace isolation, privileged and unprivileged command-path races, stale registrations, restored-terminal refresh, pruning grace, legacy migration, and rollback/preservation failures.

The concurrent-registration test now fails if the sibling reads status before the first operation releases the cache-scoped lock.

The headless AppImage instructions now download the artifact before extraction and run extraction with sudo for the root-owned /opt/orca directory.

The elegance pass removed the unnecessary cli-installer re-export; the dispatcher imports the narrow bundled-launcher module directly.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

PR 1 of 7; reviewable on its own. The complete stack is ordered as follows:

  1. fix(linux): give the CLI one entrypoint by extracting the AppImage once #15081 — one stable AppImage CLI entrypoint
  2. fix(linux): stop CLI commands from falling through to Chromium startup #15083 — unified CLI launch redirect
  3. fix(linux): report a missing display instead of dying in uv_close #15084 — missing-display diagnosis
  4. test(linux): add a packaged-artifact contract for the CLI launch paths #15085 — packaged-artifact launch contract and rpm parity
  5. fix(linux): require static AppImage runtimes #17319 — static AppImage runtime validation
  6. fix(linux): move deb/rpm update installation outside Orca #17318 — manual deb/rpm package installation handoff
  7. docs(linux): document orcad update restart safety #17320 — orcad restart-ownership safety documentation

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • No RPC, IPC, mobile, relay, or persisted user-data contract changes; no mobile-facing RPC/protocol/pairing surface was touched.
  • SSH/folder workspaces are unaffected; AppImage handling runs only on the local packaged Linux host.
  • macOS and Windows installation behavior remains covered, including privileged macOS command replacement.
  • Existing wrapper registrations are treated as stale and replaced rather than silently trusted.

Residual follow-ups

Both are defense-in-depth P2 follow-ups; current publication and pruning behavior remains bounded and tested.

Checklist

  • Rebased onto current main
  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

Review fixes applied after review (2026-09-01)

Three defects found in review, all fixed in c23953a5a00 and verified on Ubuntu 24.04 hardware.

Superseded generations leaked ~105 MB each. Pruning removed 3215 of 3216 files and always stranded resources/app.asar. Electron's asar shim reports a *.asar file as a directory, so the recursive remove tried to rmdir a real file, failed with ENOTEMPTY, and .catch(() => {}) hid it. Reproduced end to end twice with different cache hashes (519M → 623M across a single version change), then confirmed reclaimed in a packaged build: registration 2 leaves du at 519M with one generation, no manual step and no warning.

removeExtractedAppImagePayload now holds process.noAsar for the removal, counted so overlapping removals cannot hand the shim back early. All three removal sites use it — staging cleanup (appimage-extracted-root.ts:182) and displaced roots (:230) leaked identically, not just the prune site. The prune site now warns with the path instead of swallowing the rejection.

A deb → AppImage migration wedged on its own leftover symlink. The Linux reclaim rule recognised only extracted-cache launchers, so a symlink into /opt/Orca/resources/bin/orca-ide from a previous packaged install became a hard conflict. Packaged-install prefixes are reclaimable again; the existing refusal of arbitrary resources/bin paths is unchanged and still covered by its test.

The conflict error named the offending path but not the remedy. It now says what to do.

Verification

pnpm tc clean. The packaged CLI launch contract passes 8/8 in a restricted Ubuntu container with no /dev/fuse and unprivileged user namespaces denied, and fails 4/8 against a stock release AppImage — three of those at status 133 (SIGTRAP) — so the harness has real detection power rather than rubber-stamping any binary.

Known gaps, tracked rather than fixed

Registration lock has no acquisition deadline (~15 min worst case against a wedged holder); pruning protects only the current and installed roots, so a root another running version is exec'ing from is eligible; a crash mid-unregister can leave a gutted root that reports complete.

User-facing regressions

Not zero. Three, plus three known gaps.

  1. First CLI registration costs ~2.5s and ~519 MB of disk per generation. Previously nothing was extracted. Measured on Ubuntu 24.04; the payback is a ~9x faster CLI on every later invocation (0.09s vs 0.85s through FUSE).
  2. Rolling back to a pre-PR build wedges registration. cli-install-location.ts now reports installMethod: 'symlink' unconditionally on Linux, dropping the AppImage 'wrapper' branch, so an older build finds a symlink where it expects a wrapper. Workaround: delete ~/.local/bin/orca-ide and re-register. Only bites on downgrade.
    ~~3. A wedged registration lock can hang an IPC-driven install for ~15 minutes.~~ Removed. retries caps the attempt count, not elapsed time; a maxRetryTime wall-clock deadline is now forwarded to proper-lockfile, and a wedged holder produces a message naming the lock file instead of a silent hang.

Known gaps, tracked not fixed: pruning protects only the current and installed roots, so a root a different running Orca version is exec'ing from is eligible for removal; and a crash mid-unregister can leave a gutted root that reports complete and then fails at exec.

Found in review and fixed here: superseded generations leaked ~105 MB each (reproduced twice, verified reclaimed in a packaged build), and a deb → AppImage migration wedged on its own leftover /opt/Orca symlink.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 91a23410-f0b4-4c49-af37-dac4ee6d82f2

📥 Commits

Reviewing files that changed from the base of the PR and between 8f709a4582b8ce5cd25fd8181371bf218fe551f2 and 3b22569b72c1419755bbf85065333e1eb1aa0c6d.

📒 Files selected for processing (8)
  • src/main/appimage-runtime-identity.test.ts
  • src/main/appimage-runtime-identity.ts
  • src/main/cli/cli-command-installation.ts
  • src/main/cli/legacy-appimage-cli-wrapper.test.ts
  • src/main/cli/legacy-appimage-cli-wrapper.ts
  • src/main/cli/linux-terminal-orca-cli-shim.test.ts
  • src/main/cli/linux-terminal-orca-cli-shim.ts
  • src/main/ipc/cli-appimage-stale-registration.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Linux AppImage handling now validates runtime identity, extracts payloads into metadata-keyed cache generations, and exposes stable launcher endpoints. CLI installation and removal use transactional filesystem operations with race detection, ownership checks, pruning, and serialized registration locks. Dispatchers and terminal shims resolve extracted or bundled launchers directly. IPC repairs stale AppImage registrations, and PTY setup refreshes the Linux CLI shim for packaged runs. Tests cover extraction, races, cleanup, launcher publication, runtime validation, and IPC repair.

Merge Risk: 🟡 Moderate · up to 3b225

The PR replaces repeated AppImage launches with a cached stable Linux CLI launcher, but fresh extraction can still fail before publication, the documented root-owned /opt/orca setup is not writable as written, and some tests may be unreliable or platform-dependent; the launcher also trusts mutable user-cache targets at execution time. These are actionable merge-readiness risks that should be fixed or explicitly accepted before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 113 functions across 36 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation addresses all linked objectives [#11609, #12530, #16650]. It bypasses AppRun for CLI execution, avoids FUSE at command runtime through extraction, and provides stable launcher regis…
Out of Scope Changes check ✅ Passed The production and test changes support the linked AppImage CLI objectives. Extraction, stable launcher publication, registration repair, cleanup, race handling, legacy migration, and terminal refresh…
Title check ✅ Passed The title clearly summarizes the main change: extracting the Linux AppImage once to provide a single CLI entrypoint.
Description check ✅ Passed The description follows the required template and provides clear scope, rationale, linked issues, testing evidence, platform considerations, risks, follow-ups, and checklist completion.
Full details: Linked Issues check

Explanation

The implementation addresses all linked objectives [#11609, #12530, #16650]. It bypasses AppRun for CLI execution, avoids FUSE at command runtime through extraction, and provides stable launcher registration with validation, retries, ownership checks, and migration support.

Full details: Out of Scope Changes check

Explanation

The production and test changes support the linked AppImage CLI objectives. Extraction, stable launcher publication, registration repair, cleanup, race handling, legacy migration, and terminal refresh are related implementation details. No unrelated feature changes are evident.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

🧹 Nitpick comments (1)
src/main/cli/linux-bare-orca-dispatcher.ts (1)

49-58: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Resolve the launcher after the ownership check.

resolveStableLauncherPath now runs first, and for an AppImage it calls ensureAppImageExtractedRoot, which extracts the full payload. If the user owns ~/.local/bin/orca, the function then returns skipped-foreign and discards that work. orca serve startup pays the first-run extraction cost even when it cannot write a dispatcher.

Move the isOwnedDispatcher check before launcher resolution. The skipped-foreign result then reports target: null, so update the tests for that state if you take this change.

♻️ Proposed reordering
-  const launcher = await resolveStableLauncherPath(options)
-  if (!launcher) {
-    return { state: 'skipped-launcher-missing', dispatcherPath, target: null }
-  }
-
   // Why: only (re)write a dispatcher we previously created; leave a user's own
   // `orca` untouched rather than silently clobbering it on every serve start.
   if (existsSync(dispatcherPath) && !(await isOwnedDispatcher(dispatcherPath))) {
-    return { state: 'skipped-foreign', dispatcherPath, target: launcher }
+    return { state: 'skipped-foreign', dispatcherPath, target: null }
+  }
+
+  const launcher = await resolveStableLauncherPath(options)
+  if (!launcher) {
+    return { state: 'skipped-launcher-missing', dispatcherPath, target: null }
   }

Run the following script to find every assertion on the skipped-foreign target:

#!/bin/bash
# Description: Locate consumers and assertions that read `target` for the skipped-foreign state.
rg -n -C6 "skipped-foreign" src

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 81c06878-30a7-4c9d-982b-99b39268479a

📥 Commits

Reviewing files that changed from the base of the PR and between be07b43 and ef067ef.

📒 Files selected for processing (14)
  • docs/reference/headless-linux-server.md
  • src/main/cli/appimage-cli-wrapper.ts
  • src/main/cli/appimage-extracted-root.test.ts
  • src/main/cli/appimage-extracted-root.ts
  • src/main/cli/cli-installer.test.ts
  • src/main/cli/cli-installer.ts
  • src/main/cli/linux-bare-orca-dispatcher.test.ts
  • src/main/cli/linux-bare-orca-dispatcher.ts
  • src/main/cli/linux-terminal-orca-cli-shim.test.ts
  • src/main/cli/linux-terminal-orca-cli-shim.ts
  • src/main/cli/packaged-cli-assets.test.ts
  • src/main/cli/posix-shell-quote.ts
  • src/main/cli/wsl-cli-installer.ts
  • src/main/cli/wsl-cli-scripts.ts
💤 Files with no reviewable changes (1)
  • src/main/cli/appimage-cli-wrapper.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 6 remain after this review.

Comment thread src/main/cli/cli-installer.ts Resolved
Comment thread src/main/cli/cli-installer.ts Resolved
@nwparker
nwparker force-pushed the nwparker/linux-cli-single-entrypoint branch from ef067ef to 25634e2 Compare August 30, 2026 00:50
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR replaces repeated AppImage re-entry with a stable Linux CLI launcher backed by transactionally extracted, generation-keyed payloads.

  • Adds validated AppImage runtime identification, extraction, endpoint publication, locking, and pruning.
  • Fences CLI installation and removal against filesystem races and namespace ownership conflicts.
  • Refreshes managed terminal startup behavior and Linux packaging documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/main/cli/appimage-extracted-root.ts Implements staged AppImage extraction, validation, atomic generation publication, and bounded retry handling.
src/main/cli/appimage-extraction-pruning.ts Prunes obsolete generation roots while retaining selected, installed, and actively extracted payloads; the previously reported stale-snapshot race is now fenced by callers’ shared registration lock.
src/main/cli/appimage-registration-lock.ts Provides the cache-scoped cross-process serialization used by AppImage publication and pruning paths.
src/main/cli/appimage-stable-launcher.ts Defines the stable launcher and atomically managed live and installed endpoints.
src/main/cli/cli-installer.ts Coordinates extraction, CLI registration, pruning, ownership-aware removal, and the shared AppImage lock.
src/main/cli/linux-bare-orca-dispatcher.ts Installs the bare Linux dispatcher against the stable launcher and performs AppImage extraction and pruning while holding the registration lock.

Sequence Diagram

sequenceDiagram
  participant App as Orca AppImage
  participant Lock as Registration lock
  participant Cache as Generation cache
  participant Endpoint as Stable endpoint
  participant CLI as Registered CLI
  App->>Lock: Acquire cache-scoped lock
  Lock->>Cache: Extract and validate generation
  Cache->>Endpoint: Atomically publish installed target
  Lock->>Cache: Prune unprotected generations
  Lock-->>App: Release lock
  CLI->>Endpoint: Resolve stable launcher
  Endpoint->>Cache: Execute selected payload
Loading

Reviews (23): Last reviewed commit: "refactor(linux): import bundled launcher..." | Re-trigger Greptile

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

🧹 Nitpick comments (1)
src/main/cli/cli-installer-appimage-removal.test.ts (1)

174-178: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the serialization assertion decisive.

The hook awaits one microtask, then asserts siblingStatusReads is 0. The sibling install() first awaits withAppImageRegistrationLock, which performs mkdir and lock-file I/O, so it cannot reach getStatus() within a single microtask even if the lock did not serialize anything. The assertion therefore passes whether or not the lock works, and a regression in runAppImageRegistrationOperation would not fail this test.

Record when the first operation releases the lock, then assert the ordering against that marker.

♻️ Proposed direction
+    let firstRemoveFinished = false
+    let siblingReadBeforeRelease = false
     let siblingInstall: Promise<unknown> | null = null
     siblingStatusReads = 0
     firstInstaller.afterNextStatus = async () => {
       siblingInstall = secondInstaller.install()
-      await Promise.resolve()
-      expect(siblingStatusReads).toBe(0)
     }
     await firstInstaller.remove()
+    firstRemoveFinished = true
     expect(siblingInstall).not.toBeNull()
     await siblingInstall
+    expect(siblingReadBeforeRelease).toBe(false)

Set siblingReadBeforeRelease inside TrackingInstaller.getStatus() when firstRemoveFinished is still false.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a7aaa018-4da0-452c-8129-2005f5026cb7

📥 Commits

Reviewing files that changed from the base of the PR and between de851d5 and 25634e2.

📒 Files selected for processing (34)
  • docs/reference/headless-linux-server.md
  • src/main/appimage-runtime-identity.test.ts
  • src/main/appimage-runtime-identity.ts
  • src/main/cli/appimage-cache-layout.ts
  • src/main/cli/appimage-extracted-root.test.ts
  • src/main/cli/appimage-extracted-root.ts
  • src/main/cli/appimage-extraction-pruning.test.ts
  • src/main/cli/appimage-extraction-pruning.ts
  • src/main/cli/appimage-registration-lock.ts
  • src/main/cli/appimage-stable-launcher.test.ts
  • src/main/cli/appimage-stable-launcher.ts
  • src/main/cli/cli-command-filesystem-transaction.ts
  • src/main/cli/cli-command-inspection.ts
  • src/main/cli/cli-command-installation-races.test.ts
  • src/main/cli/cli-command-installation.ts
  • src/main/cli/cli-command-privileged-transaction.test.ts
  • src/main/cli/cli-install-location.ts
  • src/main/cli/cli-installer-appimage-ownership.test.ts
  • src/main/cli/cli-installer-appimage-removal.test.ts
  • src/main/cli/cli-installer-contracts.ts
  • src/main/cli/cli-installer.test.ts
  • src/main/cli/cli-installer.ts
  • src/main/cli/legacy-appimage-cli-wrapper.ts
  • src/main/cli/linux-bare-orca-dispatcher.test.ts
  • src/main/cli/linux-bare-orca-dispatcher.ts
  • src/main/cli/linux-terminal-orca-cli-shim.test.ts
  • src/main/cli/linux-terminal-orca-cli-shim.ts
  • src/main/cli/packaged-cli-assets.test.ts
  • src/main/ipc/cli-appimage-stale-registration.test.ts
  • src/main/ipc/cli.ts
  • src/main/ipc/pty-ipc-mock-registry.ts
  • src/main/ipc/pty-ipc-suite-environment.ts
  • src/main/ipc/pty-restored-appimage-cli-shim-refresh.test.ts
  • src/main/ipc/pty/register-handlers.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/cli/linux-terminal-orca-cli-shim.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Comment thread docs/reference/headless-linux-server.md Resolved
Comment thread src/main/cli/appimage-extracted-root.ts Resolved
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c62bcd10-061a-4f82-a69b-3dd5ed1010e9

📥 Commits

Reviewing files that changed from the base of the PR and between 14d39bd and 8f709a4582b8ce5cd25fd8181371bf218fe551f2.

📒 Files selected for processing (34)
  • docs/reference/headless-linux-server.md
  • src/main/appimage-runtime-identity.test.ts
  • src/main/appimage-runtime-identity.ts
  • src/main/cli/appimage-cache-layout.ts
  • src/main/cli/appimage-extracted-root.test.ts
  • src/main/cli/appimage-extracted-root.ts
  • src/main/cli/appimage-extraction-pruning.test.ts
  • src/main/cli/appimage-extraction-pruning.ts
  • src/main/cli/appimage-registration-lock.ts
  • src/main/cli/appimage-stable-launcher.test.ts
  • src/main/cli/appimage-stable-launcher.ts
  • src/main/cli/cli-command-filesystem-transaction.ts
  • src/main/cli/cli-command-inspection.ts
  • src/main/cli/cli-command-installation-races.test.ts
  • src/main/cli/cli-command-installation.ts
  • src/main/cli/cli-command-privileged-transaction.test.ts
  • src/main/cli/cli-install-location.ts
  • src/main/cli/cli-installer-appimage-ownership.test.ts
  • src/main/cli/cli-installer-appimage-removal.test.ts
  • src/main/cli/cli-installer-contracts.ts
  • src/main/cli/cli-installer.test.ts
  • src/main/cli/cli-installer.ts
  • src/main/cli/legacy-appimage-cli-wrapper.ts
  • src/main/cli/linux-bare-orca-dispatcher.test.ts
  • src/main/cli/linux-bare-orca-dispatcher.ts
  • src/main/cli/linux-terminal-orca-cli-shim.test.ts
  • src/main/cli/linux-terminal-orca-cli-shim.ts
  • src/main/cli/packaged-cli-assets.test.ts
  • src/main/ipc/cli-appimage-stale-registration.test.ts
  • src/main/ipc/cli.ts
  • src/main/ipc/pty-ipc-mock-registry.ts
  • src/main/ipc/pty-ipc-suite-environment.ts
  • src/main/ipc/pty-restored-appimage-cli-shim-refresh.test.ts
  • src/main/ipc/pty/register-handlers.ts
🚧 Files skipped from review as they are similar to previous changes (31)
  • src/main/cli/linux-bare-orca-dispatcher.ts
  • docs/reference/headless-linux-server.md
  • src/main/ipc/pty-restored-appimage-cli-shim-refresh.test.ts
  • src/main/cli/appimage-registration-lock.ts
  • src/main/ipc/pty-ipc-mock-registry.ts
  • src/main/ipc/cli.ts
  • src/main/cli/linux-bare-orca-dispatcher.test.ts
  • src/main/cli/cli-installer-appimage-removal.test.ts
  • src/main/ipc/pty/register-handlers.ts
  • src/main/cli/linux-terminal-orca-cli-shim.test.ts
  • src/main/appimage-runtime-identity.test.ts
  • src/main/cli/cli-command-privileged-transaction.test.ts
  • src/main/cli/cli-command-inspection.ts
  • src/main/cli/appimage-extraction-pruning.ts
  • src/main/ipc/cli-appimage-stale-registration.test.ts
  • src/main/cli/cli-installer-appimage-ownership.test.ts
  • src/main/ipc/pty-ipc-suite-environment.ts
  • src/main/cli/appimage-extracted-root.test.ts
  • src/main/appimage-runtime-identity.ts
  • src/main/cli/appimage-stable-launcher.ts
  • src/main/cli/cli-install-location.ts
  • src/main/cli/appimage-extraction-pruning.test.ts
  • src/main/cli/cli-installer-contracts.ts
  • src/main/cli/cli-installer.test.ts
  • src/main/cli/appimage-stable-launcher.test.ts
  • src/main/cli/appimage-extracted-root.ts
  • src/main/cli/cli-command-installation-races.test.ts
  • src/main/cli/appimage-cache-layout.ts
  • src/main/cli/cli-command-filesystem-transaction.ts
  • src/main/cli/linux-terminal-orca-cli-shim.ts
  • src/main/cli/cli-installer.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@nwparker
nwparker force-pushed the nwparker/linux-cli-single-entrypoint branch 8 times, most recently from 9c8586f to 77671b3 Compare August 30, 2026 09:21
@AmethystLiang

Copy link
Copy Markdown
Contributor

thanks for reporting. looking into it

@nwparker
nwparker force-pushed the nwparker/linux-cli-single-entrypoint branch 4 times, most recently from 6635923 to 1315eb8 Compare August 31, 2026 01:09
@nwparker
nwparker force-pushed the nwparker/linux-cli-single-entrypoint branch from a1318ea to 15e1388 Compare August 31, 2026 13:02
Pruning removed 3215 of 3216 files from a superseded generation and always
stranded resources/app.asar, leaking ~105 MB per version update. Electron's
asar shim reports a *.asar file as a directory, so the recursive remove tried
to rmdir a real file and failed with ENOTEMPTY; the .catch(() => {}) hid it.
Reproduced end to end on Ubuntu 24.04: 519M -> 623M across one update, and
519M again once the payload is actually reclaimed.

removeExtractedAppImagePayload holds process.noAsar for the removal, counted
so overlapping removals cannot hand the shim back early, and the prune site
now warns with the path instead of swallowing the rejection. All three
removal sites use it -- staging cleanup and displaced roots leaked the same
way.

Also reclaim symlinks left by a packaged deb/rpm install, which the
extracted-cache-only rule turned into a hard conflict on a deb -> AppImage
migration, and name the remedy in the conflict error.
`retries: 1000` caps the attempt count, not elapsed time, so at up to 1s per
attempt an IPC-driven registration could hang ~16 minutes against a wedged
holder with no feedback.

A legitimate holder is bounded by the extraction timeout, so wait that plus
slack and then fail with a message naming the lock file, rather than hanging.
`maxRetryTime` is forwarded verbatim to the `retry` package by proper-lockfile.
The extracted-payload cache key hashed ctime alongside dev/ino/size/mtime.
ctime moves on any inode metadata write -- `chmod +x`, which every AppImage
user is told to run, plus `chown`, an ACL or SELinux relabel, and a backup
restore -- none of which alter a byte of the payload.

Measured on Ubuntu 24.04: `chmod +x` leaves dev, ino, size and mtime
identical and moves ctime alone, so the key changed and the next launch paid
a full ~519 MB re-extraction and a multi-second stall to rebuild a payload it
already had, then pruned the old generation.

Key on content identity instead. An in-place content change moves mtime and
almost always size; a replacement moves the inode. The existing
replace-in-place test still passes.
@nwparker
nwparker merged commit 28214e1 into main Sep 1, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment