Repository navigation
fix(update): keep a launched candidate's restart failure free of a data-risk mark - #201894
Merged
fuller-stack-dev merged 5 commits intoNov 22, 2026
Merged
fuller-stack-dev merged 5 commits into
fuller-stack-dev merged 5 commits into
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Contributor
|
Codex review: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
fuller-stack-dev
force-pushed
the
fix/update-evidence-marks-restart
branch
from
November 19, 2026 15:18
fdc7a75 to
c4cafa0
Compare
fuller-stack-dev
force-pushed
the
fix/update-evidence-marks-restart
branch
from
November 19, 2026 15:52
c4cafa0 to
b5595fa
Compare
…ta-risk mark After a migrated update, a restart health failure was stamped with the migrated-state block as data at risk and a rollback was attempted, even when the candidate was running and had answered as the new version. Release the block only on launch evidence read after readiness failed: the native service still runs the process that answered, that process owns every listener on the Gateway port, its recorded version equals the candidate's with no build mismatch (and its build matches when known), and the version it replaced is known and differs. The run then ends as a restart-health failure, restart unsafe, no data risk, and rollback not attempted (recorded as state-migrated-no-rollback). Split-root updates keep their existing path. While rollback is refused, including in the final-recovery pass where the refusal is recorded as the rollback outcome, the restart verifier no longer advises reinstalling the previous version, and names whether the state was migrated or rollback safety could not be verified. Health observations now always write the PID, so a PID-less observation no longer inherits an earlier process's PID through the verification merge.
fuller-stack-dev
force-pushed
the
fix/update-evidence-marks-restart
branch
from
November 19, 2026 16:27
b5595fa to
b140768
Compare
fuller-stack-dev
marked this pull request as ready for review
November 19, 2026 16:27
…arks-restart # Conflicts: # src/cli/update-cli/update-command-service.ts
… its owner main grew update-command-post-update.ts to its line cap. The verification owner now records the not-attempted rollback outcome in the run ledger, where status and final recovery read it, so the finalizer adds one call line.
Member
Author
|
Merged via squash.
|
scribe-dandelion-cult
added a commit
to karmaterminal/openclaw
that referenced
this pull request
Nov 22, 2026
…9388 stage 5) Absorbs openclaw/openclaw main b949a1c (62 commits past the absorbed 5a3e6b1, which is the merge-base) into a329243, so openclaw#129388's presentation can fast-forward. rerere was off for the merge; nothing arrived pre-staged. 7 content conflicts: - Generated, regenerated rather than hand-merged: config-baseline counts and sha256 (config:docs:gen; core 2668 + fork 17 = 2685) and gateway predicates.js (gateway:validators:gen). Node 24.21.0 and Bun 1.4.4 write byte-identical output. - src/infra/worker-cpu.ts: upstream openclaw#202507 moved WorkerCpuHandle and WorkerMemoryMessage into worker-cpu-types.ts, which makes the fork's Pick<> line-cap edit (57703db) moot; upstream's type move is taken unchanged. The Worker launch composes both edits: upstream's process-generation file resolution (openclaw#202495/openclaw#202507, skipped for eval sources) and the fork's reviewed compiler policy published at launch (2a10009). They touch disjoint inputs (filename vs execArgv and environment data). Upstream's shared worker host starts its one physical Worker through createCpuTrackedWorker, so it publishes the same policy. - update-cli.fresh-doctor.test: openclaw#203194 (prepared releases and a resident launcher) deleted the two Git current-process tests; the fork's cliArgs config-validate matcher lived in one of them and goes with it. The fork's isGatewayCommand install matcher stays (merged cleanly) and the now-unused cliArgs import is dropped. - update-cli.target-schema.test: openclaw#203194 deleted the four trailing Git in-place tests; every fork compiler-flag matcher (5780288 and earlier) lived in them. The file now equals upstream's. - update-command-definition-recovery.test-support: both imports kept (the fork's isCliCommand/isGatewayCommand, upstream openclaw#201894's releaseLaunchedState); upstream's 199 added lines carry no positional argv matchers. Refs openclaw#129388 Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 23, 2026
…ta-risk mark (openclaw#201894) * fix(update): keep a launched candidate's restart failure free of a data-risk mark After a migrated update, a restart health failure was stamped with the migrated-state block as data at risk and a rollback was attempted, even when the candidate was running and had answered as the new version. Release the block only on launch evidence read after readiness failed: the native service still runs the process that answered, that process owns every listener on the Gateway port, its recorded version equals the candidate's with no build mismatch (and its build matches when known), and the version it replaced is known and differs. The run then ends as a restart-health failure, restart unsafe, no data risk, and rollback not attempted (recorded as state-migrated-no-rollback). Split-root updates keep their existing path. While rollback is refused, including in the final-recovery pass where the refusal is recorded as the rollback outcome, the restart verifier no longer advises reinstalling the previous version, and names whether the state was migrated or rollback safety could not be verified. Health observations now always write the PID, so a PID-less observation no longer inherits an earlier process's PID through the verification merge. * refactor(update): record the launched candidate's rollback outcome at its owner main grew update-command-post-update.ts to its line cap. The verification owner now records the not-attempted rollback outcome in the run ledger, where status and final recovery read it, so the finalizer adds one call line.
tideclaw-bot
pushed a commit
that referenced
this pull request
Nov 24, 2026
…ta-risk mark (#201894) * fix(update): keep a launched candidate's restart failure free of a data-risk mark After a migrated update, a restart health failure was stamped with the migrated-state block as data at risk and a rollback was attempted, even when the candidate was running and had answered as the new version. Release the block only on launch evidence read after readiness failed: the native service still runs the process that answered, that process owns every listener on the Gateway port, its recorded version equals the candidate's with no build mismatch (and its build matches when known), and the version it replaced is known and differs. The run then ends as a restart-health failure, restart unsafe, no data risk, and rollback not attempted (recorded as state-migrated-no-rollback). Split-root updates keep their existing path. While rollback is refused, including in the final-recovery pass where the refusal is recorded as the rollback outcome, the restart verifier no longer advises reinstalling the previous version, and names whether the state was migrated or rollback safety could not be verified. Health observations now always write the PID, so a PID-less observation no longer inherits an earlier process's PID through the verification merge. * refactor(update): record the launched candidate's rollback outcome at its owner main grew update-command-post-update.ts to its line cap. The verification owner now records the not-attempted rollback outcome in the run ledger, where status and final recovery read it, so the finalizer adds one call line. Release adaptation: Retain stable Git restart behavior; use the existing exact listener-ownership helper and explicitly pass the rollback refusal through the stable verifier call. Companion audit: No later same-path or PR follow-up in pinned main. Main-only Git release-link changes are not applicable; release uses its existing in-place update flow. (cherry picked from commit 648619c) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 5326e5f0cc90c2a33837484ea3baf2429d955623)
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.
Problem
After a migrated update,
finishUpdateholdsrollbackBlockedReason = state-migrated-no-rollbackfor the rest of the run.completeUpdateCommandResultstamps any laterstatus: errorwith that block asdataAtRisk. The run then ends with "Keep the Gateway stopped: data at risk (state-migrated-no-rollback)".The commonest error at that point is a restart health failure. The candidate started and answered as the new version, then missed core readiness inside the budget: a slow sidecar, a refused agent database, a plugin reload. That candidate is running on the state it migrated. Nothing shows the state was damaged. Yet the run records a data risk, and the guidance tells the operator to keep a running Gateway stopped. Since #201668,
openclaw update repaircan verify consistent state and record a receipt that resolves the mark, but only after extra verification, and only after the operator has first been given misleading guidance. The mark comes from the restart failing, not from anything observed about the data.The same failure also printed
Rollback: reinstall OpenClaw <previous version> ...from the restart verifier, even though older code cannot read the migrated state.This is audit entry 1 ("blanket
rollbackBlockedReasonstamp"), for its highest-traffic producer: the restart.Rule
A data-at-risk mark needs positive evidence. After
restart-health-failed, the block is released only on launch evidence read after readiness failed:readFailedUpdateGatewayState, which keeps the recorded identity only while the same PID is still running, so a candidate that exited or was replaced during polling is no evidence;When it is released:
readyz-unhealthy). Restart stays unsafe (runtime-verification-failed), with nodataAtRisk;rollbackOutcomerecordsnot-attempted: state-migrated-no-rollback, so status and report readers keep the migration fact.While any rollback block is set, or the recorded rollback outcome is a refusal (the final-recovery pass), the restart verifier drops the reinstall advice. It prints
Rollback: unavailable; update state was migrated, ...forstate-migrated-no-rollback, orRollback: unavailable; rollback safety could not be verified, ...forrollback-state-unverified(for example, PostgreSQL state with no pre-activation baseline).Everything else keeps the mark exactly as before:
An accepted restart or "start attempted" is not treated as launch evidence. That gap is why #201529 was closed.
Change
update-command-verification.tsowns the recorded activation facts and the restart failure report:releaseLaunchedStateapplies the rule above. When it releases the block, it records thenot-attempted: state-migrated-no-rollbackrollback outcome in the run ledger, where status and final recovery read it (result.rollbackOutcome ??= recorded.verification.rollbackOutcome). If that record fails, the block stays.pid. Before, a PID-less observation omitted the key, so the merge kept the previous process's PID.update-command-post-update.ts: forwardsrollbackBlockedReasonto the restart, and one call after the existingactivationVerifiedbranch skips rollback when the block is released. Three lines, so the file stays within its 700-line cap after main's growth.update-command-service-context-types.ts: the restart parameter type. The restart verifier receives it through main's existing parameter spread;update-command-service.tsis unchanged.scripts/tests/update-restart-module-outcome.mjs: the vm fixture exposes the new export from the real verification module, as it already does for its siblings.No config key, stored field, schema value or exit code changes.
rollbackOutcome.reasonis free text, and this reuses the existing reason. The only text change is the verifier's rollback line, shown only when a block is set.What is left to a person
For the converted case:
openclaw update repair,openclaw gateway status --deepandopenclaw triage.For the cases that keep the mark, the existing steps remain. They stay manual because no running build has been shown to own the migrated state, and starting one automatically is exactly what the mark exists to prevent.
Evidence
Exact base
0eb6488cd3c, headb1407681922. The recordings are from that head. Later commits only mergemain(including #201668 and #200578) and move the rollback-outcome record into the verification owner. That move is covered by the ledger assertions in the same tests, which pass on the final head. The same test files run at both. Only the four product files above are swapped.Each guard is mutation-proven. With the guard removed, the named control fails:
versionMatch !== falseserviceRunning === truepidclears an earlier process's PID when the running service reports noneoffers the previous version only while rollback is allowed (refusal=restart)... (refusal=recorded)... (refusal=unverified)Checks on head:
pnpm tsgo:coreandpnpm tsgo:core:testpass.oxlintandoxfmtare clean.update-command-post-update.tsstays within 700.update-command-post-update-repair,-post-update-recovery,-post-update,-verification,-service,-database-rollback,-lifecycle,-original-service,test/scripts/update-restart-module-outcome,test/scripts/eager-import-closure. These ran on the same product tree before the rebase over unrelated main commits (UI locales, automations, Doctor image candidate, Gateway history, plugins). None of them touch update, port, restart or daemon code.Review so far:
An independent review found no blocker. Its findings are addressed: the stale PID merge, keeping the migration fact on record, the split-root path, the unchanged version, and weak assertions.
ClawSweeper round 1 found two P2s, both addressed. Facts read before readiness polling could describe a candidate that had since exited; the live re-read now covers that. The verifier printed reinstall advice despite the refusal; that is now refusal-aware.
ClawSweeper round 2 (patch tier C) found three more, all addressed. A version answer was not tied to the managed PID; the listener ownership check now does that. The final-recovery verifier pass still offered reinstall; it now honors the recorded refusal. The base comparison said "rolled back"; it now says the finalizer calls a rollback that the migration check refuses.
ClawSweeper round 3 (last round) found four. All four are fixed in this head, because each one either dropped the mark on ambiguous evidence or printed a false message. A version answer could come from a non-owned listener on another bind address; every listener must now be owned. An unknown predecessor version passed the "changed" check; it now has to be known. A version answered without a build passed while the update knew the build; the build is now required. "State was migrated" was printed for the PostgreSQL no-baseline refusal; that refusal now has its own wording.
Follow-ups (not in this PR)
Hidden listener (rating round 4, P2): when process visibility is restricted,
lsofcan return only the managed user's listener and omit another user's listener on a different address. If that hidden listener answered the version probe, the ownership check still passes. Attributing the reply needs the Gateway's health reply to name its PID or boot identity per listener, which is a protocol change. That is a decision for Jason, so it is not done here.PostgreSQL without a pre-activation baseline (round 4, P2): the first restart-verifier pass still offers "reinstall the previous version", which the rollback owner later refuses. Base prints the same line in the same state; this PR neither introduces nor widens it.
Real-path proof of the restart verifier feeding this check. The finalizer tests fake the restart outcome and write the facts the verifier would record. The producer-side PID behavior and the advice are tested on the real verifier.
A real Docker cell (see below).
The remaining audit catch-alls, by owner: migration/rollback (
update-command-rollback.tsdefault and catch,update-command-database-backup.tsrollback-start andassertRollbackSafe), Doctor classifier and preflight (doctor-maintenance-inspection.ts), Git legacy pre-Doctor mark (update-runner-git.ts), and service recovery admission (update-command-service-recovery.ts).Not proven
No real Docker cell. This PR's proof is unit and mutation tests only: red on base, green on head, and every guard mutation-killed. No packaged update with a live, write-loaded Gateway exercises this path. Within the agreed one-hour bound I tried these environment-level faults (no product test hook):
readiness-pending, notrestart-health-failed, so it never reaches this path.main: the most promising. Readiness reportsagent-database:<id>withcoreReady: falsewhile the Gateway owns its port and answers its version, and real agent-schema migrations exist betweenv2026.11.6and main. I wired it into an update-matrix harness copy and built head and base packs. It was not run: the Docker lock was taken by release-critical cells, then the session was interrupted. Two things remain unverified: the fault was never observed, and the update's Doctor might refuse or repair that database before the restart.The unit tests run the real
finishUpdate, rollback selection, run ledger, live-runtime and port re-read, final recovery and guidance code. Only the service manager, the restart outcome, the rollback executor and the port inspection are faked.