Skip to content

fix(config): preserve authored settings across includes - #139949

Merged
steipete merged 2 commits into
mainfrom
codex/130706-config-model-write-20260905
Sep 6, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/130706-config-model-write-20260905

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Related: #130706

What Problem This Solves

Configuration updates could lose authored model aliases or parameters, discard explicit settings beside $include, or reject root-owned arrays. Explicit writes could also duplicate composed arrays on reload. These cases affect plugin migration writes, combined roster/settings changes, and Doctor's legacy-agent migration.

Why This Change Was Made

Finish roster and include reconstruction once, then apply explicit settings. Keep model-key normalization with the touched-model owner. Projection and explicit copying share array ownership derived from the recorded pre-migration source; the writer reindexes that evidence when legacy agent lists move to canonical entries, without migrating its field values.

Already-satisfied array, object and index writes retain their authored contribution. Actual changes to included or mixed array contributions remain protected. Duplicate preservation, traversal and error-construction paths were removed.

User Impact

Unrelated updates preserve model metadata. Root-owned arrays remain editable, including environment-backed arrays. Explicit settings survive combined roster writes, and Doctor preserves nested includes and environment references while migrating legacy agents. Catalog-suppressed models still require explicit repair.

Evidence

  • Final correction passes 149 focused tests: all 128 writer cases and the unchanged 21-case Doctor legacy-composition suite. Earlier component verification also covered include resolution, mutation and migration siblings.
  • All 33 production filesystem mutation/reload scenarios pass again on the final source, including successful unchanged array/object/index writes and unsafe replacements refusing without modifying either file.
  • A separate real Doctor configuration flow reproduced the CI failure before repair, then passed migration → atomic write → disk/reload → second no-op, preserving both include files and authored environment references.
  • Independent P2 review and the complete changed gate pass. Writer source SHA256: 299f5072b866a4a127a2b5d6a26c501f5395c2e3fa008abedf670e5e0289e4e1; final head: c5325345b532beea56227d5e85c8bef8abf5e683.
  • Production delta: +45; tests: +231. Remaining growth enforces ownership during explicit copying and aligns ownership evidence with canonical roster paths.

The initial hosted run caught the legacy-list/include coordinate regression; the existing test and real Doctor flow now pass. Fresh exact-head CI passed on c5325345b532beea56227d5e85c8bef8abf5e683. Single-agent to multi-agent topology expansion under an include retains its existing refusal, verified on the base; supported explicit multi-agent roster changes are covered.

Keep untouched model aliases and params in their authored rows. Finish
roster/include reconstruction before applying explicit settings, and share
recorded array ownership between projection and copying so unchanged
include-backed writes retain their reload semantics.

Validated with 292 focused tests, 33 real filesystem scenarios, the full
changed gate, and a scoped-clean P2 review.

Related: #130706
@clawsweeper

clawsweeper Bot commented Sep 6, 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 size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 4:52 AM ET / 08:52 UTC.

ClawSweeper review

What this changes

The PR preserves authored model settings and include directives when configuration writes combine agent changes with explicit settings, while preventing duplicated included array entries.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix: the reviewed main revision and latest release retain the pre-fix behavior. No actionable introduced defect was found, and the maintainer-authored, protected PR should remain open.

Priority: P2
Reviewed head: e4e72e958921a6da9f9e5b6f5d518c60e474c87d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and reported filesystem validation; no blocking defect was identified.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER classification exempts this PR from external-contributor proof requirements. Its body reports 33 real filesystem scenarios through config and migration APIs exercising preservation, reload, and refusal behavior; this review inspected the source connection but did not replay those runs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER classification exempts this PR from external-contributor proof requirements. Its body reports 33 real filesystem scenarios through config and migration APIs exercising preservation, reload, and refusal behavior; this review inspected the source connection but did not replay those runs.
Evidence reviewed 8 items Complete introduced production patch: Read the complete merge-base-to-head production diff and surrounding implementation. Structural reconstruction now precedes explicit injection; array ownership checks retain composed contributions instead of copying them into the root.
Current main and release still need the fix: The writer blob is identical at the PR merge base, fetched main e850340, and latest release v2026.9.2: 93d2b824ba1aa230b4d118ae5e1eca537880bfd6. Release source still deletes an authored model key during unrelated preservation when its normalized identity differs.
Production write boundary: The production writer supplies authored, runtime, and pre-migration snapshots to preparation, then resolves includes and validates the resulting candidate before filesystem writes.
Findings None None.
Security None None.

How this fits together

OpenClaw’s configuration writer combines requested edits with authored files and resolved runtime settings. It prepares the persisted configuration before validation, file writing, and subsequent reload.

