Skip to content

fix: repair legacy config during same-version updates - #188716

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/update-invalid-config-admission
Oct 30, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/update-invalid-config-admission

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #188694

What Problem This Solves

Fixes openclaw update refusing an already-current npm installation with legacy config that Doctor can repair, unless the operator also supplied --channel.

User Impact

A plain same-version update can repair supported legacy settings, such as gateway.bind: "localhost", and continue maintenance. The normal config writer preserves the original backup. Unknown fields still fail with actionable Doctor guidance; foreign profiles retain their ownership checks.

Why This Change Was Made

Already-current updates skip candidate admission. Prepare the existing source-bound Doctor plan for the selected maintenance config before installed admission, then let the existing finalizer persist it. This reconnects the repair owner without bypassing validation or introducing options, state, or schema changes.

The masked report does not establish that its five rejected fields match this reproduction. Release 2026.10.9 still accepts agents.defaults.heartbeat; main's later heartbeat retirement uses a separate stateful Doctor migration and is outside this config-only repair. Related rather than closing the issue.

Evidence

  • RED on pinned main 81cf32d99769: the real update command with file-backed config and the actual Doctor planner/writer exits 1 for a same-version no-channel update; the explicit-channel sibling passes.
  • GREEN with the fix: four focused cases passed, covering no-channel and explicit-channel repair, byte-for-byte original config backup, unknown-key refusal with unchanged input and Doctor guidance, and foreign-profile ownership. Final wrapper wall time 77.08s, including cold worker preparation; test-file time 39.09s. Package-manager/service adapters are fixed fixtures; this is owning-command integration proof.
  • Existing candidate/installed admission controls: 15 selected tests passed, including heartbeat projection and invalid config controls (52.41s wrapper).
  • Targeted owner/test typecheck, typed lint, formatting, and git diff --check pass.
  • Fresh independent Codex autoreview (medium, P0–P2), complete local diff against 81cf32d99769 plus unchanged owner/fixture context: scoped-clean, no actionable findings. The reviewer could not execute tests in its empty sandbox. pr-simplify retained the existing planner/writer; production +14/-2 lines, net test growth 34 lines with a separate 34-line allocation for the regression and negative control. The +34 allocation matches measured growth; terminal CI classification follows.

Installed-package proof now passes on Linux x64 / Node 26.12.1 through the real installed CLI, using openclaw update --no-restart --yes --json without a channel or tag:

Installed package Result Config and backup
Published npm 2026.10.9 RED: exit 1, invalid-config; current and registry target both 2026.10.9 Original bytes unchanged
Candidate from exact 0c0d540cc23876d33d4ee977ccaab7f38925dd7d, installed over that npm prefix GREEN: exit 0, status: ok; current and target both 2026.10.9 gateway.bind: localhost becomes loopback; agents.defaults.pdfMaxBytesMb: 23 becomes pdfMaxMb: 23; canonical .bak equals the original bytes
Same candidate, plus unknownSetting: true Exit 1, invalid-config, actionable openclaw doctor --fix guidance Input bytes unchanged

The original and successful canonical-backup SHA-256 are both f0bd909915af582cb8e48aa3a41604aa47b0767607c4f9f03d00391cd760aff0. The candidate retained its exact 0c0d540 build identity after update. Its canonical package build and tarball integrity check passed, using a pinned source archive and a private copy of the worktree dependencies verified against the frozen lock. The registry's actual latest was 2026.10.9; the source package already declares 2026.10.9. No version edit, registry stub, package-target override, or admission bypass arranged equality.

Fixture prerequisite: the newly created published state needed main's existing client-credential custody migration before the positive update case could run. The existing credential-only doctor --client-credentials --fix --non-interactive --json succeeded in the disposable profile. A temporarily valid config selected the local engine; that command left its config bytes unchanged. The exact original legacy bytes were restored before update. No legacy-config Doctor repair was run as preparation. The final GREEN and negative control used that same prepared state. GREEN took 16.185s; the negative control took 16.341s. This proves the config repair and backup contract, not migration of arbitrary real user databases.

All mutable files stayed in the proof directory, with isolated HOME, npm prefix/cache, XDG directories, state/config selectors, and temp storage. Final runs used unprivileged filesystem namespaces and Landlock to hide protected host trees and service sockets, deny service executables and TCP binds, and keep normal CLI logic intact. Their syscall audits show zero successful protected-file accesses, service-command executions, or TCP binds. No Gateway started. An initial HOME-only attempt unexpectedly executed service diagnostics, inspected the host installation, and appended to a shared temp log; it is excluded from proof and documented in the local report. Intermediate temp/process-identity and credential-custody setup failures are also excluded. No further Podman or Testbox attempt was made.

macOS arm64 and the reporter's exact masked fields remain unverified. The PR is mergeable, so no rebase was needed; source and the prior independent review remain unchanged.

