Skip to content

fix(config): keep last-known-good when the observer flags the config as truncated - #152565

Merged
RomneyDa merged 14 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-152509-config-lgg-promotion
Oct 22, 2026
Merged

RomneyDa merged 14 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-152509-config-lgg-promotion

Conversation

@LiuwqGit

@LiuwqGit LiuwqGit commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted: yes

Closes #152509

Original implementation and regression coverage: @LiuwqGit, preserved in the existing PR ancestry. Current-main integration and additional qualification continued in the linked sessions.

Work sessions

What Problem This Solves

Fixes: a parseable external truncation of openclaw.json can replace the healthy recovery backup during Gateway startup or reload, causing Doctor to restore the truncated configuration instead of the operator’s settings.

User Impact

User impact: suspicious external truncations no longer overwrite the healthy recovery copy, including after an ordinary accepted edit of an already-truncated file. Intentional accepted edits from healthy input, including formatting-only reductions, remain recoverable. No new settings, schema changes, or migration are introduced.

Why This Change Was Made

Promotion reuses the observer’s suspicion predicate before publishing recovery bytes. Accepted writes advance the existing worker-backed health baseline, and failed runtime activation conditionally restores the pre-publication baseline. The baseline owner now also checks the write’s input snapshot: a permitted edit is not permission to bless a suspicious reduction that happened earlier. Rollback compensation is retained even when the baseline cannot advance.

The current-main integration preserves database-free writes, current source guards and rejection diagnostics. Existing promotion/rejection splits satisfy line budgets; there is no new recovery/state owner or persisted format. The earlier metadata-only anomaly repair added the input-snapshot guard and its regression. The latest cleanup consumes the existing health worker’s applied/conflict/unavailable result instead of rereading successful writes. Only confirmed conditional conflicts retry; unknown outcomes do not replay bookkeeping.

Evidence

Doctor consumer repair and test cleanup (October 22)

Current head: 503add5d6248de636fed75183c7db61e5500ef3c; tree 024eb0b9c9f7dc49a9f8812583e7d9def88f84b3. Two ordinary fast-forward commits preserve e0a636a and the original contributor ancestry. No production, schema, state, or persistence changes in this follow-up.

The failed commands-doctor type leaf was PR-caused: one Doctor test wrapper discarded the new owner's return value. d6b4ea3 returns the actual updateAfterFileCommit result without casts, suppression, or weakening assertions/race injection. The same leaf reproduced TS2345 on e0a636a (exit 2, 13 s) and passed with the repair (14 s); all seven affected Doctor tests passed (48 s wall), targeted lint had zero warnings/errors, and format/diff checks passed. A repository-wide override audit found no other discarded-result override. Fresh independent P0–P3 scoped review found no actionable issue. RED receipt · GREEN and normal-hook receipt.

503add5 also addresses the review's low-value-test note: it removes the self-derived fingerprint-key SQL comparison and describes the synthetic case as stored-row continuity, not historical upgrade proof. The promotion, truncation, compensation, and explicit schema-column assertions remain. That single affected case passed (496 ms test time / 42 s wall; 14 other cases unselected), matching config-cli types passed (16 s), and targeted lint, format, and diff checks passed. Cleanup proof and normal-hook receipt.

Both commits were created normally with the canonical Git hook on secretless AWS runners and imported unchanged; parent/tree, raw commit digests, author, and human co-author trailers were verified. Runners are released with cleanup complete. Settled owner suites, Doctor proof, and actual released-install upgrade evidence were retained at their original revisions—not replayed or relabeled. The small deletion/wording follow-up received source inspection rather than another full review.

Current-head CI and review (503add5): the exact-head review, completed 2026-10-22T04:27:28.368Z, accepts both follow-ups and retained product/upgrade proof: Before merge: None; Findings: None; ready for maintainer review. CI 39721647047 is nevertheless failed, not green: all 82 jobs are terminal (51 successes, 29 skips, one source-test failure plus its downstream aggregate-gate failure). The previously failing commands-doctor type job now passes.

The sole source failure is the tooling owner-plan assertion for operator-authority.test-support.ts: it expected no extra owner files but selected src/auto-reply/reply/commands-plugin.native-subagents.test.ts. That same file and assertion independently fail on PR #180279's job, inspected directly rather than inferred from review text.

Attribution: this CI tested merge 95207cadfb6a921e10e3dd5a494c366a638b3747, with base 87feb0f and PR parent 503add5. The unexpected native-subagents test directly imports the operator-authority fixture and was added to ancestral main by #180173 (7ba05b6). The failing expectation omits that consumer. The assertion, planner, inventory, consumer/helper, Vitest configuration, and dependency inputs are unchanged between the tested base and this merge; this PR's added files are config-owned and do not create that direct importer. This is source-derived inherited-failure attribution plus a matching independent PR execution, not a separately executed exact-base replay or a passing CI claim. No CI rerun, main refresh, test suppression, or unrelated repair was performed. This evidence-only update changes no source or behavior-proof input; no duplicate review request is needed.

Health-write outcome cleanup (October 22)

Previous head: e0a636a; tree 882871e7ee3a66d75aaba5e6f8b1a3d21a5c4d60. This is a normal fast-forward commit over 6c35cfe, preserving @LiuwqGit’s original implementation and ancestry.

Addresses the architecture finding: the existing health owner now returns applied / conflict / unavailable. Successful writes stop immediately. Only an actual conditional-write conflict refreshes and retries within the existing four-attempt bound; failed reads and uncertain writes stop with the existing warning/error policy. Both post-write verification-read branches are removed. Pre-publication capture, newer-baseline/anomaly decisions, hash-bound inherited loss and candidate-specific rollback compensation remain.

Persisted state: no schema, table, field, store, migration, retention, durability or permission change. Existing health state and backup bytes retain their owners. This cleanup reduces production code by two lines; it does not add another state mechanism.

Changed-path proof: secretless AWS Linux runner, Node 24.21.0 / pnpm 12.12.1, isolated HOME, repository-owned test/static wrappers. Ten selected regressions fail on unchanged base production. The two owning test files then supply 46 passing cases; an incorrect rollback work-count expectation was corrected and separately proved red on base (7 reads) and green on the fix (5 reads), covering all 47 owner cases across retained receipts—not a later single all-green run. Seven selected recovery/async-load consumer cases also pass. Successful accepted writes now perform two health reads (capture + transition) rather than three; a real intervening observation yields conflict then applied; failed read, failed write and lost reply cases do not retry. Existing backup-promotion and rollback assertions remain in the exercised owner flow.

Matching config-cli types, five-file lint (zero errors/warnings), six-file format, and diff checks pass. The broad changed-path compiler planner selected unrelated graphs and hit existing root-budget limits; it was stopped, and the matching config leaf passed directly. No broad compiler success is claimed. An introduced test-parameter shadowing error was corrected before the final static gates.

Fresh independent complete-context review of the local delta completed with no actionable findings; the sole subsequent change was that mechanical test-parameter rename. pr-simplify completed. The canonical pre-commit hook passed during an ordinary secretless Git commit; the commit was imported byte-for-byte and its object checksum, tree, parent, author and required human co-author trailer were independently verified. Both proof runners are released.

Proof: base RED, owning-file results, corrected rollback RED/GREEN and affected consumers, final static gates and ordinary commit.

Historical e0a636a CI and review: CI 39718795893 failed on the PR-caused Doctor wrapper return mismatch, with a downstream aggregate-gate failure. ClawSweeper accepted the architecture cleanup and retained product proof, found no production-code defect, and requested CI attribution plus the redundant-test cleanup. Both are addressed in the follow-up above. Green 6c35 CI/review and prior real CLI/released-install upgrade runs retain their original revision scope.

Recovery-parser conflict integration (October 22)

Previous head 6c35cfeeb2e329e0ead8ecf17fbae2a0fdbdbe5c (tree 5bc3802a11406efe442d8ff4bc76f5499527cec7) preserves published 1874fd0794c545123ab0ec915fb54b72e37f6bb6 as first parent and integrates pinned main 3282fda7943c9fdd7a6778289521cbfc1bd048db as second parent. Main's #179952 narrowed the private recovery dependencies and switched backup parsing to the imported JSON5 owner, causing a reproduced conflict in io.observe-recovery.ts. This is an actual conflict repair, not a refresh merely for main drift. Original @LiuwqGit ancestry remains intact.

The resolution keeps main's direct JSON5 parser and all three updated parser calls, while retaining this PR's exported dependency type, separate guarded promotion owner, and suspicious-signature input. The promotion fixture drops the retired parser injection and unsafe cast. Existing backup/last-good cases now include authored JSON5 comments/trailing commas and verify exact restored bytes. No new test cases, production control flow, schema, permission, dependency, or public API were added. Other automatic merges remain unchanged.

Changed-input qualification: one secretless AWS runner, Linux x86_64, Node 24.21.0, pnpm 12.12.1, frozen lockfile, isolated HOME and no instance credentials (IAM endpoint 404). Exact source tree was checked before and after validation. Each selected file ran through pnpm test src/config/<file>.test.ts --maxWorkers=1:

File Passed Vitest duration Command wall
io.observe-recovery 32 56.49 s 60 s
io.snapshot.promotion 12 47.96 s 51 s
io.factory 7 32.49 s 36 s
io.snapshot.recovery 22 51.04 s 55 s
io.read-helpers 2 0.987 s 3 s

All 75 affected tests passed. Coverage includes JSON5 backup/last-good restoration, promotion refusal after observed truncation and metadata stamping, accepted-write rollback, source guards, prepared recovery, and read/write consumers. Cold worker preparation accounts for about 24–25 seconds of each runtime-config invocation; those durations are not test-body costs.

Seven-file lint reports zero warnings/errors (96 s including SDK preparation); three-file format and diff checks pass. Narrow typecheck passed (2 s) after correcting only the temporary proof config's rootDir and inclusion of canonical ambient declarations. The earlier configuration errors remain setup failures, not product defects or green runs. pnpm docs:list completed. pr-simplify retained one parser and one promotion owner without new scaffolding.

Independent complete-context autoreview of the relevant integration completed all three P0/P1 passes with no actionable findings (69.148 s), followed by source verification. An earlier split-context pass disclosed its limitations; the complete-context continuation supersedes that review gap. Unchanged fs-safe and health-store internals were not independently re-reviewed, and no full-PR P2-clean claim is made.

Normal commit and recovery: ordinary Git commit invoked the canonical pre-commit hook inside the real secretless merge and exited 0, preserving the exact tree and both parents. The resulting commit object was imported byte-for-byte into the retained local worktree; contributor code/hooks were not executed on the credentialed host. An initial diagnostic hook attempt rejected stderr trace output; directing the trace to a private file removed that observation interference without weakening the hook. The runner was confirmed destroyed and the worktree is clean. The interrupted attempt's outer execution receipt and workspace were unavailable; no success was inferred from elapsed time. Missing current-tree proof was then completed with retained terminal receipts. Previously settled 202-test, source-CLI, and released-install upgrade proof was not broadly replayed.

Prior-head CI and review (6c35cfe): CI 39699025060 completed successfully on 6c35cfeeb2e329e0ead8ecf17fbae2a0fdbdbe5c: all 83 jobs are terminal, with 54 successes, 29 skips, and zero failures. The aggregate CI gate and applicable dependency/security reviews also passed. The exact-head ClawSweeper review, reviewed at 2026-10-22T00:27:34.806Z, reports Before merge: None; Findings: None; ready for maintainer review. It explicitly accepts reuse of the prior real CLI/upgrade evidence across this parser integration. Its CI-pending wording predates the now-completed run. This CI-status-only body update changes no source or behavior-proof input.