flowchart TD
  A[Authored configuration and includes] --> C[Prepare configuration write]
  B[Runtime settings and requested edits] --> C
  C --> D[Restore authored structure]
  D --> E[Check array ownership and explicit settings]
  E --> F[Validate and persist configuration]
  E --> G[Reject unsafe include changes]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +38, Tests +231. Total +269 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 130 92 +38
Tests 1 236 5 +231
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 366 97 +269

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +38 net lines; tests +231 net lines The production growth adds shared array-ownership enforcement, with a stated justification and focused regression coverage.

Technical review

Best possible solution:

Keep authored values and include contributions distinct throughout the existing writer, applying explicit intent only after structural reconstruction.

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

Yes, from source: an unrelated write with a normalized model key and authored parameters reaches deletion of the original row on reviewed main; the regression fixtures specify this case. No runtime reproduction was executed during this review.

Is this the best way to solve the issue?

Yes. The patch repairs the existing persistence owner, reuses include ownership checks, and leaves model normalization with explicitly touched model entries.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs bounded configuration-write failures and authored-setting preservation without evidence of an urgent widespread 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 supplied MEMBER classification exempts this PR from external-contributor proof requirements. Its body reports 33 real filesystem scenarios through config and migration APIs exercising preservation, reload, and refusal behavior; this review inspected the source connection but did not replay those runs.

Evidence

What I checked:

  • Complete introduced production patch: Read the complete merge-base-to-head production diff and surrounding implementation. Structural reconstruction now precedes explicit injection; array ownership checks retain composed contributions instead of copying them into the root. (src/config/io.write-prepare.ts:1603, e4e72e958921)
  • Current main and release still need the fix: The writer blob is identical at the PR merge base, fetched main e850340, and latest release v2026.9.2: 93d2b824ba1aa230b4d118ae5e1eca537880bfd6. Release source still deletes an authored model key during unrelated preservation when its normalized identity differs. (src/config/io.write-prepare.ts:463, e8503408bc14)
  • Production write boundary: The production writer supplies authored, runtime, and pre-migration snapshots to preparation, then resolves includes and validates the resulting candidate before filesystem writes. (src/config/io.write.ts:142, e4e72e958921)
  • Include merge contract: The include resolver concatenates arrays and merges authored siblings after included content. This explains why persisting an already-composed array duplicates included entries on reload. (src/config/includes.ts:153, e4e72e958921)
  • Regression coverage: The complete test diff covers root-owned and environment-backed array replacement, mixed-array refusal, nested includes, combined roster/settings writes, and preservation of model rows sharing a runtime identity. Assertions check persisted output rather than private helper calls; tests were inspected, not executed. (src/config/io.write-prepare.test.ts:594, e4e72e958921)
  • Captured validation and review continuity: The supplied body at sourceRevision df216fde56bbd5d32f486f79685d1a4a062e8f723feec2be068e6b1ed1107a1e reports 292 focused tests and 33 production filesystem mutation/reload scenarios, including unchanged writes and refusals leaving both files intact. These are reported results, not independently replayed traces. The previous completed review covered this same head and retained no findings or published rank-up moves. (e4e72e958921)

Likely related people:

  • steipete: 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 (1 earlier review cycle)
  • reviewed 2026-09-06T08:46:46.564Z sha e4e72e9 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 6, 2026 08:48
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Final head c5325345b532beea56227d5e85c8bef8abf5e683 passes exact-head CI, independent P2 review, and the complete changed gate.

The initial CI run exposed an existing Doctor legacy-list/include case that the first candidate rejected. The writer now reindexes the recorded pre-migration evidence to the same canonical roster paths used by include preservation, without changing its values or replacing Doctor's original facts. The unchanged Doctor suite passes all 21 cases alongside 128 writer tests. A separate production Doctor flow reproduced the failure before repair and now passes migration → atomic write → disk/reload → second no-op, preserving include bytes and environment references. All previous 33 real filesystem scenarios pass again on the final writer source.

Final production delta is +45; tests +231. The latest ClawSweeper review had no findings or rank-up items but covered the earlier head; the final seven-line coordinate repair has its own clean P2 and real-flow proof. @clawsweeper re-review

@steipete
steipete merged commit 53600f3 into main Sep 6, 2026
187 checks passed
@steipete
steipete deleted the codex/130706-config-model-write-20260905 branch September 6, 2026 09:51
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
)

* fix(config): preserve authored values during config writes

Keep untouched model aliases and params in their authored rows. Finish
roster/include reconstruction before applying explicit settings, and share
recorded array ownership between projection and copying so unchanged
include-backed writes retain their reload semantics.

Validated with 292 focused tests, 33 real filesystem scenarios, the full
changed gate, and a scoped-clean P2 review.

Related: openclaw#130706

