Skip to content

fix(orcad): clear a bare stale activation fence instead of asking for Recover; report a restarting update from status (BUG-21) - #25802

Closed
OrcaWin wants to merge 2 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-bug21
Closed

OrcaWin wants to merge 2 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-bug21

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​108 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​104
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​129 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​110

ELI5

After a host was recovered, every automatic update on connect failed with "An interrupted update or stop holds this host… Recover it first". Yet orca environment recover said there was nothing to recover, and a manual update worked. This is BUG-21. The cause was a leftover per-host lock (the "fence" that stops two runs changing a host at once) with nothing actually interrupted behind it. Orca now clears that kind of leftover lock by itself and goes on with the update. It asks for Recover only when there is a real interrupted run to finish.

Separately, orca environment update could fail with "closed the connection before responding", because the server restarts as part of the update. The CLI now waits for the server to answer again and reports what the update left behind.

What Changed

Bare stale fence

  • Before: when an update found the host's activation fence held, orcadActivationFenceRefusal answered "Recover it first" for any fence past its 20-minute stale age.
    • A wake (the from-idle restart) whose connection drops keeps its fence on purpose. That fence has no journal, because a wake writes none, so nothing is interrupted.
    • 20 minutes later every update read it as stale and was marked failed.
    • Recover then took the fence over, found no journal, dropped it and answered none. That's why the host looked fine afterwards and a manual update succeeded.
  • After:
    • A stale fence with no journal is taken over through the same stale-takeover path Recover uses, and released. If a journal appears under it during the takeover, the fence is kept and Recover is still asked for.
    • The update then retries once at once, instead of being marked failed.
    • "Recover it first" now appears only for a stale fence over a journal, or a journal that no fence guards, which are the cases where Recover actually reconciles something.
    • Rollback and stop share the same classification, so they no longer show "Recover it first" for a bare fence either. Their answer is now the fence-busy one.

CLI during a restarting update or rollback

  • Before: the CLI's runtime connection could close when the managed server restarted mid-update, and the command failed with runtime_unavailable.
  • After: orca environment update and orca environment rollback treat a closed connection as expected. They poll managedServer.status every 2 s, for up to about 30 s, and report what it shows:
    • success with the running version;
    • managed_server_interrupted (run recover), when an interrupted run is recorded;
    • managed_server_deferred, with the deferral reason;
    • managed_server_in_progress, if the server never answers again.

Why

  • Clear the bare fence here rather than tell the user to run Recover. Recover would do exactly the same thing: take the fence over, find no journal, drop it. Doing it inside the update removes a manual step that nothing else needed, and the existing stale-takeover command still lets only one client win.
  • Retry the update only once. A second leftover fence right after clearing one would mean something keeps leaving them, so that case is reported instead.

Linked Issue

BUG-21 (real host r6-upd, test-linux). Internal.

Visual Proof

N/A. No UI changes; the visible change is the update status and CLI messages.

Testing

  • I manually tested these changes locally

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

  • orcad-activation-fence-hold.test.ts:

    • a stale fence with no journal is cleared;
    • a journal that appears under the takeover keeps the fence and asks for Recover;
    • Recover is asked for only over a journal.
  • orcad-remote-deploy.test.ts: an update that meets a stale bare fence clears it and goes on to upload.

  • managed-server.test.ts:

    • a closed connection during update reports the version from status;
    • an interrupted run reports managed_server_interrupted.
  • The fence and deploy tests fail without the fix; I checked by restoring the original files. The CLI tests exercise new code.

Ran locally: pnpm tc:node, pnpm tc:cli, the changed-code gate, oxlint, the format check, and the deploy, rollback, stop and crash-recovery tests.

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 execution boundary: a fence is taken over only through the stale or previous-boot takeover, and only when no journal exists under it. A fresh fence still answers busy. Windows uses the same takeover command path.

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)

m4air added 2 commits October 5, 2026 23:58
… Recover, and report a restarting update from status

BUG-21: a wake cut short leaves a stale fence with no journal. Every update then answered
'Recover it first' while Recover answered 'none'. The fence-hold check now takes such a fence
over and drops it, and the update retries once; Recover is asked for only over a journal.
The CLI also treats a connection closed by the server's own restart during update or rollback
as expected and reports what status shows once the runtime answers.
@OrcaWin

OrcaWin commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #25834, which includes this bare-stale-fence fix together with per-holder fence ownership.

@OrcaWin OrcaWin closed this Oct 6, 2026
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