The first full-file local attempt passed 14 cases but its wrapper rejected changed input bytes during formatting; the frozen full-file rerun timed out on the loaded host after 12 passing cases. Only the final frozen four-case run above is claimed as final touched-contract proof. No issue comment, release, live Gateway change, prepare, or merge.

Exact-head CI 41132188644 reached terminal failure on unchanged head 0c0d540cc23876d33d4ee977ccaab7f38925dd7d. Changed Node tests, type checks, lint, and all three PostgreSQL conformance shards passed. The only underlying failure was baseline ratchets / test-lines: total 6,310,666, ceiling 6,309,597, overage 1,069, net growth +34. The +34 allocation matches this PR's +34 lines, leaving the base's absolute debt unchanged. The aggregate openclaw/ci-gate also failed because of that ratchet result; the other executed checks passed.

Base evidence is qualified: the exact prepared base's push run skipped this job after a security-fast failure. The current hourly main ratchet job explicitly reports 1,041 lines of existing ceiling debt and passes only because its net growth is zero. The automatic classifier calls the PR failure new because that main job passed; manual inspection shows positive growth exposing existing ceiling debt, with no new allocation deficit. This is not a same-exit baseline match or a passing gate. No allocation enlargement, scalar change, unrelated test deletion, ignore, rebase, prepare, or merge was performed.

The maintainer accepted this inherited-debt exception at 22:06Z (same precedent as #188560). The ratchet and aggregate gate remain red; no budgets, ignores, or tests were changed for that failure. The existing hosted review has no code findings; its posted installed-CLI proof hold predates the evidence above. No fresh hosted review was requested.

Work sessions

Credit: @steipete; the existing commit retains the requested human Co-authored-by trailer.

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S labels Oct 30, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 30, 2026 21:35
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Prepare the existing Doctor repair plan before same-version update admission, including updates without an explicit channel.

Example: Run openclaw update without --channel when the installed version is current and gateway.bind is "localhost".

  • Before: Admission rejects the repairable legacy configuration as invalid.
  • After: Doctor converts the binding to "loopback", preserves the original configuration backup, and update maintenance continues.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch has no actionable source finding, but the required installed upgrade evidence is absent and the exact-head CI failure remains unattributed.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: A plain same-version update rejects legacy settings that the existing Doctor owner can repair.
Reason: The maintainer-authored direction restores existing update maintenance behavior without options or new ownership; it appropriately avoids claiming to resolve every masked field in the linked report.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored PR repairs a source-confirmed same-version update failure that remains on current main; no introduced correctness defect was found.

Priority: P2
Reviewed head: 0c0d540cc23876d33d4ee977ccaab7f38925dd7d

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a redacted installed-CLI stable-to-candidate run showing no-channel repair, original backup preservation, intact settings and data, and unchanged unknown-key refusal.
Agent review details

How this fits together

The CLI updater selects the caller or managed-service configuration, validates it through admission, and passes a source-bound Doctor plan to the existing locked configuration writer before plugin maintenance.

flowchart TD
  A[Update CLI] --> B[Select installation and profile]
  B --> C[Inspect managed service]
  C --> D[Preview Doctor repair]
  D --> E[Validate source and admission]
  E --> F[Write repair and backup]
  F --> G[Continue plugin maintenance]
Loading

Technical review

Best possible solution:

Use the existing source-bound Doctor planner during same-version admission and retain the existing locked writer, backup flow, and profile checks.

Do we have a high-confidence way to reproduce the issue?

Current main exposes the missing no-channel plan before installed admission, and the PR records a matching base-red/head-green command integration; this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: prepare the missing plan at the existing admission boundary while preserving validation, source identity, profile selection, and persistence ownership.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 899e74744d88.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1794d8b adds src/cli/update-cli/update-command-database-context.ts:171 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1794d8b4ef8d; files: src/cli/update-cli/update-command-database-context.ts)

PR surface

Source +12, Tests +34, Docs +5, Other +2. Total +53 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 14 2 +12
Tests 1 79 45 +34
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 100 47 +53

Review metrics

Metric Value Why it matters
Production versus regression growth Production +14/-2 lines; tests +79/-45 lines The focused production handoff reuses existing owners; net test growth adds no-channel repair and refusal controls with a matching 34-line allocation.

Labels

Label changes:

  • add P2: Supported legacy configuration can block same-version CLI maintenance, with an existing Doctor recovery path and limited scope.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Supported legacy configuration can block same-version CLI maintenance, with an existing Doctor recovery path and limited scope.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 5:52 PM ET / 21:52 UTC.

@roboclaw-bot
roboclaw-bot merged commit 3f94ecd into main Oct 30, 2026
251 of 255 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/update-invalid-config-admission branch October 30, 2026 22:46
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant