Skip to content

fix(orcad): a failed readiness read no longer kills a healthy candidate; log unsettled activations (BUG-17a) - #25701

Merged
OrcaWin merged 2 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-bug17-candidate
Oct 5, 2026
Merged

OrcaWin merged 2 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-bug17-candidate

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​132 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​132
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​92 $\color{#cf222e}{\Huge{\mathbf{−}}}$​32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60

ELI5

An update to a managed Orca server could start the new version successfully, then shut it down one second later. When that happened, the host was left serving nothing (BUG-17). This PR stops a failed status check from being treated as a failed start, and it records in the app log why any update or rollback did not go through, so the next case can be diagnosed from the log alone.

What Changed

What the hosts show (read-only, r6-idle / r6-upd)

  • Update journal: snapshot-captured. The old version was stopped at 13:36:41 and the new one launched at 13:36:46.
  • 13:37:24.39: the new version wrote a healthy readiness line. Its terminal daemon (pid 2400) was live, its PTY self-test passed, and its build hash matched.
  • Fed through the real parseOrcadReadinessOutput and evaluateOrcadActivation, that readiness line gives activate.
  • About a second later the new version shut down gracefully: its instance lock was released at 13:37:25.648, and its slot dir has no stop-request file, so it got SIGTERM. That is the client's own "rejected candidate" path. Its daemon then retired at 13:37:25.636, because it had nothing left to serve.
  • So the client rejected a candidate the gate would have accepted. The only way that happens is launchError: one of the readiness-wait SSH commands threw an error that wasn't an unconfirmed termination, and the activation treated that as "the candidate failed while starting".
  • Both daemon idle shutdowns are consequences, not causes:
    • 13:36:43 is the designed retirement of an empty daemon after the old version disconnected cleanly;
    • 13:37:25 follows the new version's exit.

Before / after

  • Before: launchOrcadAndAwaitReadiness failed the launch on the first readiness-read command that errored (for example a refused SSH channel or a timed-out command), however healthy the started process was. The activation then stopped the new version and refused to restart the old one over the state it had changed.
  • After: a readiness-read command that errors is logged and retried until the readiness deadline. The launch fails with that error only if the deadline runs out with no successful read. An unconfirmed termination (the command may have run on the host) still fails at once, as before.

Outcome logging

  • deployOrcad and rollbackOrcad now log every outcome that isn't a success, with its code and reason, and every failure that throws:
    • [orcad] update to <v> installed-not-activated (<code>): <reason>
    • [orcad] rollback to <v> failed: <error>
  • Before, only the status kept the latest deferral, and the next connect overwrote it with "Another run is changing this host…", so the code for this incident was lost.

Why

  • Retry the read, not the launch. The process is already running, and a read failure says nothing about it. Relaunching would collide with the instance lock and the port, and stopping it is what produced BUG-17.
  • The readiness deadline already bounds the retries. The existing deadline (3 minutes by default) caps how long a truly unreachable host keeps retrying.
  • Not holding off the daemon's idle shutdown during an activation. The host evidence above shows the daemon shut down because orcad stopped, not the other way round, so that change would not have prevented this.

The readiness read that failed (follow-up commit). The hosts' sshd logs show no refused channels between 13:36 and 13:38, so the failing read was a client-side timeout:

  • The host-side readiness wait counted 80 polls of 0.25 s, each running four short-lived processes. On the loaded host, where the candidate took 38 s to start, those processes took far longer than the sleep, so the 20 s wait ran past the client's 30 s SSH command timeout.
  • That timeout counted as "the candidate failed while starting", and the reject path sent SIGTERM while the candidate was still starting.
  • orcad holds a stop until startup completes, so the candidate published readiness at 13:37:24.39 and then exited, which matches the host files exactly.
  • The forward-dial failures in the sshd logs (connect_to 127.0.0.1 port 6768: failed) come from the client's tunnel and serving checks retrying while nothing listened. The activation never dials that port, and a failed forward dial closes only its own socket.

The wait now ends on a wall-clock deadline (date +%s). The Windows host script's wait already did. Together with the read retry, a slow host can no longer fail a healthy launch.

Linked Issue

BUG-17 part (a) (real-host, test-linux). Part (b), where recover was stuck pending, is in #25698.

Visual Proof

N/A. No UI changes.

Testing

  • I manually tested these changes locally

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

  • orcad-remote-readiness-wait.test.ts runs the real POSIX wait command in a shell where every wc takes 0.5 s. It must end near its 2 s deadline. The old counted loop takes about 10 s, and this test fails against it.

  • orcad-remote-runtime-control.test.ts: a readiness read that is refused once, followed by a ready line, now yields ready. This fails without the fix, which I checked by restoring the original file. An unconfirmed termination still fails at once.

  • orcad-activation-outcome-log.test.ts: an outcome that isn't a success logs its code and reason; a throw is logged and re-thrown; a success logs nothing.

Ran locally:

  • pnpm tc:node, the changed-code gate, oxlint and the format check pass.
  • The deploy, rollback, Windows-command and crash-recovery tests pass (103).

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: retrying a read never decides that a process is live or has exited. An unconfirmed termination still stops the run, and the fence is kept. Windows uses the same loop through its host-script read operation.

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)

…nch, and log every unsettled activation

BUG-17: the candidate went ready and the client SIGTERMed it ~1 s later through its reject path,
yet that readiness passes the gate, so the launch itself failed: one readiness-wait exec that
errored failed the launch outright. Retry such reads until the readiness deadline; an
unconfirmed termination still fails at once. The update's outcome never reached the app log,
so every update or rollback that does not go through now logs its code and reason.
@pullfrog

pullfrog Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

On a loaded host each poll's reads outlasted its sleep, so the step-counted loop ran past
the client's 30 s exec timeout. That timeout failed the launch, the reject path SIGTERMed a
candidate still starting, and orcad, which defers a stop until startup completes, published
readiness and then exited (BUG-17).
@OrcaWin
OrcaWin merged commit 1d142eb into OrcaWin/node-rt-phase3 Oct 5, 2026
59 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