* fix(config): align include evidence with canonical roster paths
steipete added a commit that referenced this pull request Sep 7, 2026
Share authored-source projection between root and nested include writers while
preserving native and custom-I/O ownership. Validate explicit removals on a copy
and apply them once to final output so indexed deletion cannot splice twice.

Project runtime edits with value-presence semantics so full replacements retain
literal nulls and omitted keys remain deletions. Keep config.patch's RFC deletion
contract, legacy empty-parent behavior, and source-key unset semantics intact.
Doctor persists migrated source instead of schema defaults, and committed plugin
inventory refresh uses its caller's environment with published ownership.

Remove duplicate projection, deletion, environment-baseline and forwarding
helpers; reuse canonical coercion and hashing. Preserve main's nested include
ownership, CAS/path/env guards, migration validation and existing SDK contracts.

The integrated followup removes 14 production lines. Its seven owner/sibling
files pass 488 tests, and the complete changed gate passes for all sixteen paths.
Final compiled SDK, CLI and Gateway proof follows on this committed candidate.

Related: #130706, #139949, #116108, #140579.
steipete added a commit that referenced this pull request Sep 7, 2026
Keep the saved source baseline and agent preparation's returned configBase
paired through wizard persistence. Preserve current main's setup diagnostic
and typed startup-maintenance error handling while integrating its changes.

Related: #130706, #139949.
steipete added a commit that referenced this pull request Sep 7, 2026
…40579)

* fix(config): preserve authored writes and refresh committed plugin state

Carry source/runtime input provenance through config mutations and lower writes.
Preserve explicit default-equal changes, originating environment references,
include ownership, and the public model mutator result. Keep each CLI, wizard,
and update candidate paired with its native write preparation and merge base.
Refresh plugin inventory from committed config while keeping staged probes
explicit and preserving config path, snapshot and concurrent-write checks.

Remove redundant source projection, duplicate option contracts and lazy-loader
adapters. Keep the plugin draft clone because validation mutates aliased values.
The classic wizard adopts its returned merge base without dropping earlier
security or telemetry choices. Update-process fixtures follow the current
preparation owner and retain real Doctor, JSON and terminal-output assertions.

Related: #130706, #139949.

* test(config): align writer fixtures with source preparation

Use the native write-snapshot contract for agent deletion fixtures, assert
captured environment provenance in plugin install results, and replay authored
source settings for Gateway no-op checks. Retain the independent regression
matrix for explicitly authoring runtime-default values.

Remove a redundant async forwarding callback while preserving the existing
triage, environment restoration, Windows recovery and presentation owners.
This saves four production lines and keeps the combined update module within
its line limit without a suppression.

Validation: all 19 reproduced CI failures pass; 237 focused and sibling tests,
including update flag, triage and cleanup ordering, pass. Independent P2 review
finds no actionable issue. Related: #130706, #140579.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…enclaw#140579)

* fix(config): preserve authored writes and refresh committed plugin state

Carry source/runtime input provenance through config mutations and lower writes.
Preserve explicit default-equal changes, originating environment references,
include ownership, and the public model mutator result. Keep each CLI, wizard,
and update candidate paired with its native write preparation and merge base.
Refresh plugin inventory from committed config while keeping staged probes
explicit and preserving config path, snapshot and concurrent-write checks.

Remove redundant source projection, duplicate option contracts and lazy-loader
adapters. Keep the plugin draft clone because validation mutates aliased values.
The classic wizard adopts its returned merge base without dropping earlier
security or telemetry choices. Update-process fixtures follow the current
preparation owner and retain real Doctor, JSON and terminal-output assertions.

Related: openclaw#130706, openclaw#139949.

* test(config): align writer fixtures with source preparation

Use the native write-snapshot contract for agent deletion fixtures, assert
captured environment provenance in plugin install results, and replay authored
source settings for Gateway no-op checks. Retain the independent regression
matrix for explicitly authoring runtime-default values.

Remove a redundant async forwarding callback while preserving the existing
triage, environment restoration, Windows recovery and presentation owners.
This saves four production lines and keeps the combined update module within
its line limit without a suppression.

Validation: all 19 reproduced CI failures pass; 237 focused and sibling tests,
including update flag, triage and cleanup ordering, pass. Independent P2 review
finds no actionable issue. Related: openclaw#130706, openclaw#140579.
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 20, 2026
)

* fix(config): preserve authored values during config writes

Keep untouched model aliases and params in their authored rows. Finish
roster/include reconstruction before applying explicit settings, and share
recorded array ownership between projection and copying so unchanged
include-backed writes retain their reload semantics.

Validated with 292 focused tests, 33 real filesystem scenarios, the full
changed gate, and a scoped-clean P2 review.

Related: openclaw#130706

* fix(config): align include evidence with canonical roster paths

(cherry picked from commit 53600f3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: M 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.

1 participant