Repository navigation
fix(update): refuse missing host prerequisites in one line and record a cause per attempt - #198355
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
0c698a8 to
9fd15aa
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR adds early Git and disk prerequisite refusals, clearer Node recovery guidance, and a recorded cause for completed update attempts. Example: A package update has 256 MiB free and a target unpacked size of 100 MiB.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This maintainer-authored PR remains useful, resolves the previous findings, and introduces no new blocking defect found in this review. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherUpdate target admission consumes installation, runtime, registry, and filesystem facts; the existing run ledger and shared renderer publish the resulting outcome and recovery instructions. flowchart TD
A[Update request] --> B[Target admission]
C[Host and registry facts] --> B
B --> D[Prerequisite refusal]
B --> E[Existing update execution]
D --> F[Terminal run record]
E --> F
F --> G[CLI and saved reports]
Technical reviewBest possible solution: Retain the focused prerequisite checks and shared cause field while preserving existing recovery ownership and stored-history compatibility. Do we have a high-confidence way to reproduce the issue? Current main still uses advisory package-space warnings and lacks the cause field; the supplied real CLI traces demonstrate the changed outcomes without this review executing target code. Is this the best way to solve the issue? The change uses existing target admission, terminal-record, and report owners, removes the superseded warning path, and keeps the classifier separate from presentation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4f592f12c35c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +277, Tests +200, Docs +27, Other 0. Total +504 across 35 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed November 15, 2026, 10:12 AM ET / 15:12 UTC (Revision 3). |
1cfd324 to
be717cf
Compare
… a cause per attempt Co-authored-by: obviyus <[email protected]>
Co-authored-by: obviyus <[email protected]>
be717cf to
8beaaa7
Compare
…acity case Co-authored-by: obviyus <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…napshot diagnostics out of the refusal block Co-authored-by: obviyus <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What failed in the field
From 3,782 classified upgrade issues and 783 auto-filed update failure reports:
npm error [openclaw] error: this OpenClaw release requires Node >=24.22.1 …underReason code: global-install-failed. The npm preinstall check found the problem after the update had started. All came from updaters at or below 2026.10.9. Main has refused before staging since fix: reject incompatible Gateway Node before package update staging #180769. But that refusal is a 40-line wall: 5Failing checklines, recovery steps, a triage run, 3 failure JSON files and a diagnostics zip, with the instruction buried in the middle.preflight-no-good-commit. Nothing told the operator "Git ≥ X required".Low disk space … may failwarning.Reason code: global-install-failed. That code names the place where the update failed, not the reason. Their failing-check codes read[redacted-code](147) orError(126). Phase names are redacted as[redacted-command], because a step name with a space looks like a shell command.What changed
openclaw updaterefuses with oneUpdate refused: …line that says what to install or free, and changes nothing:engines.nodeand which Node is too old (the service or the updater), followed by the recovery owner's own numbered steps (profile, version-manager install, absolute launcher continuation, and the service-definition owner's step when this updater cannot refresh it). If no supported Node release satisfies the target, it says to pick a compatible OpenClaw version instead.git rev-parse --path-format=absoluteback instead of failing, soprepareGitCandidateTransfergets a wrong object directory after the service is prepared for mutation. The check runs the same Git as the updater. The updater puts its Node's directory and/usr/binahead of the shell'sPATH, so the refusal names the Git that it found.dist.unpackedSize, read with the target metadata the updater already fetches (one more field, no install measurement). The floor is 4.4× that size: for 2026.11.3 (263 MiB unpacked) a fresh global install with dependencies took 662 MiB (2.5×) and npm's cache 490 MiB (1.9×). Metadata withoutdist.unpackedSize(some mirrors) skips the check. It runs after the existing measured state-copy check (snapshot-capacity-insufficient), which now leads with its instruction line.finishUpdateRunRecordis the single place that writes a terminal update-run record. It now setsorigin.causeto one value of a closed enum (none,node-unsupported,git-unsupported,disk-full,permission-denied,network,config-invalid,install-failed,state-migration-failed,plugin-failed,service-failed,interrupted,refused,unknown). Machine facts (an npmENOSPC,EACCESor network code) win over the site code. The saved report and the auto-filed failure report printCause: …. Origin compaction keeps the enum intact, so an oversized record stays readable. The Control UI report renderer prints the stored cause and does not bundle the classifier. Because the set is closed, redaction never hides it. It is stored inorigin_json, asnextActionalready is, so there is no SQL schema change. The wire schema gains one optional enum field.Replaying the 783 auto-filed reports through the classifier gives: 271 install-failed, 129 state-migration-failed, 107 service-failed, 97 node-unsupported (before: all hidden behind
global-install-failed), 80 unknown, 27 plugin-failed, 27 refused, 15 config-invalid, 13 interrupted, 11 permission-denied, 6 network. The script reconstructs facts from the redacted text, so the real unknown share is lower: new records get their facts before redaction.Deleted / replaced
createLowDiskSpaceWarningand itsdisk-space-preflightwarning step are replaced bydescribePackageStagingShortfall.snapshot-capacity-insufficient:prefix lines in both state-copy refusals (snapshot capacity and activation backup) are gone; each now leads with itsUpdate refused: …instruction line.check= reason code) instead of a hand-built one.Failing checkdump, triage run, triage prompt, diagnostics zip and two extra failure JSON files are gone. The report file keeps every detail. Re-rendered history (update status, Control UI) keeps the existing saved-advice qualification.Production delta against
main: +301 / −45 lines (excluding the regeneratedpredicates.js, whose +2821/−2805 is renumbered check ids from adding one optional field). Tests +224 / −49, docs +27. Most of the growth is the cause map insrc/infra/update-run-cause.ts, which is data. The rest is the Git check (+32) and the refusal layout. I found no duplicate Node check to delete: the early engine check and the later activation-runtime check answer different questions (engineOnlyversus capability and identity).Rebased onto
mainThis PR was stacked on #198268. It is now one commit on current
mainplus two follow-ups, and its base ismain. The #198268 commits are gone. Againstmainas it is today:update-candidate-snapshot.ts:mainstill has both state-copy refusals (snapshot capacity and activation backup). Both now lead with anUpdate refused: …line, andstderrTailkeeps the capacity diagnostics.update-failure-public-codes.ts: keepsmain'spreflight-local-replay-conflictand addsgit-version-unsupported.update-failure-facts.ts: no overlap remains.ClawSweeper findings (review of
9fd15aa)All four P2 findings were fixed in commits after that review. This head carries the fixes, and the E2E below exercises them:
causeis inpreservedTextFieldsinupdate-run-codec.ts.update-run-ledger.test.tsround-trips an oversized terminal record through the ledger (red without the codec line: the storeddiskvalue fails validation on read).formatUpdateRecoverySteps), including the profile export and the absolute launcher. The E2E Node row shows them.no supported Node release satisfies openclaw@X's <range>. Select a compatible OpenClaw version.It does not ask the operator to install Node.opts.nextAction, neverrun.origin.nextAction. Re-rendered history keeps the historical-advice layout.update-run-report.test.tsasserts that a re-render does not announceUpdate refused.causeis an optional field inorigin_json. Records written before this change (nocause) decode unchanged. The 11.3 → head row below upgrades a real 11.3 state and reads itsupdate_runsback.ClawSweeper findings (review of
e296aa6)refreshDefinition: false), the visible block now includes the deployment-owner step before the continuation command. Before the fix, it appeared only when the package was already current. Regression test:update-command-service-plan.test.ts› "keeps the service-definition step when an early refusal cannot refresh the service". It asserts the step is in the block before the blank line, which is the part the terminal shows.Update refused:line and the capacity diagnostics, the same separator the Node producer uses. The terminal shows the instruction line, and the saved report keeps the inventory.update-command-git-snapshot.test.tsasserts the separator.Proof: real
openclaw update, exact head3eca2b8codeSetup (macOS, each scenario isolated):
ocx build --dtsand packed withscripts/package-openclaw-for-docker.mjs.[email protected]metadata from npmjs, plus this head repacked as2026.11.20and2026.11.21. Onlypackage.json/build-info.jsonversions change, plus the content-inventory entry forbuild-info.json.2026.11.21declaresengines.node: >=24.22.1 <25 || >=26.12.1. Both carry a realdist.unpackedSize.dist.unpackedSizeis thedusize of the unpacked package (344 MiB), so the floor is 4.4 × 344 MiB ≈ 1.5 GiB.env -iwith its ownOPENCLAW_PROFILE/OPENCLAW_STATE_DIRand its own LaunchAgent and port. Fault scenarios ran in parallel.update_runs(status / reason /origin.cause)openclaw update --tag 2026.11.21 --yes/readyz200⚠️ Update refused: [email protected] needs Node >=24.22.1 <25 || >=26.12.1, but the Gateway service runs Node 24.21.0 at …/24.21.0/bin/node. No changes were made., the report path, then 4 numbered steps (keep the state overrides,export OPENCLAW_PROFILE=… OPENCLAW_LAUNCHD_LABEL=…, install Node 24.22.1,node …/openclaw.mjs --profile <p> update --tag 2026.11.21)failed / preflight-node-runtime-incompatible / node-unsupportedgitreporting 2.23.0 beside the updater's Node)openclaw update --tag 2026.11.21 --yes(Git updates ignore--tag)3eca2b8)⚠️ Update refused: Git 2.23.0 at <scratch>/node-oldgit/git is too old for Git-checkout updates. Replace it with Git 2.31 or newer, then retry openclaw update. No changes were made.failed / git-version-unsupported / git-unsupportedopenclaw update --tag 2026.11.21 --yesnode_modulesholds onlyopenclaw)⚠️ Update refused: 1.0 GiB free on the volume holding /Volumes/…/prefix/lib/node_modules; this package update needs about 1.5 GiB. Free 456 MiB there, then retry openclaw update. No changes were made.failed / preflight-insufficient-space / disk-full[email protected]+ LaunchAgent)openclaw update --tag 2026.11.20 --yes✅ OpenClaw updated to 2026.11.20 (from 2026.11.3); build3eca2b8;/readyz200succeeded / – / none2026.11.20+ LaunchAgent →2026.11.21, which also exercises the Node and disk checks passing)openclaw update --tag 2026.11.21 --yes✅ OpenClaw updated to 2026.11.21 (from 2026.11.20);/readyz200succeeded / – / noneNormal update, run 1 (same setup, load average about 70): activation and
Recorded verification: service running (2026.11.21); version verified; … core readysucceeded, then the updater failedupdate-executor-settlementbecause SQLite returneddatabase is lockedwhile the CLI and the new Gateway were settling the record. The recorded cause wasunknown, because this reason has no entry in the cause map. Run 2 passed unchanged. This PR adds no database writes; the cause is computed in memory inside the existing terminal write. The same contention onmainis unmeasured.Old Git, without the shim beside Node: when the old
gitwas only on the shell'sPATH(Node symlinked from elsewhere), the updater used/usr/bin/git2.54 and did not refuse. That is the documented "the check looks where the updater looks" behavior.Wall time was measured on a shared host with a 1-minute load average of 35 to 100. Refusals took 14–46 s. The full updates took 13–23 minutes each, most of it the updater's existing runtime retention and candidate checks. The time per step was not measured.
Focused tests (
ocx test, this head):update-run-cause,update-run-ledger,update-run-report,update-check,update-runner-git-commands,disk-space,update-database-backup-space,update-command-git-snapshot,update-command-target.n1-prefix,update-command-metadata-diagnostics,update-candidate-rehearsal.resources,update-command-package-space.pnpm tsgo:core,pnpm check:test-types, oxlint and oxfmt on the changed files, andgit diff --checkpass.update-cli.target-schema.test.tsandupdate-runner-git-admission.test.tstime out or read the host agent's environment when run inside the agent shell under load. CI runs them on this head.Accepted edge cases
dist.unpackedSizecomes from one measured release; a release with a very different dependency weight shifts it. A warm npm cache needs less, so a host near the floor may be refused although it would have finished; the message names the exact amount to free. Registries withoutdist.unpackedSizeskip the check and keep the install's own ENOSPC handling.<state>.update-captures/for each refusal above, and it keeps that copy. Moving it after preflight changes initialization order, so it is left for a follow-up./usr/binbefore the caller'sPATH. An old Git that only appears later in the shell'sPATHis neither used nor flagged.engines.nodebefore staging.unknown. It is a single data table to extend.