Skip to content

fix(orcad): an install lock this desktop's exited process left mid-upload is taken over without the 20-minute wait - #25991

Merged
OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-own-install-lock
Oct 6, 2026
Merged

OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-own-install-lock

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​158 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​157
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​118 $\color{#cf222e}{\Huge{\mathbf{−}}}$​81 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37

ELI5

#25941 let Orca clear a busy marker it had left itself on an SSH host, after a quit in the middle of an update. A real-host test showed a second case it didn't cover. If you quit while Orca is still uploading the new server, the leftover marker is a different lock: the one on the version's install folder. The next launch still waited about 20 minutes for that lock to expire. This PR applies the same "it's our own, and the process that held it is gone" rule to that lock.

What Changed

  • Before:
  • After:
    • The install lock is created with this desktop's token, in the same command that creates it. The token is recorded in fix(orcad): a fence this desktop's exited process left is cleared without the 20-minute wait #25941's held-token store.
    • The token is forgotten only once the lock's removal is confirmed. abandonInstall now reports whether removal was confirmed, so a removal that a quit cut short keeps the token.
    • acquireInstallLock gained an optional beforeStaleCheck hook. The install passes the shared reclaim helper to it.
    • Before each stale check (immediately, then every 60 s), a POSIX lock is backdated if three things hold:
      • its token belongs to a process that exited on this same machine and boot;
      • the lock has been quiet for at least 3 minutes;
      • the owner still matches after the backdate. A successor that won the race gets its freshness back.
    • The existing stale takeover then claims the lock at once.
  • The activation-fence reclaim from fix(orcad): a fence this desktop's exited process left is cleared without the 20-minute wait #25941 now uses the same helper (orcad-exited-own-lock.ts), with its state-mutation gate. The install lock passes no gate.

Why

Linked Issue

Fixes # (maintainer: BUG-23 follow-up to #25941, found by the real-host retest)

Visual Proof

N/A: no UI change. This changes how a leftover install lock on an SSH host is handled on the next launch.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Added orcad-exited-own-install-lock.test.ts, which runs real host commands in a local shell:

    • a quiet 10-minute-old lock left by our own exited process is taken over in well under the wait budget, with the new owner token written;
    • a lock carrying another desktop's token is left in place and the acquire times out.
  • Added to orcad-remote-install-termination.test.ts:

    • the token is written into the lock and forgotten after a confirmed removal;
    • the token is kept when a quit cut the removal short.
  • src/main/ssh: the install, install-lock, versioned-install, deploy and fence test files pass (298).

  • tc:node and typecheck:cli: clean.

  • Changed-code quality gate: passed.

Review

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

  • SSH: there is no wire change. Older clients ignore the extra owner file inside the install lock.
  • Execution boundary: a live holder, a lock from another machine or boot, or another desktop's lock is never touched.

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

…load is taken over without the 20-minute wait

A quit during the bundle upload leaves the version dir's install lock, not the
activation fence. The lock now carries this desktop's token, recorded in the
held-token store, and is forgotten only once its removal is confirmed. On a
later attempt, before each stale check, a POSIX lock whose token belongs to an
exited process of this machine and boot, quiet for three minutes, is backdated
so the existing stale takeover claims it at once. The fence path now shares
the same helper.
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