Prior 1874fd0 CI 39409117521 / gate 39410358141 and its installed upgrade/CLI runs retain their original revision scope. This resolution preserves recovery behavior and uses affected real-owner boundary checks; it does not claim a new full installed upgrade, live-provider turn, or new permissions/migration behavior.

Prior-head source-CLI qualification: passed on 1874fd0

The final qualification used unchanged commit 1874fd0794c545123ab0ec915fb54b72e37f6bb6, tree 695917732874ab2ff5ca5bd1b017f8f10502f1c4. One wholly synthetic private profile (p0152509qualification) and one fixture were used throughout; no state or credential copies were introduced. The runtime/UI preparation and identity checks remained enabled. This successful run supersedes the earlier incomplete Doctor attempts retained below.

Healthy Gateway: ready; 461-byte baseline (<512); backup preserved.
Metadata-only truncation: observed; promotion refused; backup preserved.
Ordinary CLI config edit: exit 0; metadata stamped; backup preserved.
Edited Gateway restart: new process; inherited anomaly retained.
Full Doctor --fix --non-interactive: exit 0; Doctor complete.
All original fields preserved; healthy recovery backup byte-exact.
Cleanup: three clean Gateway shutdowns; fixture removed; lease released.

The active configuration retained all original fields; byte-exactness was checked for the healthy recovery backup. The final source-CLI path is now qualified, including full Doctor completion—not merely a restoration log before a later refusal. No source/test/review/commit replay was needed: the existing 202 affected tests, scoped checks, independent review and exact-head CI remain their recorded evidence, not new runs.

The earlier copied fixture correctly failed because its credential receipt was bound to the original database path/device/inode; archive extraction changed the inode. The other harness error treated a persistent build-lock container directory as active lock ownership, instead of inspecting its existing owner.json. A correctly provisioned private fixture, normal preparation and three clean shutdowns resolved the setup problems without changing product source, disabling identity checks, hydrating real credentials or bypassing a guard.

Released-install upgrade qualification: passed on unchanged candidate. The previously outstanding actual 2026.10.5 installation-to-candidate upgrade is now qualified on head 1874fd0794c545123ab0ec915fb54b72e37f6bb6: the public npm release [email protected] (1b58cb9) established the settings (gateway mode/port/token, 70 trusted proxies, logging level, update channel), the config_health_entries health row, and the byte-exact healthy recovery copy in an isolated synthetic state dir (no real credentials). The candidate build then took over the same state dir: it completed the standard upgrade migration via doctor --fix --non-interactive (exit 0, purely additive config change, health baseline advanced through the new accepted-write path using the released-build-written row), booted the Gateway healthy, never promoted a 41-byte external truncation stub into the recovery backup, and restored full settings via Doctor (exit 0) with the recovery bytes byte-identical throughout. PRAGMA table_info(config_health_entries) is unchanged — the same five columns the release created, no schema or migration in either direction. Full redacted transcript: follow-up comment on this PR.

Released-install upgrade proof fields

Real environment tested: yes — actual public npm release [email protected] (1b58cb9) installed from the registry, then upgraded in place to a local build of head 1874fd0794c545123ab0ec915fb54b72e37f6bb6 on Linux; isolated synthetic state dir and synthetic token only, no real credentials.

Exact steps or commands run after this patch: released CLI config set/config patch to establish settings → released gateway run (health OK) → clean shutdown → candidate --version/config get over the same state → candidate gateway run (blocked by the standard client-credential migration admission) → candidate doctor --fix --non-interactive (exit 0, migration complete) → candidate gateway run (health OK, healthy promotion) → clean shutdown → 41-byte parseable truncation stub written externally → candidate gateway run (stub never promoted; startup recovery restored settings) → clean shutdown → stub rewritten → candidate doctor --fix --non-interactive (exit 0, restored from last-known-good).

Evidence after fix: redacted terminal transcript (copy-pasted from the actual runs; path shortening only) below.

Released 2026.10.5 (1b58cb9) baseline: openclaw.json 2108 B (sha b4b3fc71…),
  .last-good 2108 B byte-exact (sha b4b3fc71…), health row hash=b4b3fc71… bytes=2108.
Candidate 1874fd0794c takes over same state dir:
  config get: gateway.mode=local, auth.mode=token, logging.level=info,
  update.channel=stable, trustedProxies=70 intact.
  doctor --fix --non-interactive: exit 0 “Doctor complete”; migration additive-only;
  health row advanced in place (hash→77798120…, 3973 B) via the new accepted-write path;
  .last-good file bytes untouched by the migration write.
  gateway run: Gateway Health — OK (2ms); healthy promotion .last-good→3973 B.
41-byte stub while gateway down → gateway run: stub never lands in .last-good;
  startup recovery restores settings (token + 70 proxies preserved); clean shutdown.
41-byte stub again → doctor --fix --non-interactive: exit 0 “Doctor complete”;
  config restored 3973 B, trustedProxies=70; .last-good byte-identical (3fc99ce4…) throughout;
  config validate: “Config valid”.
PRAGMA table_info(config_health_entries): unchanged five columns after all candidate writes.

Observed result after fix: the upgraded installation preserved settings, health state, and healthy recovery bytes end to end; the external truncation stub never replaced the recovery backup at any point (gateway startup or Doctor), and the released-build-written health row loaded and worked under every new code path (observation, promotion, accepted-write baseline advance, Doctor recovery) with no schema change.

What was not tested: an authenticated real-model turn (the checkout stayed secretless); real channel credentials; non-npm distribution formats (native installers, Docker images); EACCES/permission-recovery upgrade paths.

Prior metadata-only anomaly repair: 1874fd0

Current descendant: 1874fd0794c545123ab0ec915fb54b72e37f6bb6 (tree 695917732874ab2ff5ca5bd1b017f8f10502f1c4), a fast-forward descendant of 1febae496e47c6bda828c949da9f6a6f0543966a. The existing hash-bound health marker now carries suspicious input through automatic metadata stamping, later reads and promotion. Consecutive accepted edits preserve the anomaly; rollback restores the writer-owned prior marker. Metadata stamping is not restoration of lost user settings. Healthy intentional reductions remain supported. No new state owner, setting or schema.

  • The exact metadata-only regression was red on the published parent, then green with the repair. 202 tests across eight affected files passed, with targeted type, lint, format, line-cap and whitespace checks.
  • Fresh independent review completed with zero actionable P0–P2 findings. The signed commit, contributor ancestry, required human trailer, exact tree and whitespace were checked before publication.

Earlier partial source-CLI attempt (superseded by the successful qualification above), using isolated synthetic configuration:

Healthy Gateway ready: 386-byte baseline (<512); backup preserved.
Metadata-only truncation: anomaly observed; promotion refused.
Ordinary config set: exit 0; metadata stamped; backup preserved.
Edited Gateway restart: ready; inherited anomaly retained; backup preserved.
Doctor: restoration from last-known-good logged.
Overall Doctor: exit 1 at a later credential/database identity refusal.

Historical setup failures, now resolved: those earlier receipts remain failed attempts, not green runs. The final qualification above uses one correctly provisioned private fixture and completes full Doctor with exit 0, while preserving the identity checks. No product source or passed test/review was replayed.

Prior-head CI completed with a successful CI gate on 1874fd0794c545123ab0ec915fb54b72e37f6bb6 (aggregate gate). The fresh ClawSweeper review on that same head reports no actionable code findings; the final source-CLI Doctor gap is now closed by the successful run above. Actual released-install upgrade/compatibility proof is now provided above ("Released-install upgrade qualification"); the earlier limitation no longer applies. Earlier 1febae… CI attribution below applies only to that prior head, not to this descendant.

  • New review regression, red then green: on tree a79290962703690187d4375687dce72f9ae75c0e, the production config IO flow (healthy promotion → external truncation retaining metadata/mode → observed anomaly → ordinary accepted port edit → promotion) incorrectly returned true and could poison the backup. With this repair it refuses promotion, preserves the healthy bytes, and later recovery restores them. No mocked owner decisions.
  • Final source tests: four affected config files, 152 passed, 96.40s Vitest duration. New regression 915ms (red 1,050ms); includes intentional size/format reductions, rollback, concurrent observation, database-free writes and pre-upgrade health-row compatibility. Targeted config-cli types, lint, formatting, changed-source line-cap and base-relative whitespace checks passed.
  • Fresh independent review: same-host Codex review, 5/5 completed passes, zero actionable P0–P2 findings on final tree 7c346d20560f403643ed15cd0a10ee9eda38e594. The earlier P2 is fixed. The temporary-directory alias warning is nonfatal; no host/model/auth-route change or isolation bypass was used.
  • Reused native Gateway/Doctor proof: healthy boot created a 2,239-byte recovery copy; external truncation was observed and refused during reload; a second real boot with a 41-byte stub retained the healthy backup. Doctor --fix --non-interactive exited 0, preserved every original configuration field (including 70 trusted proxies), and retained byte-exact healthy recovery bytes in .bak. Doctor added normal meta.migrations, skills and wizard fields, so final live JSON is not byte-identical. This native evidence predates the final accepted-write repair; unchanged startup/recovery owners reuse it, while the changed write path has the new red/green production-owner regression.
  • Reused wrapper/import proof: eager-import-closure.test.ts and pr-worktree-provision.test.ts, selected shards 19 + 19 + 16 passed, 1 skipped. The final repair adds no imports or wrapper-closure changes.
  • Documentation: changed page formatting and MDX checks passed. Markdownlint invocation selected zero files and is not additional coverage.
  • Inherited max-lines result: full scan reports three UI suppressions already in pinned base ce3f47b60a55d9302c70936c680319a039a68eed; those files and the baseline are unchanged. No suppression/baseline exception added.

Published candidate: signed author-preserving merge commit 1febae496e47c6bda828c949da9f6a6f0543966a, tree 7c346d20560f403643ed15cd0a10ee9eda38e594, parents original contributor head d6910cf27cac610ab1ce31ad6c9d06a618b3d6fa and pinned main ce3f47b60a55d9302c70936c680319a039a68eed. Existing remote-head CI has 90 successful, 53 skipped and 1 neutral check runs with successful openclaw/ci-gate; that is old-head evidence. Fresh CI is required after publication.

Gaps: no authenticated real-model turn (contributor checkout stayed secretless); the previously missing latest-stable installation upgrade proof is now provided above ("Released-install upgrade qualification"). No source/credential exception requested or used.

Proof: new regression red, 152 tests and focused gates, documentation checks, prior Gateway restart, prior Doctor recovery.

Prior-head CI attribution (809 matching diagnostics)

On head 1febae4, CI 39398684324 fails only its core production-type leaf (job 118548953798) among the CI build/test checks. The completed job log contains the same 809 compiler diagnostics as independently executed clean main 37e60af and the repaired archive integration. The comparison normalizes only checkout-root paths; every diagnostic and order match. This run's actual merge base is 2e41793, not the executed older main: the compiler configuration, package/lock, offending helper and SDK browser entry are unchanged between those bases. This is signature-based inherited-failure attribution, not a new execution of the newer main.

Main's src/gateway/chat-display-replay.test-support.ts imports Control UI consumers into the Node-only core compiler graph, producing the DOM/JSX errors. This PR does not change that helper or compiler policy. The check remains failed; no rerun, suppression, broad compiler-library change or merge bypass was used. Superseded cancelled context jobs have a later successful context/evidence run.

The metadata-only accepted-write backup-poisoning P1 below the 512-byte size threshold was unresolved on prior head 1febae…; descendant 1874fd0… repairs it with the final source-CLI result and remaining upgrade gap recorded above. Inherited CI attribution does not close those qualification gaps.

@clawsweeper

clawsweeper Bot commented Sep 19, 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.

@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Prevent suspicious configuration truncations from replacing healthy recovery backups while preserving intentional edits and rollback.

Example: A healthy configuration with 70 trusted proxies is externally replaced by a 41-byte gateway stub.

  • Before: Startup can replace the healthy backup with the stub, leaving Doctor unable to restore the settings.
  • After: Promotion refuses the stub, and Doctor restores the original settings from the preserved backup.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Useful, complete recovery repair with shipped-entry-point and released-install evidence; previous blockers are fixed, while exact-head CI admission remains unsettled.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Supplied Linux CLI/Gateway transcripts exercise truncation refusal, ordinary edits after metadata-only loss, restart, and successful Doctor recovery; the released v2026.10.5 upgrade preserves settings and recovery bytes. These runs retain their original 1874fd0 scope, with later parser and health-outcome changes supported by focused owner regressions. The two inspected UI images are unrelated and receive no proof credit.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Doctor can report successful recovery while restoring a truncated configuration because startup replaced the healthy backup.
Reason: Protecting the existing recovery contract has clear user value, and the change adds no configuration option, schema, or competing state owner.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current configuration-loss bug, and the previous review blockers are resolved; the remaining failed CI assertion independently matches another PR.

Priority: P0
Reviewed head: 503add5d6248de636fed75183c7db61e5500ef3c

Before merge

None.

Findings

None.

Agent review details

How this fits together

Config I/O observes on-disk configuration, records health fingerprints through the existing database worker, and supplies recovery backups to Gateway startup, reload, and Doctor.

flowchart TD
  A[Config file] --> B[Config I O owner]
  B --> C[Health worker]
  C --> D[Suspicion check]
  B --> D
  D --> E[Last known good backup]
  E --> F[Gateway and Doctor recovery]
Loading

Technical review

Best possible solution:

Land the shared promotion guard and existing-owner baseline compensation once CI admission is resolved.

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

Current-main source shows the unguarded overwrite, and the linked issue supplies a concrete healthy-config-to-stub reproduction; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The fix belongs in the shared promotion owner; accepted-write baseline advancement and conditional compensation are necessary to preserve intentional reductions and failed-activation rollback.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 71a8363f9606.

Provenance checked

  • Last-known-good promotion and recovery keeps the original intent (ffb1628: Recover invalid Gateway configurations using healthy recovery copies.)
  • Shared suspicious-config predicate keeps the original intent (72628f9: Deduplicate observation suspicion checks between config paths.)
  • Worker-backed conditional health updates keeps the original intent (feat(config): offload async health and audit persistence #147256: Offload asynchronous health persistence while preserving conditional updates, ownership refusals, and committed file outcomes.)
  • Captured reads and health settlement keeps the original intent (refactor(config): simplify captured reads and cached admission #175077: Remove redundant observation lifecycle bookkeeping while retaining persisted-row comparison and final-effect ownership checks.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ffb1628 adds src/config/io.observe-recovery.ts:1003 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ffb1628727fd; files: src/config/io.observe-recovery.ts)
  • Vincent Koc: Raw commit 72628f9 adds src/config/io.observe-suspicious.ts:29 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 72628f906b9e; files: src/config/io.observe-suspicious.ts)

PR surface

Source +358, Tests +973, Docs +11, Other +1. Total +1343 across 18 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 10 474 116 +358
Tests 5 983 10 +973
Docs 2 12 1 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 18 1470 127 +1343

Review metrics

Metric Value Why it matters
Production versus test changes Production +474/-116 lines; tests +983/-10 lines Production growth protects intentional reductions, inherited truncation, and rollback through existing owners; tests cover distinct recovery, conflict, unavailable-outcome, and rollback failures.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P0: The current bug can overwrite the only healthy recovery copy and permanently lose configuration settings.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (25 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-06T07:25:10.369Z sha 679161495de7d8386be6c1c5992af636150fb77b :: needs maintainer review before merge. :: none
  • reviewed 2026-10-06T08:31:18.683Z sha d6910cf :: needs maintainer review before merge. :: none
  • reviewed 2026-10-20T09:18:50.911Z sha 1febae4 :: needs real behavior proof before merge. :: [P1] Preserve input anomalies when writer stamping removes their signal
  • reviewed 2026-10-20T10:43:27.010Z sha 1874fd0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T11:06:41.543Z sha 1874fd0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T12:11:56.440Z sha 1874fd0 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-22T00:27:34.806Z sha 6c35cfe :: needs maintainer review before merge. :: none
  • reviewed 2026-10-22T03:56:08.979Z sha e0a636a :: needs changes before merge. :: none

Reviewed October 22, 2026, 12:27 AM ET / 04:27 UTC (Revision 26).

@LiuwqGit
LiuwqGit force-pushed the feat/issue-152509-config-lgg-promotion branch from 1a75103 to 5432b70 Compare September 19, 2026 05:57
@LiuwqGit

LiuwqGit commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Follow-up for the review finding "[P1] Preserve promotion after explicitly permitted size reductions" — addressed in 3cacef5.

What changed: when the config owner accepts a write that was explicitly permitted to shrink the config (allowConfigSizeDrop: true, as used by doctor legacy repair and plugin uninstall), the writer now advances the last-known-good health baseline right after the commit — but only when the size drop is the only remaining anomaly vs the old baseline. Stub-shaped results (missing meta, missing gateway mode, update-channel-only root) keep the older baseline, so an external truncation that never went through the writer still cannot replace the trusted backup.

Where: advanceConfigHealthBaselineForAcceptedSizeDrop in src/config/io.observe.ts (reuses the observer's own suspicion predicate), called from the accepted-write path in src/config/io.write.ts. promoteConfigSnapshotToLastKnownGoodCore is unchanged. The rejected-write block moved beside its guard into src/config/io.write-safety.ts (rejectConfigWriteForBlockingReasons) without behavior change, to stay within the line-cap ratchet.

Regression coverage (advances last-known-good after an accepted intentional size-drop write, src/config/io.observe-recovery-promotion.test.ts, driven through the production createConfigIO owner with real files and the real health-state database):

  1. healthy large config promoted → .last-good holds it;
  2. accepted allowConfigSizeDrop reduction → next promotion now succeeds and .last-good advances to the reduced config (this step failed on the previous revision with expected false to be true);
  3. external truncation stub afterwards → promotion still refused, .last-good untouched.

Local verification on this head: full src/config/io.write-config.test.ts (222 tests), io.observe-recovery.test.ts + io.observe-recovery-promotion.test.ts + io.write-reread.test.ts + io.eacces.test.ts + io.snapshot.recovery.test.ts (320 tests across the writer/recovery lanes), plus oxfmt/oxlint/tsgo:core, check:max-lines-ratchet, check:line-cap-ratchet, and check:assertion-safety against origin/main — all green. CI lanes pending on this head.

@LiuwqGit
LiuwqGit force-pushed the feat/issue-152509-config-lgg-promotion branch 3 times, most recently from 3cacef5 to 0df8ba9 Compare September 19, 2026 09:34
@LiuwqGit

LiuwqGit commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Follow-up for the "[P1] Preserve promotion after accepted formatting reductions" finding and the CI failures (checks-node-compact-small-33, checks-fast-baseline-ratchets, checks-node-compact-large-12) — addressed in 299139b (rebased onto current main).

Formatting-reduction fix: the baseline advance no longer requires allowConfigSizeDrop plus a writer-recorded size-drop: reason. It is renamed to advanceConfigHealthBaselineForAcceptedWrite (src/config/io.observe.ts) and advances the last-known-good health baseline after any write the config owner accepted — including ordinary edits whose raw-byte shrink comes only from serialization normalization (BOM, deep indentation), where the writer's canonicalized size baseline sees no drop while the health fingerprint counts raw bytes. Stub-shaped results (missing meta, missing gateway mode, update-channel-only root) still never advance, and external truncations never go through the writer at all, so they remain rejected.

Regression coverage for the requested scenario: promotes an accepted formatting normalization over the verbose baseline (src/config/io.snapshot.recovery.test.ts) drives the verbose-BOM lane end-to-end: promote the 4771-byte verbose snapshot → accepted port edit rewrites it as a 2142-byte canonical file (raw bytes drop below half through serialization alone) → next promotion succeeds and .last-good holds the edited canonical config → a later 62-byte external truncation stub is refused → recovery restores the edited canonical config byte-for-byte. The post-acceptance promotion failed on the previous head with expected false to be true (RED verified before the fix). The equivalent extension of the io.write-config.test.ts verbose-BOM fixture is not possible: that file is at 4437 counted lines against a 1000 cap with a no-growth ratchet (checks-fast-baseline-ratchets), so the promotion/recovery continuation lives in the promotion suite instead, which covers the same production code path.

CI failure root causes fixed:

  • checks-node-compact-small-33: the promotion test file had pushed the config-cli tsgo shard to 701 test roots (700 cap). The suite is folded into the existing io.snapshot.recovery.test.ts (same coverage), restoring 700 roots; the shard guard passes on this head.
  • checks-node-compact-large-12: io.factory.test.ts > honors per-call unobserved mutation reads without disabling write auditing pinned the old contract that accepted mutation writes leave the health row untouched. Updated to the new contract: the last-known-good baseline lands right after the accepted write, the anomaly marker stays cleared, and the remaining observation facts still refresh only on the next observed read. Write auditing itself is unchanged.

Data-model compatibility: no schema change — the health state keeps using the existing config_health_entries columns (last_known_good_json, last_promoted_good_json, last_observed_suspicious_signature_json); src/config/io.health-state.types.ts is byte-identical to origin/main. Older rows without a baseline leave promotion unguarded until the next healthy promotion, exactly the origin/main behavior.

Local verification on 299139b: io.factory.test.ts + io.snapshot.recovery.test.ts + io.write-config.test.ts (254 tests) and io.observe-recovery.test.ts (all green), check-max-lines-ratchet + check-line-cap-ratchet against origin/main, the shard-root guard, plus oxfmt / oxlint / tsgo:core. CI lanes pending on this head.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 19, 2026
@LiuwqGit
LiuwqGit force-pushed the feat/issue-152509-config-lgg-promotion branch 2 times, most recently from 299139b to 293baac Compare September 20, 2026 05:13
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

CI failure root cause (checks-node-compact-large-9 / core-unit-src-security-3): the three src/sessions/session-lifecycle-diagnostics.test.ts failures (expected 1 to be +0 at the vi.getTimerCount() afterEach assertion) are not caused by this PR's config changes — they are a pre-existing cross-file interference in the unit-src shard, fixed on main after this PR's CI run by #152826 (clearStoreWriterQueuesForTest rejected pending store-writer tasks but left them in queue.pending, so a later drain still ran already-rejected tasks and leaked diagnostic watcher timers).

Verified locally: the same 4-file combination (skills/lifecycle/install + system-agent/chat-wizard-host + state/openclaw-database-maintenance + sessions/session-lifecycle-diagnostics, single worker, matching CI's Node 24.19.0 and shard env) fails identically at this PR's previous base 506c655 without any of this PR's commits, and passes on current main (which contains #152826).

Fix: rebased onto current main (febdf18) — rebase was clean, no source conflicts. Post-rebase verification: the previously failing interference combination passes (69/69), validate.sh over the six changed config files is green (96 config tests + oxfmt/oxlint/tsgo:core), and the writer/recovery lanes io.write-config / io.write-reread / io.eacces pass (244 tests). No functional changes in this update; the PR diff is identical to the previous revision.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 20, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. label Oct 20, 2026
Carry inherited input loss through the existing hash-bound health marker
so accepted writes, later observations, and promotion cannot bless it.
Retain healthy reductions and restore owned anomaly markers on rollback.

Co-authored-by: RomneyDa <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Current head: 1874fd0. Repaired the metadata-only accepted-write P1 by carrying inherited input anomalies in the existing hash-bound health marker through stamping, later reads and promotion, with rollback compensation. The exact regression is red on the parent and green with the repair; 202 affected tests and scoped checks pass, and independent review has no actionable P0–P2 findings. Body and branch are current. Qualification remains partial: source CLI preserves the healthy backup across ordinary edit and restart and logs Doctor restoration, but Doctor later exits1 at a credential/database identity refusal. A fixture-only continuation is investigating without bypassing that gate. Latest-stable upgrade remains approval-blocked. No full Doctor-success, current-head green-CI, credential exception or upgrade claim.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Final source-CLI qualification: passed on unchanged head 1874fd0. One wholly synthetic private fixture completes healthy Gateway boot, metadata-only truncation/promotion refusal, ordinary CLI edit, a new Gateway process and full Doctor --fix --non-interactive with exit 0. All original fields survive and the healthy recovery backup is byte-exact. Earlier copied-fixture identity and build-lock harness failures were diagnosed; normal provisioning and ownership inspection resolved them without weakening guards. Existing 202 tests/review/CI were reused, not rerun; no source/commit change. Body is current. The actual latest-stable installation-upgrade/compatibility gap remains explicitly approval-blocked.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Upgrade qualification completed for both remaining before-merge items — actual latest-stable v2026.10.5 released installation upgraded to this candidate (1874fd0794c545123ab0ec915fb54b72e37f6bb6), with settings, health state, and healthy recovery bytes preserved. Real commands on a real released build; isolated synthetic state dir and synthetic token only, no real credentials.

Acquisition: npm i [email protected] (public registry package, reports OpenClaw 2026.10.5 (1b58cb9)). The candidate ran from a local build of head 1874fd0794c545123ab0ec915fb54b72e37f6bb6 (scripts/build-all.mts qaRuntime, reports OpenClaw 2026.10.5 (1874fd0)). Both used the same OPENCLAW_STATE_DIR for the whole run.

1) Released installation establishes the upgrade baseline

$ ./rel-install/node_modules/.bin/openclaw --version
OpenClaw 2026.10.5 (1b58cb9)
$ openclaw config set gateway.mode local; ... gateway.port 19187; ... gateway.auth.mode token
$ openclaw config set gateway.auth.token upgrade-proof-token-152565
$ openclaw config patch --file proxies-patch.json5      # gateway.trustedProxies ×70 (synthetic), logging.level=info, update.channel=stable
Applied 3 config update(s).
$ openclaw gateway run                                   # released build, isolated state dir
$ openclaw gateway health
Gateway Health — OK (136ms)
$ sha256sum openclaw.json openclaw.json.last-good
b4b3fc71b3fe…  openclaw.json          (2108 bytes)
b4b3fc71b3fe…  openclaw.json.last-good (2108 bytes, byte-exact healthy recovery copy)
config_health_entries: {"hash":"b4b3fc71b3fe…","bytes":2108,"hasMeta":true,"gatewayMode":"local", …}
$ kill -TERM <gateway-pid>
[shutdown] completed cleanly in 260ms

2) Upgrade to the candidate: existing stored data loads and works

$ node openclaw.mjs --version
OpenClaw 2026.10.5 (1874fd0)
$ node openclaw.mjs config get gateway.mode / gateway.auth.mode / logging.level / update.channel
local / token / info / stable
$ node openclaw.mjs config get gateway.trustedProxies        # all 70 entries intact

# first candidate run requires the standard upgrade migration, exactly as a real install would:
$ node openclaw.mjs gateway run
Reason: Client credential migration is incomplete or stale; run openclaw doctor --fix before using this client.
$ node openclaw.mjs doctor --fix --non-interactive
Updated config: …/state/openclaw.json
  Backup: …/state/openclaw.json.bak
└  Doctor complete.                                       # exit 0

The migration was purely additive (diff vs the pre-upgrade snapshot adds only agents.entries.main, messages.queue, skills, wizard); gateway.mode/port/auth.token, all 70 trustedProxies, logging.level, update.channel are preserved. The doctor write advanced the health baseline through this PR's accepted-write path, decoding and updating the released-build-written row in place (last_known_good hash → 77798120b2c8…, 3973 bytes) while the .last-good file bytes stayed untouched. Candidate gateway then booted healthy on the upgraded state (Gateway Health — OK (2ms)), promoted the migrated config (.last-good → 3973 bytes), and shut down cleanly.

3) Truncation cannot poison the upgraded installation's recovery bytes

$ printf '{"gateway":{"mode":"local","port":19187}}' > openclaw.json      # 41-byte parseable stub
$ node openclaw.mjs gateway run
# .last-good never becomes the stub; startup recovery restores the operator's settings:
$ sha256sum openclaw.json openclaw.json.last-good
3fc99ce4…  openclaw.json            (recovered: token + 70 proxies preserved)
3fc99ce4…  openclaw.json.last-good
config_health_entries.last_promoted_good = recovered snapshot (3fc99ce4…); stub never promoted

# canonical Doctor lane with the gateway down:
$ printf '{"gateway":{"mode":"local","port":19187}}' > openclaw.json
$ node openclaw.mjs doctor --fix --non-interactive
└  Doctor complete.                                       # exit 0
$ wc -c openclaw.json → 3973;  jq '.gateway.trustedProxies | length' → 70
$ sha256sum openclaw.json.last-good → 3fc99ce4…            # byte-identical throughout the repair
$ node openclaw.mjs config validate
Config valid: …/state/openclaw.json

4) Data-model compatibility (the second before-merge item)

After all candidate writes, PRAGMA table_info(config_health_entries) reports the identical five-column set the released build created (config_path, last_known_good_json, last_promoted_good_json, last_observed_suspicious_signature, updated_at_ms) — no schema, column, or fingerprint-shape change. The pre-upgrade row written by v2026.10.5 drove every new code path across the upgrade: observation, startup promotion, baseline advance on accepted writes (doctor migration and repairs), and Doctor recovery. No decode failure at any step; a downgraded build reads the final row unchanged.

The PR body's Evidence section has been updated accordingly. Raw logs and pre/post snapshots are archived locally; everything above is copy-pasted from the actual runs (the only redaction is path/ellipsis shortening).

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Original contributor @LiuwqGit has supplied the remaining released-install upgrade and health-state compatibility evidence in #152565 (comment) and updated the PR body. The head remains 1874fd0. The supplied transcript identifies the public v2026.10.5 installation, takeover by the exact candidate using the same synthetic state directory, normal Doctor migration, healthy Gateway startup, and recovery with settings and healthy backup bytes preserved.

Please assess this new evidence against the two remaining upgrade/compatibility items. These are attributed contributor observations, not a new execution by this reviewer. The existing separately qualified sub-512-byte metadata-only edit/restart/Doctor flow and exact-head CI remain unchanged. No source, tests, or commit was replayed for this request.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Preserve the guarded promotion owner and inherited anomaly protection while integrating pinned main JSON5 parsing. Keep authored JSON5 backup bytes covered through existing recovery boundary tests.

Co-authored-by: RomneyDa <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Current head 6c35cfe resolves the new recovery-parser conflict with pinned main3282fda, preserving contributor ancestry, guarded promotion and inherited anomaly protection alongside main's direct JSON5 parser/private-dependency narrowing. Existing tests now verify authored JSON5 backup bytes and the promotion fixture uses the narrowed real type; no new test cases or production control flow.

The body records 75 affected tests passing, scoped types/lint/format, complete-context independent integration review, and an ordinary secretless Git commit with the normal hook. Interrupted execution receipts/setup errors are disclosed; original202-test/CLI/released-install upgrade evidence retains its original1874 revision scope and was not broadly replayed. New-head CI39699025060 is running. Credit, Work sessions and exact published body/head have been verified.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@roboclaw-bot

roboclaw-bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Addressed in e0a636a. The existing health owner returns applied/conflict/unavailable, both successful-write verification reads are removed, and only confirmed CAS conflicts retry. Failed reads, failed writes and lost replies do not retry. No schema, persistent fields, store, retention or permission changes. Parent inspected the full delta, original-contributor ancestry, red/green receipts, ordinary commit hook and independent review. All 47 owner cases are covered across retained passing receipts (46 + corrected rollback), plus seven affected consumer cases. The rollback count is independently red on base (7) and green on the fix (5); accepted writes require two reads instead of three. New-head CI/review are tracked separately in the PR body.


Architecture review follow-up: simplify health-write settlement

Reviewed head: 6c35cfeeb2e329e0ead8ecf17fbae2a0fdbdbe5c.

The backup-protection invariant is correct: promotion must not replace healthy recovery bytes with an observer-flagged truncation. An ordinary edit/metadata stamp must not erase evidence of earlier loss. Keep baseline capture, the hash-bound inherited-anomaly marker, conditional updates, and candidate-specific rollback compensation.

Requested cleanup: remove redundant read-after-write verification from advance and rollback. The comment claiming the worker provides no conditional-write receipt is inaccurate: the health adapter receives applied, then discards it. The existing worker/kernel computes the CAS outcome and publishes committed invalidation.

Expose an explicit applied / conflict / unavailable-or-unknown outcome through that owner. Stop on confirmed application; refresh and reconsider only after a definite conditional conflict. Do not collapse failed reads, unavailable admission, or uncertain writes into a retriable conflict. Preserve newer-baseline/anomaly decisions and the existing warning/error policy.

This is an architecture/work-count finding, not a newly reproduced data-loss regression. Existing tests cover promotion, intentional reductions, metadata-only truncation, and rollback, but do not demonstrate a need to verify every successful write by rereading. Focused proof should cover actual CAS conflict versus unavailable/unknown outcomes, and no extra verification read after success.

Persisted-state scope: necessary behavior uses existing .last-good files and existing config_health_entries fields. No new schema, table, migration, retention policy, or separate store is needed. Rejected-payload saving is moved existing code, not new persistence.

Current-head green CI and ClawSweeper findings-none remain valid observations, but do not negate this later architecture review. No source or live state was changed by this review.

Carry the health worker's applied/conflict/unavailable outcome through
accepted-write baseline advancement and rollback. Trust acknowledged writes
and only reconsider definite comparison conflicts within the existing bound.

Co-authored-by: RomneyDa <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Current head e0a636a implements the later architecture finding: consume the existing worker conditional-write result, stop after applied, and refresh/retry only definite conflicts. It removes both verification-read branches without schema/state growth; unknown outcomes do not replay.

Body records real-owner RED/GREEN proof, 47 owner cases across retained receipts plus seven selected consumers, scoped static gates, fresh complete-context independent review, normal secretless commit hook and exact source binding. Previous 6c35 CI and prior CLI/upgrade evidence retain their original scope. Contributor ancestry/credit and Work sessions preserved; parent verified actual publication and body. Please review this new head and evidence.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

roboclaw-bot and others added 2 commits October 22, 2026 04:06
Preserve the captured health owner result in the Doctor freshness fixture
so its override satisfies the explicit write-outcome contract.

Co-authored-by: RomneyDa <[email protected]>
Remove the self-derived fingerprint-key assertion and historical upgrade
claims from the synthetic stored-row continuity case. Preserve promotion,
truncation, schema-column, and baseline compensation checks.

Co-authored-by: RomneyDa <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Current head 503add5 addresses the previous review: the failed commands-doctor type leaf was PR-caused, reproduced red on e0a636a, and passes after returning the actual owner result (d6b4ea3); all seven affected tests pass. The self-derived fingerprint-key assertion and unsupported historical-shape claims are removed; meaningful stored-row promotion/truncation/compensation/schema checks remain and the affected case passes. Matching type leaves, targeted lint/format, normal commit hooks, and cleanup receipts are linked in the updated body. No production/state changes or replay of settled broad/upgrade proof. Original contributor credit, ancestry, and Work sessions are preserved.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

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

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

3 participants