Repository navigation
fix(config): validate config writes against the config being written - #126734
Merged
Merged
Conversation
writeConfigFileFromContext passed the pre-write snapshot's plugin metadata into strict validation. During onboarding that snapshot belongs to an intermediate config written by agent creation, which has no plugin entries, so its scoped manifest registry is empty. Validating the final candidate against it made every plugin entry added by the same write look unknown, and non-interactive onboarding warned that the openai and codex entries it had just written were stale or uninstalled. Drop the stale snapshot so validation resolves the manifest registry from the candidate it is actually validating. Strict semantic validation is unchanged, and the registry load stays lazy.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 20, 2026 16:10
main is red on the Control UI startup-JS ratchet: unrelated PR #126725 measures 348289 B and this branch measures 348351 B against a 347023 B baseline + 1056 B tolerance. Twenty-six UI commits have landed since the last bump (#126474), none individually large. Baseline moves to the CI-measured 348351 B, well under the 358400 B maintainer-approved ceiling that still guards cumulative creep.
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 21, 2026
…penclaw#126734) * fix(config): validate config writes against the config being written writeConfigFileFromContext passed the pre-write snapshot's plugin metadata into strict validation. During onboarding that snapshot belongs to an intermediate config written by agent creation, which has no plugin entries, so its scoped manifest registry is empty. Validating the final candidate against it made every plugin entry added by the same write look unknown, and non-interactive onboarding warned that the openai and codex entries it had just written were stale or uninstalled. Drop the stale snapshot so validation resolves the manifest registry from the candidate it is actually validating. Strict semantic validation is unchanged, and the registry load stays lazy. * fix(ci): raise the Control UI startup JS baseline to unblock main main is red on the Control UI startup-JS ratchet: unrelated PR openclaw#126725 measures 348289 B and this branch measures 348351 B against a 347023 B baseline + 1056 B tolerance. Twenty-six UI commits have landed since the last bump (openclaw#126474), none individually large. Baseline moves to the CI-measured 348351 B, well under the 358400 B maintainer-approved ceiling that still guards cumulative creep.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Non-interactive onboarding warned the operator that the plugin entries it had just written were
stale or uninstalled. Running the documented automation flow from
docs/start/wizard-cli-automation.mdon a fresh state dir:Both warnings are false:
plugins: {}, so that same run wrote both entries;openclaw plugins list --jsonreports both asstatus: "loaded",enabled: true, sourced fromdist/extensions/{openai,codex}/index.js(148 plugins total);openclaw config validateprintsConfig validwith empty stderr, andopenclaw models listemits no such warnings.The trigger is provider auth selection:
--auth-choice skipwritesplugins: {}and emits zerowarnings, while
--auth-choice openai-api-keywrites the two entries and emits two warnings. A newoperator's first output tells them to delete valid config and install an already-loaded plugin.
Why This Change Was Made
The registry used for write-time validation belonged to a different config than the one being
validated.
openclaw onboardruns withloadPlugins: "never"by design. The OpenAI flow stagesplugins.entries.{openai,codex}in the in-memory candidate, but before the final commitensureOnboardingAgentcreates the first agent, andcreateAgentreads and writes the current diskconfig — an intermediate config that has the new agent but none of the staged plugin entries. The
final write then rereads that intermediate config, and its validation metadata scope is derived from
it. With no plugin/provider/model references,
resolveConfigValidationMetadataPluginIdsreturns anexplicit empty scope, which
loadPluginManifestRegistryForInstalledIndexdeliberately maps to anempty manifest registry — a valid scoped snapshot for that intermediate config.
writeConfigFileFromContextthen passed that snapshot into strict validation of the final candidate.Injecting it set
registryInfoeagerly and bypassed candidate-derived resolution, soensureKnownIds()built an empty set and the missing-plugin branch fired for both new entries.
The fix drops the stale argument so validation resolves the manifest registry from the candidate it is
actually validating. Strict semantic validation is unchanged, and resolution stays lazy — the registry
is only loaded when a plugin-dependent check needs it — so this is not new work on every write.
Provenance:
8dd0434f86f2added both strict semantic validation and thepluginMetadataSnapshot: snapshotRead.pluginMetadataSnapshotargument. Before that, the validatoralready resolved its registry from the candidate.
No empty-snapshot guard was added, deliberately. An empty manifest registry is not evidence that
metadata is unusable — it can be an authoritative scoped result, or a real install with no/disabled
plugins. Existing genuine-missing coverage validates against an empty registry, so a
knownIds.size === 0guard would suppress real stale-entry warnings and official-plugin install hints.Candidate-derived scoping is the correct defence: an unknown configured id makes the narrow scope
unresolvable and falls back to the full registry, after which genuine absence still warns.
User Impact
The documented onboarding path no longer emits warnings about plugins that are present and loaded.
Genuine stale entries and genuinely missing official external plugins still warn exactly as before.
Evidence
Live proof, independently reproduced on both sides. Before, on a build of
main: stderr containsConfig warnings:and both false lines. After, on a build of this branch with the identical commandand a fresh state dir: zero matches for
plugin not found: openaiorplugin not installed: codex— the only remaining stderr line is an unrelated Codex app-server version diagnostic — and the config
still records both entries as enabled.
Blast radius measured, not assumed. This argument is used by every config write, so the whole
config surface was run:
src/config— 252 files, 3417 tests, all passing. Also green:config.plugin-validation,io.write-config,io.write-reread(165 tests), andnode scripts/check-changed.mjson an isolated Testbox.Regression coverage is a built-CLI process test (
test/onboard-plugin-warnings.e2e.test.ts) thatruns the documented onboarding invocation with a fake key in an isolated state dir, asserts exit 0 and
the absence of both warning strings, then proves via
plugins list --jsonin that same state that bothplugins are loaded and enabled. It fails against unrepaired production code with exactly the two
reported warnings. Existing tests proving a genuinely unknown entry still warns, and that a genuinely
missing official external plugin still gets its install hint, remain green and untouched.
Branch-mode autoreview clean (
patch is correct).Production LOC
+0/-1. Tests+95.Unrelated red-main heal carried here
build-artifactsis failing onmain, not on this diff: the Control UI startup-JS ratchet is overbudget for every PR that builds the UI. Unrelated PR #126725 (
plugin-sdkAPI diff strings) measures348289 Band this branch measures348351 B, both against347023 B + 1056 Btolerance. Twenty-sixUI commits have landed since the last baseline bump (#126474) and none is individually large, so this
is ordinary accretion rather than one regression to revert.
Per the root
AGENTS.mdrule on landing onto redmain, the smallest correct fix is carried in thisPR:
config/control-ui-startup-budget-baseline.jsonmoves to the CI-measured348351 B, using the--startup-js-bytesvalue the checker's own comment asks for. That is1328 Bof the checker's4096 Bratchet allowance and stays well under the358400 Bmaintainer-approved hard ceiling, whichcontinues to guard cumulative creep. No budget constant changes.