Repository navigation
fix(orcad): a retained activation fence is ownerless, so recovery can always take it over (BUG-17) - #25698
Merged
Conversation
7 of 9 tasks
Contributor
There was a problem hiding this comment.
Important
pnpm tc:node fails on this branch. The acquireFence return-type change is not propagated to two acquireInstallLock mocks, so the static-analysis/typecheck job will go red. See the inline comment for the exact sites and fix.
Reviewed changes
- A retained fence is now backdated ownerless.
withOrcadActivationLockandwithStaleOrcadActivationRecoveryLock(orcad-activation-lock.ts) call the neworphanRetainedFenceon every retain path (retain(), a keptretainOnErrorerror, a recovery refusal or throw), which runsorphanInstallLockCommand(ssh-relay-install-lock-commands.ts) — POSIXtouch -m -t 200001010000, WindowsLastWriteTimeUtc. The existing stale-takeover path then reclaims it immediately instead of the retain resetting the 20-minute window; unconfirmed SSH termination still keeps the fence fresh. - Forced-update deferral reordered.
planOrcadUpdate(orcad-update-plan.ts) now checksinProcessSessions > 0before the daemon-protocol crossing checks, so a forced update on a degraded host names in-process terminals rather than reading the empty daemon as an unreported protocol. - Tests. New real-POSIX lock-command test
orcad-retained-fence-takeover.test.ts; the crash-recovery harness models a takeover (acquireFence(options): boolean,fenceFresh) and the crash-recovery mock now threads it; transaction/crash-recovery assertions for the ownerless mark; a new forced empty-daemon update-plan case.
ℹ️ Nitpicks
- The Windows branch of
orphanInstallLockCommandhas no test:orcad-retained-fence-takeover.test.tsruns the real commands only on POSIX (describe.skipIf(process.platform === 'win32')). The PowerShell timestamp assignment is the one new host-side operation with no coverage; a command-shape assertion (as the other Windows lock commands use) would pin it.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
added 3 commits
October 5, 2026 17:31
… always take it over BUG-17: a recovery that took a stale fence over, failed and retained it left a fresh lock, so every later recovery read it as still fresh and the host could never be recovered. A run that keeps the fence once it is done now backdates the lock; one whose remote command may still be running keeps it fresh. Also run the in-process terminal deferral before the forced protocol check, so a degraded host whose daemon is empty names its in-process terminals instead of an unreported protocol.
… recover just retained The fake host now answers a stale-only takeover busy while a recovery's own takeover is fresh, which reproduces BUG-17's 'still fresh' loop without the ownerless mark.
OrcaWin
force-pushed
the
OrcaWin/node-rt-p3-bug17
branch
from
October 6, 2026 00:33
d4385fe to
9f7b37f
Compare
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed PR #25698 after a rebase. Since the prior pullfrog review, the only net content change is the typecheck fix that review flagged.
- Discarded the
acquireFenceboolean in two mocks —orcad-managed-wake.test.tsandorcad-remote-decommission.test.tsnow callhost.acquireFence()inside a block body, so theiracquireInstallLockmocks returnPromise<void>again andpnpm tc:nodepasses. - Rebased fix/test series —
orcad-activation-lock.ts,ssh-relay-install-lock-commands.ts,orcad-update-plan.ts, and their accompanying tests are unchanged in content from the prior review;git diff d4385fecd8..HEAD -- <PR files>shows no other differences.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
6 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

ELI5
A managed Orca server could get stuck in a state where
orca environment recoveralways answered "still fresh, try again later", forever. This is BUG-17: two test hosts served nothing for 7.5 hours. This PR makes a fence (the per-host lock that stops two update, rollback or stop runs overlapping) that nobody is working under any more something recovery can take over immediately. It also fixes a small wrong message from #25598.What Changed
Recovery could never take the fence over (BUG-17, part b)
.install-lock) and its journal.orcad_recovery_changed_state: the candidate build had started and changed profile state. So each recovery that runs on connect took the fence over, refused and reset the clock. The explicitrecoverthat would accept the changed state only ever saw a fresh lock.retain(), a kept error, and any failure inside the recovery lock.orphanInstallLockCommandusestouch -m -t 200001010000on POSIX and setsLastWriteTimeUtcon Windows.#25598 follow-up (round-7 review, low)
orcad_update_ends_in_process_terminalsdeferral now runs before any protocol checks.Not in this PR yet: BUG-17 part (a). That is why the update rejected a candidate that had reached ready right after the from-idle restart. The code path matches: the activation check rejected the candidate, which was stopped silently, and the restore was refused because the candidate had changed state. The rejection code needs test-linux's logs from the kept hosts, so it follows in a separate commit.
Why
Linked Issue
BUG-17 (real-host, test-linux) and the Phase 3 round-7 review (internal).
Visual Proof
N/A. No UI changes.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
orcad-retained-fence-takeover.test.tsruns the real POSIX lock commands in a shell. A held lock refuses stale takeover, and once it is marked ownerless the takeover succeeds.orcad-activation-transaction.test.tschecks the wiring:retain(), a kept error, and a recovery that keeps the fence or throws;orcad-update-plan.test.tsadds the forced case with an empty daemon.The wiring and update-plan tests fail without their fixes; I checked by restoring the original files.
Ran locally:
pnpm tc:node, the changed-code gate, the format check, and the activation, crash-recovery, decommission, deploy and remote-command tests. Threeorcad-runtime-maintenance.test.tscases fail with "AppEnvironment not initialized", and they fail the same way on the base commit.Review
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
SSH execution boundary: a fence is marked ownerless only by the run that held it, and only once nothing of that run can still be executing on the host. Cross-platform: POSIX
touch, and the Windows timestamp is set through the same PowerShell path the other lock commands already use.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)