fix: stabilize config default-leak landing tests (#56834) (thanks @openperf)

* fix(config): prevent AJV schema defaults from leaking into persisted config

Fixes #56772. Ensures that channel and plugin AJV validations respect the applyDefaults option, preventing runtime defaults from being written to openclaw.json during doctor/update flows.

* test: address review feedback on #56772 fix

- Split validation.channel-metadata.test.ts into applyDefaults true/false cases (fixes CI)

- Update io.write-config.test.ts regression test to use a mock plugin registry, ensuring it actually exercises the AJV default injection path

* fix(config): revert applyDefaults passthrough to prevent required-field regression

Codex-connector correctly identified that BlueBubbles channel schema marks

enrichGroupParticipantsFromContacts as both default:true and required.

Passing applyDefaults:false during write validation would cause required

checks to fail, breaking writeConfigFile entirely.

Reverted validation.ts to always use applyDefaults:true for channel/plugin

AJV validation. The protection against default leakage into persisted config

is fully handled by the persistCandidate change in io.ts (cfgToWrite uses

the pre-validation merge-patched value, not validated.config).

Updated validation.channel-metadata.test.ts to reflect this architecture.

* fix(config): apply legacy web-search normalization to persistCandidate

* fix: stabilize config default-leak landing tests (#56834) (thanks @openperf)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
This commit is contained in:
wangchunyue
2026-03-30 11:49:17 +08:00
committed by GitHub
parent 22f56433e0
commit 16df3de098
5 changed files with 185 additions and 38 deletions

View File

@@ -638,12 +638,14 @@ async function maybeRestartService(params: {
invocationCwd: params.invocationCwd,
});
} catch (err) {
if (!params.opts.json) {
defaultRuntime.log(
theme.warn(
`Failed to refresh gateway service environment from updated install: ${String(err)}`,
),
);
// Always log the refresh failure so callers can detect it (issue #56772).
// Previously this was silently suppressed in --json mode, hiding the root
// cause and preventing auto-update callers from detecting the failure.
const message = `Failed to refresh gateway service environment from updated install: ${String(err)}`;
if (params.opts.json) {
defaultRuntime.error(message);
} else {
defaultRuntime.log(theme.warn(message));
}
}
}