Skip to content

fix(doctor): preserve revision checks across successive repairs - #147235

Merged
fuller-stack-dev merged 36 commits into
mainfrom
fix/doctor-config-write-receipts-136025
Sep 21, 2026
Merged

fuller-stack-dev merged 36 commits into
mainfrom
fix/doctor-config-write-receipts-136025

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Part of #136025 and #145252. Builds on the already-landed #147120.

What Problem This Solves

Doctor must use the preceding committed revision for each successive repair. A refused write must not advance the persistence baseline or authorize dependent cleanup. This preserves the planned receipt even when initial planning has no changes, advances it only after a committed write, and invalidates the active receipt after partial publication while retaining the terminal error. Independent ALS capture/compensation is unchanged.

Current Qualification

Current signed head: 50346e20154c4733a2c59803924f245bac3de105, retaining Vincent Koc's contributor ancestry. Main's targeted directive-delivery assertion fix (087ccde18c30) is included because the exact two CI failures reproduced on clean main before that fix. Both targeted cases now pass.

Focused Doctor/receipt and real root/include-file checks (50), backup/write-lock checks (37), readiness coverage, production/gateway types and scoped static checks remain qualified. The affected gateway suite previously passed 376 tests; that did not fix the Linux cancellation CI failure, which remains recorded on the earlier heads. The final narrow correction skips dispatch pumping only for cancellation at acceptance and checks provider-call count after terminal settlement. Both completed/cancelled cases pass, with terminal timeout/provider-not-started/persisted-task assertions preserved. No production cancellation change or timeout increase. API-direct P0–P2 final correction review and typed lint/format pass. Targeted settlement command wall: 33.40s (two outcomes); targeted delivery command wall: 53.48s. Exact-head CI passed: all 148 completed jobs succeeded (run 35627982216). Fresh exact-head ClawSweeper review reported no actionable findings and no before-merge blocker. PR merged on 2026-09-21 at 17:22:47 UTC as 1a7911f56c11ba5c980d598610f34961f35e641e.

The 414b8ffd candidate package built and passed tarball integrity. A fresh isolated Linux/arm64 cell using the unmodified published 9.5 updater installed that exact candidate successfully (exit 0, terminal update status succeeded). All 11,427 published-parent and 12,558 candidate payload files verified. The agent roster migrated, the synthetic token was preserved, and both .bak and .pre-update retained the original config bytes. Service policy was external with --no-restart; no live Odin state or service was touched. Doctor/config/update/daemon source, package manifest and lockfile are unchanged between that candidate and this successor. This is scoped compatibility evidence, not a claim that the package was built from the successor or exhaustive global no-loss proof.

The separate Darwin cell failed before promotion with existing managed handoff lease is incompatible, leaving config and installed published runtime unchanged. Read-only diagnosis found incompatible foreign retained records; no foreign records were changed and the failed namespace was not retried. Historical process-census/cleanup UNKNOWN is preserved. Observer Promise identity, complete-census entitlement and unrelated full-stack joins are not imposed as own-PR landing prerequisites. Required exact-head GitHub CI and review remain enforced.

Release-Note Impact

Doctor keeps revision checks across successive config repairs and refuses stale/partially published revisions without authorizing dependent cleanup.

Preserves Vincent Koc's receipt repair and attribution. The contributor-owned alias repair #138040, cancellation lane, and shared full-chain acceptance remain separate outcomes. No live Odin deployment or restart.

Keep include-expanded authored snapshots internal across valid, invalid, and cached config reads. Cover read-scoped root/include responses while preserving the paired internal trees.

Defer alias migration helpers and their direct resolved-source API tests to the first consumer layer; preserve existing env-reference entrypoint coverage here.
@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 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 commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 13, 2026
@vincentkoc

vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member Author

@fuller-stack-dev scoped owner-review handoff: this receipt layer depends on #147120 and supports aniruddhaadak80's final contributor repair in #138040.

Signed head: 9d05cadaffab0e54039d4997603c3c30cb26f0af. The latest commit adds 78 test lines and no production changes, covering successive real writes followed by revision-drift refusal while preserving earlier config, backups, receipts, and saved baselines. Fresh peer/native review, pinned formatting, syntax, whitespace, and privacy checks passed.

Exact-head CI attempt 1 passed with 115 successful, 16 skipped, zero failed, and zero cancelled jobs; the gate passed at 2026-09-13 18:47:34 UTC: https://github.com/openclaw/openclaw/actions/runs/34774542381/attempts/1. The actual checkout was merge f109d7dfe5a495e4fb8ca6f4ba071caac48ceb62, with B3 (b3d5ba7c6403626621d1f54ae2dabc8835432235) and the signed head above as parents, and tree d98db7bba54ff7881e7dabb75638129e88fd70ff. Five named test files recorded 181 passes, including all 12 include-refusal cases exercising the new assertions; these are not 12 newly added tests. Detailed job links are in the PR body.

ClawSweeper revision 2 reviewed this exact head at 18:35:04 UTC with no actionable introduced code or security defect. The regression-execution part of its rank-up request is now evidenced; published-updater-by-candidate successive-receipt/migration compatibility and earlier-config/backup preservation remain unproven, alongside inherited native Windows/recovery gaps. The merge hold remains. This is scoped owner review, not merge-ready or end-to-end alias/SDK certification. No merges or merge automation.

@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 17:50
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 12:58 PM ET / 16:58 UTC (Revision 13).

ClawSweeper review

What this changes

Doctor preserves configuration revisions across successive repairs, stops dependent cleanup after refused writes, and adds regression coverage and test-fixture corrections.

Merge readiness

✅ Ready for maintainer review

This repair remains necessary on current main. No blocking introduced defect was found, and the updated compatibility evidence addresses the previous review’s qualification concern.

Priority: P2
Reviewed head: 50346e20154c4733a2c59803924f245bac3de105

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused production repair with meaningful boundary coverage and scoped upgrade qualification; no blocking defect remains in this review.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its recorded published-updater run exercises candidate Doctor migration with configuration and backup preservation; unchanged production source supports reuse, while real-file regressions cover receipt chaining and refusal.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its recorded published-updater run exercises candidate Doctor migration with configuration and backup preservation; unchanged production source supports reuse, while real-file regressions cover receipt chaining and refusal.
Evidence reviewed 8 items Introduced production change: The pinned base-to-head diff retains the planning revision, requires its path and hash for every required write, advances it from the committed result, and invalidates it after partial publication.
Still needed on main and latest release: Fetched main still selects the revision only for the initial pending write. Both main and the supplied latest release retain the older finalizer that omits the revision for repair-mode and no-change planning; neither establishes this PR’s complete receipt chaining.
Fresh configuration, successive writes, and refusal coverage: Inspected real-file regressions cover missing-root creation, successive root/include writes, raw-byte drift, equal-byte path substitution, and preservation of committed configuration and backups after refusal. Deferred-migration coverage checks retention followed by cleanup using the latest revision. The PR reports 50 focused Doctor/receipt checks and 37 backup/write-lock checks passing; this read-only review did not execute tests.
Findings None None.
Security None None.

How this fits together

Doctor plans configuration repairs during maintenance and updates. Its configuration writer validates each planned revision before saving changes, then permits dependent cleanup and Gateway service repair.

flowchart TD
  A[Configuration files] --> B[Doctor repair planning]
  B --> C[Planned revision and repairs]
  C --> D{Atomic revision check}
  D -->|Matches| E[Save changes and backup]
  E --> F[Advance revision for next repair]
  F --> C
  E --> G[Dependent cleanup and service repair]
  D -->|Conflict| H[Preserve files and report refusal]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -10, Tests +902. Total +892 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 3 32 42 -10
Tests 22 1018 116 +902
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 25 1050 158 +892

Review metrics

Metric Value Why it matters
Production versus test growth Production −10 net lines; tests and test support +902 net lines The implementation shrinks; branch growth is concentrated in regression coverage and fixture corrections.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/finalize-config-flow.ts, migration/backfill/repair: src/flows/doctor-health-contribution-runners.config.ts, migration/backfill/repair: src/flows/doctor-health-contribution-types.ts, unknown-data-model-change: src/flows/doctor-health-contribution-runners.config.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep successive repairs on the existing atomic writer, advancing revisions only after successful commits and preserving prior files and backups on refusal.

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

Yes, source establishes the mechanism: current main stops supplying the planned revision after the initial commit, allowing a later repair to miss intervening edits. The branch contains focused real-file regressions; this review did not execute them.

Is this the best way to solve the issue?

Yes. Reusing the existing atomic writer’s revision and path checks closes the gap without adding a competing persistence owner or configuration option.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This is a bounded Doctor configuration-repair correctness improvement, without evidence of a new emergency regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its recorded published-updater run exercises candidate Doctor migration with configuration and backup preservation; unchanged production source supports reuse, while real-file regressions cover receipt chaining and refusal.

Evidence

What I checked:

  • Introduced production change: The pinned base-to-head diff retains the planning revision, requires its path and hash for every required write, advances it from the committed result, and invalidates it after partial publication. (src/flows/doctor-health-contribution-runners.config.ts:66, 50346e20154c)
  • Still needed on main and latest release: Fetched main still selects the revision only for the initial pending write. Both main and the supplied latest release retain the older finalizer that omits the revision for repair-mode and no-change planning; neither establishes this PR’s complete receipt chaining. (src/commands/doctor/finalize-config-flow.ts:18, ddcd52d5bffd)
  • Fresh configuration, successive writes, and refusal coverage: Inspected real-file regressions cover missing-root creation, successive root/include writes, raw-byte drift, equal-byte path substitution, and preservation of committed configuration and backups after refusal. Deferred-migration coverage checks retention followed by cleanup using the latest revision. The PR reports 50 focused Doctor/receipt checks and 37 backup/write-lock checks passing; this read-only review did not execute tests. (src/commands/doctor-config-receipt.test.ts:54, 50346e20154c)
  • Published updater qualification and review continuity: The captured body, also confirmed by the live read, records an unmodified published 9.5 updater successfully installing candidate 414b8ff on isolated Linux/arm64, migrating the roster and preserving the synthetic token and original .bak/.pre-update bytes. Targeted comparison found the relevant Doctor/config/update/daemon source, manifest, and lockfile unchanged in the reviewed successor. Together with fresh-file and deferred-cleanup coverage, this addresses the preceding rank-up request. The Darwin pre-promotion failure remains recorded without implying universal platform qualification. (414b8ffdaa3c)
  • Existing writer and authority boundaries preserved: The existing atomic mutation owner checks the expected path and base hash before transformation and commit. Doctor retains the existing update-authority assertion, terminal-error latch, and service-write refusal boundary. The patch changes concurrency receipts rather than principal permissions, public plugin APIs, or stored schemas. (src/config/mutate.ts:1056, 50346e20154c)
  • Latest test correction preserves cancellation assertions: Compared with the previously reviewed head, cancellation at acceptance now skips waiting for dispatch that cancellation prevents; provider-call assertions run after terminal settlement. Persisted-task and terminal-outcome checks remain. No production cancellation behavior or timeout was changed. (src/gateway/server-methods/agent.task-runtime.test.ts:273, 50346e20154c)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-20T08:34:43.338Z sha 99c23b6 :: blocked before merge. :: none
  • reviewed 2026-09-20T14:06:24.211Z sha b74c430 :: blocked before merge. :: none
  • reviewed 2026-09-20T14:55:11.599Z sha d0ae6d8 :: blocked before merge. :: none
  • reviewed 2026-09-20T15:31:10.490Z sha fd04a77 :: blocked before merge. :: none
  • reviewed 2026-09-20T16:11:15.410Z sha 446c509 :: blocked before merge. :: none
  • reviewed 2026-09-20T16:53:29.705Z sha 3082670 :: blocked before merge. :: none
  • reviewed 2026-09-20T19:24:59.671Z sha 3082670 :: blocked before merge. :: none
  • reviewed 2026-09-21T16:34:45.342Z sha 3df71d0 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 13, 2026
fuller-stack-dev and others added 6 commits September 19, 2026 16:41
Merge the verified main baseline while retaining Vincent Koc's original
three-commit ancestry. Keep authored capture and public stripping together;
retain current-main migration and validation APIs and supplemental privacy tests.

Co-authored-by: Vincent Koc <[email protected]>
Merge the verified main baseline while retaining Vincent Koc's original
three-commit ancestry. Keep authored capture and public stripping together;
retain current-main migration and validation APIs and supplemental privacy tests.

Co-authored-by: Vincent Koc <[email protected]>
…policy

Preserve contributor ancestry and current-main authorization, deferral,
and Windows activation behavior while routing token persistence through
the Doctor config owner before service mutation.
Preserve Vincent Koc's original receipt commits and the accepted #147120 stack.
Retain planning revisions across successive writes and qualify terminal and deferred cleanup assertions.
Preserve successive-write revision checks and contributor ancestry while
composing the qualified receipt layer over the current gateway writer.
Reuse the repair prompter fixture without weakening assertions or line caps.
Use the real config snapshot for existing and absent config files and assert
the writer result. Preserve disk, metadata, privacy, and no-op assertions.
Preserve contributor ancestry and inherit the landed task-publication and
compiler-lifetime repairs from main. Keep maintenance-time service token
recovery with the canonical Doctor writer, including refusal settlement
and service authority checks.
Preserve the contributor receipt layer and merge the accepted current-main
gateway writer. Bind the maintenance fixture to its planned config revision
and verify successive writes and refusal retention through its callback.
Keep real service auditing and runtime path classification while making the
installation-only fixture independent of the host Node launcher. Cover
denied, approved, and noninteractive consent for version-managed runtime drift.
Absorb the reviewed lower consent fixture without changing the receipt layer.
Keep generated diagnostic paths readable after identifier redaction and use
the atomic phase owner to settle an interrupted fixture PID publication.
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Sep 20, 2026
Keep the synthetic catalog clock on whole milliseconds so the exact arm
interval survives floating-point boundaries. Retain the dispatch fixture
clock until accepted work dispatches or responds, scoped to this invocation.
Give each status model test an owned state directory and await its scoped
cleanup so retained session-cost workers cannot leak into later suites.
Own default and custom session stores and await scoped cleanup so cached
SQLite read scopes cannot leak into later auth-profile suites.
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 20, 2026
Base automatically changed from fix/doctor-gateway-config-writer-136025 to main September 20, 2026 19:12
Retain Vincent Koc’s receipt repair and contributor ancestry. Advance the
repair baseline only after committed writes; invalidate partial-publication
receipts without authorizing dependent cleanup. Integrate current main and
bound accepted-dispatch fixture polling with a fail-first regression.
Retain bounded dispatch polling while recognizing the matching request
terminal dedupe result when cancellation prevents provider dispatch.
Pending acceptance and malformed request keys cannot release the clock.
Cancellation at acceptance must not await dispatch it intentionally prevents.
Keep terminal settlement and no-provider-call assertions, and incorporate
main's targeted directive-delivery assertion fix (087ccde).
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 21, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 1a7911f into main Sep 21, 2026
207 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/doctor-config-write-receipts-136025 branch September 21, 2026 17:22
@fuller-stack-dev

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…claw#147235)

* fix(config): preserve references across plugin owner migrations

* fix(config): keep authored provenance out of config responses

Keep include-expanded authored snapshots internal across valid, invalid, and cached config reads. Cover read-scoped root/include responses while preserving the paired internal trees.

Defer alias migration helpers and their direct resolved-source API tests to the first consumer layer; preserve existing env-reference entrypoint coverage here.

* test(config): invalidate cached provenance fixtures

* fix(doctor): honor config write refusals before gateway repair

* test(doctor): simplify gateway repair mock arguments

* test(doctor): cover update metadata and include refusal

* fix(doctor): preserve revision checks across successive repairs

* test(doctor): preserve committed repairs after revision drift

* test(doctor): assert updater deferral through config writer

* test(models): keep native auth refresh fixture passive

* test(node): keep prepared workspace fixture owner private

Create the fixture owner root with the same private permissions as project
preparation so permissive host umasks cannot invalidate transfer tests.

* refactor(config): split authored env-reference accounting

Move unchanged authored-reference helpers and private snapshot tests into
coherent siblings so the provenance change satisfies the line-cap ratchet.

* fix(tooling): include authored env helper in PR wrapper archive

Keep the extracted wrapper source inventory complete after the config
helper extraction; preserve eager-import closure and provisioning guards.

* test(doctor): extract gateway writer fixtures for line caps

Keep all assertions and coverage while moving coherent gateway assertion
helpers and the linked token/writer fixture to sibling test support.

* test(doctor): bind persistence fixtures to observed config revisions

Use the real config snapshot for existing and absent config files and assert
the writer result. Preserve disk, metadata, privacy, and no-op assertions.

* test(doctor): isolate installation consent runtime fixture

Keep real service auditing and runtime path classification while making the
installation-only fixture independent of the host Node launcher. Cover
denied, approved, and noninteractive consent for version-managed runtime drift.

* test: stabilize catalog clock and accepted agent dispatch

Keep the synthetic catalog clock on whole milliseconds so the exact arm
interval survives floating-point boundaries. Retain the dispatch fixture
clock until accepted work dispatches or responds, scoped to this invocation.

* test: drain status model fixture session resources

Give each status model test an owned state directory and await its scoped
cleanup so retained session-cost workers cannot leak into later suites.

* test: scope sandbox workspace authority fixture state

Own default and custom session stores and await scoped cleanup so cached
SQLite read scopes cannot leak into later auth-profile suites.

* test(gateway): observe accepted cancellation settlement

Retain bounded dispatch polling while recognizing the matching request
terminal dedupe result when cancellation prevents provider dispatch.
Pending acceptance and malformed request keys cannot release the clock.

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations extensions: anthropic gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants