Skip to content

fix(serve): give the first AppImage serve one unpacking deadline and progress - #28015

Merged
OrcaWin merged 1 commit into
mainfrom
fix/appimage-serve-extraction-deadline
Oct 12, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
fix/appimage-serve-extraction-deadline

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​268 $\color{#cf222e}{\Huge{\mathbf{−}}}$​50 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​218

ELI5

On Linux, the first time orca-linux.AppImage serve starts after an update, it unpacks the AppImage once (about 500 MB) before it registers the orca command. Before this change, that wait was silent and was bounded only by several separate 5-minute timers, so it could look hung for a long time. Now the wait has one deadline. It prints progress while it works, and it stops early with a clear reason if the unpack cannot work.

What Changed

  • Before:
    • AppImage serve called the CLI installer and then the bare orca dispatcher installer.
    • Each one could wait up to 5.5 minutes for the registration lock and up to 5 minutes for each of two extraction attempts.
    • Nothing was printed while it waited.
    • A full or noexec cache was only discovered after the extraction failed.
  • After (direct AppImage serve only):
    • One overall deadline (5 minutes) covers the lock wait and every extraction attempt. The CLI installer and the dispatcher run inside the same deadline.

    • Progress on stderr, which is where serve's diagnostics already go; stdout stays the JSON readiness channel:

      • [serve] First start of this AppImage: unpacking a stable copy into ~/.cache/orca/appimage (up to 300s)
      • a "Still unpacking…" line every 15 s
      • AppImage copy ready after Ns, or the reason it could not finish
    • Precondition check before extracting. The cache must be:

      • owned by this user and not writable by others;
      • writable;
      • able to run programs (a noexec mount fails here);
      • large enough, at about 3× the AppImage size.

      If any check fails, serve skips CLI registration with that reason and carries on serving, which is what it did before after a long wait. A read-only AppImage location, such as /opt, is fine: the AppImage directory never needed to be writable.

  • Unchanged:
    • Desktop launches. They never block on this.
    • The registered orca serve path. Its default runtime does not extract at startup.
    • macOS, Windows, and deb/rpm Linux. The preparation only runs when the process is a validated AppImage.
    • Pre-extraction when an update is downloaded is a separate follow-up and is not in this PR.

Why

  • The accepted direction was to keep the one-time wait but bound it and make it visible. Moving the work earlier, to when the update downloads, is a separate follow-up.
  • One deadline object passed down through the existing lock and extraction calls is less code than a new timeout layer around them. It also guarantees that no single step can outlast the whole.

Linked Issue

Part of the D3 AppImage work, for direct serve (#18200 / #15956). It does not close either issue.

Visual Proof

N/A. The only change users see is stderr text. The packaging CI check now asserts that the line appears.

Testing

  • Unit tests:
    • a ready copy returns silently;
    • progress lines and the completion line appear;
    • every extraction attempt gets at most the remaining budget, and the whole call ends within it;
    • a precondition refusal never extracts;
    • a held lock is abandoned at the deadline;
    • the cache probe accepts a private cache and an AppImage in a read-only directory, and refuses a world-writable or unwritable cache.
  • Packaging lane: the extract-and-run serve container, with a read-only AppImage bind and a fresh cache, now asserts that [serve] AppImage copy ready after is printed.
  • Not covered by CI: the first serve after a real in-place update on a systemd host. No lane runs that journey.

Notes

  • SSH: unaffected. A remote orcad never extracts the AppImage.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A for screenshots (stderr text only)
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered
  • pnpm lint, pnpm typecheck pass locally; CI covers the rest

…progress

Direct AppImage serve now unpacks its stable copy once, under one overall
deadline that also bounds the registration lock wait and both extraction
attempts, prints progress to stderr, and refuses fast when the private
cache is not writable, not executable, or too full.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4979c19c-8bb2-4ffe-be83-cd066a84dbdf

📥 Commits

Reviewing files that changed from the base of the PR and between 3d27142 and a358a69.


📒 Files selected for processing (11)
  • config/docker/headless-serve-shutdown/run-signal-case.sh
  • src/main/cli/appimage-extracted-root.ts
  • src/main/cli/appimage-registration-lock.ts
  • src/main/cli/appimage-serve-preparation.test.ts
  • src/main/cli/appimage-serve-preparation.ts
  • src/main/cli/cli-install-location.ts
  • src/main/cli/cli-installer-contracts.ts
  • src/main/cli/cli-installer.ts
  • src/main/cli/linux-bare-orca-dispatcher.ts
  • src/main/startup/main-process-runtime-launch.ts
  • src/main/startup/serve-cli-registration.ts

  • 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.

@OrcaWin
OrcaWin merged commit 5f1f9ea into main Oct 12, 2026
38 checks passed
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.

1 participant