Skip to content

fix(config): validate config writes against the config being written - #126734

Merged
steipete merged 2 commits into
mainfrom
steipete/onboard-false-plugin-warnings
Aug 20, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/onboard-false-plugin-warnings

Conversation

@steipete

@steipete steipete commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

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.md on a fresh state dir:

$ OPENAI_API_KEY=... openclaw onboard --non-interactive --accept-risk --skip-health \
    --mode local --auth-choice openai-api-key --secret-input-mode ref \
    --gateway-port 19091 --skip-bootstrap --skip-skills

Config warnings:
- plugins.entries.openai: plugin not found: openai (stale config entry ignored; remove it from plugins config)
- plugins.entries.codex: plugin not installed: codex - install the official external plugin with: openclaw plugins install @openclaw/codex

Both warnings are false:

  • the pre-write backup has plugins: {}, so that same run wrote both entries;
  • openclaw plugins list --json reports both as status: "loaded", enabled: true, sourced from
    dist/extensions/{openai,codex}/index.js (148 plugins total);
  • immediately afterwards openclaw config validate prints Config valid with empty stderr, and
    openclaw models list emits no such warnings.

The trigger is provider auth selection: --auth-choice skip writes plugins: {} and emits zero
warnings, while --auth-choice openai-api-key writes the two entries and emits two warnings. A new
operator'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 onboard runs with loadPlugins: "never" by design. The OpenAI flow stages
plugins.entries.{openai,codex} in the in-memory candidate, but before the final commit
ensureOnboardingAgent creates the first agent, and createAgent reads and writes the current disk
config — 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, resolveConfigValidationMetadataPluginIds returns an
explicit empty scope, which loadPluginManifestRegistryForInstalledIndex deliberately maps to an
empty manifest registry — a valid scoped snapshot for that intermediate config.

writeConfigFileFromContext then passed that snapshot into strict validation of the final candidate.
Injecting it set registryInfo eagerly and bypassed candidate-derived resolution, so ensureKnownIds()
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: 8dd0434f86f2 added both strict semantic validation and the
pluginMetadataSnapshot: snapshotRead.pluginMetadataSnapshot argument. Before that, the validator
already 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 === 0 guard 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 contains
Config warnings: and both false lines. After, on a build of this branch with the identical command
and a fresh state dir: zero matches for plugin not found: openai or plugin 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), and
node scripts/check-changed.mjs on an isolated Testbox.

Regression coverage is a built-CLI process test (test/onboard-plugin-warnings.e2e.test.ts) that
runs 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 --json in that same state that both
plugins 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-artifacts is failing on main, not on this diff: the Control UI startup-JS ratchet is over
budget for every PR that builds the UI. Unrelated PR #126725 (plugin-sdk API diff strings) measures
348289 B and this branch measures 348351 B, both against 347023 B + 1056 B tolerance. Twenty-six
UI 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.md rule on landing onto red main, the smallest correct fix is carried in this
PR: config/control-ui-startup-budget-baseline.json moves to the CI-measured 348351 B, using the
--startup-js-bytes value the checker's own comment asks for. That is 1328 B of the checker's
4096 B ratchet allowance and stays well under the 358400 B maintainer-approved hard ceiling, which
continues to guard cumulative creep. No budget constant changes.

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.
@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 20, 2026 16:10
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 20, 2026
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.
@steipete
steipete merged commit 46c71b5 into main Aug 20, 2026
230 checks passed
@steipete
steipete deleted the steipete/onboard-false-plugin-warnings branch August 20, 2026 16:33
@steipete

Copy link
Copy Markdown
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant