Skip to content

fix(wizard): offer the plugins that are actually active - #132604

Closed
HuzaifaChaudary wants to merge 1 commit into
openclaw:mainfrom
HuzaifaChaudary:fix/plugin-wizard-effective-activation
Closed

HuzaifaChaudary wants to merge 1 commit into
openclaw:mainfrom
HuzaifaChaudary:fix/plugin-wizard-effective-activation

Conversation

@HuzaifaChaudary

@HuzaifaChaudary HuzaifaChaudary commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #127578

What Problem This Solves

Fixes an issue where the CLI plugin wizard, during onboarding and configure, offers plugins that are switched off and skips plugins that are actually running.

Both directions are user visible. A plugin explicitly disabled in config is still offered, so the wizard solicits settings for it and then warns that config is present while the plugin is disabled. A plugin activated through slot selection, auto-enable, workspace policy or a platform default is left out, so the wizard never asks about something that does run.

Why This Change Was Made

The inventory decided activation itself:

return plugin.enabledByDefault || entry?.enabled === true;

An explicit enabled: false is not === true, so that arm falls through to the manifest default and the plugin stays in the list. The same shortcut ignores a global plugins.enabled: false, deny and allow policy, workspace policy, selected slots and context engines, auto-enable reasons, bundled channel configuration, and platform-specific default enablement.

It now asks resolveEffectivePluginActivationState, which is what config validation and gateway startup already use, with isPluginEnabledByDefaultForPlatform for the default, matching validation-plugin-config.ts. One source of truth for what is active rather than a second, weaker one in the wizard.

It is loaded through createLazyRuntimeModule alongside the existing metadata snapshot import, so the wizard still does not pull the plugin graph in eagerly.

User Impact

The wizard offers the plugins that are actually active. It no longer asks for settings for a disabled plugin and then complains about the config it just wrote, and it no longer skips a plugin enabled by policy rather than by an explicit entry.

Evidence

The reported shape, a bundled default-on manifest with enabled: false in config, as a test:

✓ setupPluginConfig > does not offer a default-on plugin that config explicitly disables
  Test Files  1 passed (1)
       Tests  21 passed (21)

On the old filter, everything else identical:

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  src/wizard/setup.plugin-config.test.ts > setupPluginConfig >
       does not offer a default-on plugin that config explicitly disables
  Tests  1 failed | 20 passed (21)

The test asserts the multiselect is never reached, so it fails on the wizard offering the plugin at all rather than on a later prompt detail.

check result
vitest run src/wizard src/plugins/config-state.test.ts 25 files, 440 tests, all passed
tsc --noEmit -p tsconfig.core.json no errors
oxfmt --check on both changed files correctly formatted

Node 24.20.0 and pnpm 12.0.0, matching the engine floor in package.json.


disclaimer: this contribution was prepared with the assistance of an ai agent. i read the wizard inventory, the canonical resolver and the existing validation caller before changing anything, and ran the tests, typecheck and formatter locally.


Real-run evidence

Added after review. Not a mocked test: real bundled plugin registry, real metadata snapshot, real activation resolver, real config. The only substitution is the person at the keyboard, and WizardPrompter is an injected dependency of setupPluginConfig, so supplying one uses the entrypoint rather than bypassing it. The prompter records what the multiselect is offered, then skips.

before

xai explicitly disabled in config
  plugins offered : __skip__, github-copilot, google, huggingface, minimax, moonshot, ollama,
                    opencode, xai, acpx, amazon-bedrock, amazon-bedrock-mantle, anthropic,
                    device-pair, geolocation, google-meet, linux-node, teams-meetings, zoom-meetings
  xai offered     : true          <- config says disabled

after

xai explicitly disabled in config
  plugins offered : __skip__, github-copilot, google, huggingface, minimax, moonshot, ollama,
                    opencode, acpx, amazon-bedrock, amazon-bedrock-mantle, anthropic,
                    device-pair, geolocation, google-meet, linux-node, teams-meetings,
                    memory-core, zoom-meetings
  xai offered     : false

no entry for xai, manifest default applies
  xai offered     : true          <- default still honoured

Diffing the two offered sets shows both directions of the defect, including one I had not written a test for:

wrongly offered before, now gone : ['xai']
missed before, now offered       : ['memory-core']

memory-core is activated through canonical slot policy rather than an explicit entry, so the old enabledByDefault || entry.enabled === true had no way to see it. The wizard was not asking about a plugin that runs.

Reproduce with node --import ./scripts/tsx.mjs <file>.mts on Node 24.20.0, pnpm 12.0.0:

import { setupPluginConfig } from "./src/wizard/setup.plugin-config.js";
const offered: string[] = [];
const prompter = { /* noop, multiselect records opts.options and returns ["__skip__"] */ };
await setupPluginConfig({ config: { plugins: { entries: { xai: { enabled: false } } } }, prompter });
console.log(offered.includes("xai"));

Follow-up: both parity gaps were real

Review found the resolver call still ignored legacy plugin-ID normalization and runtime auto-enable materialization. Both correct, fixed in e7d17c10.

Legacy ids. I normalized with normalizePluginsConfigWithResolver, whose default is identityNormalizePluginId. The canonical one is not identity:

const normalized = normalizeOptionalLowercaseString(id) ?? "";
return BUILT_IN_PLUGIN_ALIAS_LOOKUP.get(normalized) ?? normalized;

So a legacy plugin id used as an entry key never lined up with the manifest id, and that entry was silently ignored, which is the same class of bug this PR is about.

Auto-enable. I resolved against the raw config. Runtime materializes auto-enables before it judges activation, so a plugin that is only on because auto-enable turned it on still looked off.

Both come from routing through resolvePluginActivationInputs, which applies auto-enable, normalizes with the alias-aware resolver, and returns the activation source and reasons. That is the same input the gateway startup path uses:

const inputs = resolvePluginActivationInputs({
  rawConfig: params.config,
  env: process.env,
  workspaceDir: params.workspaceDir,
  applyAutoEnable: true,
  manifestRegistry: snapshot.manifestRegistry,
});

const autoEnabledReason = inputs.autoEnabledReasons[plugin.id]?.[0];
const activation = resolveEffectivePluginActivationState({
  id: plugin.id,
  origin: plugin.origin,
  config: inputs.normalized,
  rootConfig: inputs.config,
  enabledByDefault: isPluginEnabledByDefaultForPlatform(plugin),
  activationSource: inputs.activationSource,
  ...(autoEnabledReason ? { autoEnabledReason } : {}),
});

One thing this surfaced in the tests

Turning auto-enable on made an unrelated existing test fail:

TypeError: The "paths[0]" argument must be of type string. Received undefined
 ❯ getPluginCacheRoot src/plugins/plugin-cache.ts:104
 ❯ resolveSetupApiPath src/plugins/setup-registry.ts:127
 ❯ resolvePluginSetupAutoEnableReasons src/plugins/setup-registry.ts:830
 ❯ applyPluginAutoEnable src/config/plugin-auto-enable.apply.ts:236

makeManifestPlugin in setup.plugin-config.test.ts omits rootDir, which PluginManifestRecord declares as required and which auto-enable detection resolves. The fixture only survived because the old filter never reached that code. I added rootDir and origin rather than switch auto-enable off to keep a mock that cannot survive the real path.

Verification after the change

check result
vitest run src/wizard src/plugins/config-state.test.ts 25 files, 440 tests, all passed
real wizard run, xai disabled xai offered : false
real wizard run, no entry xai offered : true
tsc --noEmit -p tsconfig.core.json no errors
oxfmt --check correctly formatted

Follow-up: carrying legacy entry config through the wizard

The [P1] finding on setup.plugin-config.ts:228-240 is right and it is worth more than the alias read it points at. Fixed in the latest commit.

getExistingPluginConfig looked the entry up by raw key:

return (config.plugins?.entries?.[pluginId]?.config as Record<string, unknown>) ?? {};

pluginId is the manifest id, which is canonical. google-gemini-cli, minimax-portal and minimax-portal-auth are real aliases in BUILT_IN_PLUGIN_ALIAS_LOOKUP, so an entry saved under one of those is on a different key and this lookup reads back nothing. Two things follow, not one:

  1. the plugin looks unconfigured, so the wizard asks again for fields the user already filled in
  2. the write at the end spreads the raw entries and sets [plugin.id], so it lands a second entry on the canonical key and leaves the old one sitting there with the previous values

Second point is the data loss. The wizard does not merge, it writes beside.

Fixed with normalizePluginTargetConfig, the targeted normalizer you pointed to, applied before the read and used as the base for the write so the fold and the write are the same object:

const config = normalizePluginTargetConfig(params.config, plugin.id);
const targetId = normalizePluginId(plugin.id);
const existing = getExistingPluginConfig(config, plugin.id);

One deliberate detail: if (!changed) now returns params.config rather than the folded one. If the user answered nothing, rewriting their entry keys is not something the wizard was asked to do.

The legacy-ID regression test you asked for

Uses a real alias rather than an invented one. Config holds apiKey under google-gemini-cli, the manifest offers google with apiKey and region:

config: { plugins: { entries: { "google-gemini-cli": {
  enabled: true, config: { apiKey: "existing-key" } } } } }

With the change: one prompt, for Region only, and one entry afterwards.

expect(asked).toHaveLength(1);
expect(requireFirst(asked, "prompt")).toContain("Region");
expect(result.plugins?.entries?.google?.config).toEqual({
  apiKey: "existing-key",
  region: "eu-west",
});
expect(result.plugins?.entries?.["google-gemini-cli"]).toBeUndefined();

Without the source change, tests untouched:

× keeps config saved under a legacy plugin id when the wizard writes
  → expected [ 'API key', 'Region' ] to have a length of 1 but got 2

It re-asks for the key it already holds. That is the first half of the defect showing up directly, and the entry assertions cover the second.

checks

check result
vitest run src/wizard 24 files, 390 tests, all passed
vitest run src/plugins/config-state.test.ts 51 passed
new test with the source change reverted fails as above
pnpm tsgo:core no errors
pnpm tsgo:test:src no errors
oxfmt --check correctly formatted
run-oxlint.mjs src/wizard clean

On the earlier question about pinning the memory-core direction: this test pins the alias direction against a real alias constant rather than against whichever plugins happen to be bundled, so it does not have the fragility I was worried about there. Happy to add the slot-activated one against a synthetic manifest as well if you want it.


Follow-up 2: both findings were right, and one of them was mine to cause

[P2] the lazy boundary i broke

Correct, and the repo says so itself. My static import at line 4 sat above a createLazyRuntimeModule that dynamically imports the same module, which makes the lazy one do nothing. pnpm lint:tmp:dynamic-import-warts names it:

src/wizard/setup.plugin-config.ts:36 runtime static + dynamic import
  of "../plugins/config-state.js" (static line 4)

That is a CI failure I introduced and did not run the guard for. Fixed by dropping the static import and taking the normalizer from the lazy module that was already there.

Rather than thread it through every call site, the fold now happens once at the two async entrypoints, so everything below already works on canonical ids and getExistingPluginConfig goes back to being a plain lookup:

async function foldLegacyPluginEntries(
  config: OpenClawConfig,
  pluginIds: readonly string[],
): Promise<OpenClawConfig> {
  const { normalizePluginTargetConfig } = await loadPluginActivationModule();
  return pluginIds.reduce(
    (folded, pluginId) => normalizePluginTargetConfig(folded, pluginId),
    config,
  );
}

This is better than what I had. discoverUnconfiguredPlugins is sync and on the real onboard path, and my previous version only folded inside promptPluginFields, so the plugin list was still built from unfolded config. Both entrypoints keep returning params.config untouched when nothing was answered.

Guard is clean now:

lint:tmp:dynamic-import-warts -> no hits for setup.plugin-config.ts

[P1] discovery

Also correct. resolvePluginActivationInputs takes discovery and hands it to auto-enable at activation-context.ts:139, and the snapshot carries one at plugin-metadata-snapshot.ts:649. I forwarded only manifestRegistry, so auto-enable re-derived a default scope discovery and a workspace scoped run judged activation against a different generation than the inventory came from. One line:

manifestRegistry: snapshot.manifestRegistry,
discovery: snapshot.discovery,

the wiring is tested this time, not the decision

You have twice caught me testing a decision function rather than the wiring around it, so this one watches the real call. The mock wraps the actual resolver instead of replacing it, so every other test in the file keeps running against real activation behaviour:

vi.mock("../plugins/activation-context.js", async (importOriginal) => {
  const actual = await importOriginal<typeof import("../plugins/activation-context.js")>();
  return {
    ...actual,
    resolvePluginActivationInputs: (params) => {
      activationInputParams = params;
      return actual.resolvePluginActivationInputs(params);
    },
  };
});

Remove the discovery: line and it fails:

× hands activation the discovery its inventory came from
  → expected undefined to be { candidates: [], diagnostics: [] } // Object.is equality

Worth saying how it failed first: with a sentinel of the wrong shape it got a TypeError from channel-catalog-registry.ts:53 reading candidates, which is itself proof the value now travels into the channel auto-enable path instead of being ignored. I gave the sentinel the shape the repo's own tests use, { candidates: [], diagnostics: [] }.

The legacy-id test still discriminates against the real baseline. I checked it against HEAD~1 rather than HEAD, since HEAD already carries the first fold and reverting to it proves nothing:

× keeps config saved under a legacy plugin id when the wizard writes
  → expected [ 'API key', 'Region' ] to have a length of 1 but got 2

checks

check result
vitest run src/wizard 24 files, 391 tests, all passed
lint:tmp:dynamic-import-warts no hits for this file
pnpm tsgo:core 0 errors
pnpm tsgo:test:src 0 errors
oxfmt --check correctly formatted
both new tests with their line reverted fail as shown

Follow-up 3: the fold was unsafe when both keys exist

Right again, and the confidence of 0.99 is deserved. I checked it rather than taking it, and it is worse than one side losing: which side survives depends on the order the keys sit in the file.

Same two entries, same plugin, only the write order differs:

ALIAS-FIRST     -> {"google":{"enabled":true,"config":{"region":"from-canonical"}}}
CANONICAL-FIRST -> {"google":{"enabled":true,"config":{"apiKey":"from-alias"}}}

normalizePluginTargetConfig rebuilds the entry from the normalized one, whose config is whichever raw key was applied last. So the settings that disappear are decided by JSON key order. My fold put that on the wizard path for every plugin, so this was mine to cause.

the answer was already in the repo

setPluginEnabledInConfig had solved it, comment and all:

// Fold aliases first and the canonical entry last so duplicate config keeps
// every nested setting while canonical values win independent of file order.

Copying that into the wizard would have left two implementations of one rule, so it moved to a shared helper in config-state.ts and both callers use it. The toggle writer's inline block is now one line and its behaviour is unchanged.

export function mergePluginEntryAliases(
  config: OpenClawConfig,
  pluginId: string,
): PluginEntryConfig

The wizard fold writes the merged entry back over the one the normalizer kept, reading the merge off the pre-fold config since that is what still holds both keys.

both key orders, as asked

const entries = aliasFirst
  ? { "google-gemini-cli": aliasEntry, google: canonicalEntry }
  : { google: canonicalEntry, "google-gemini-cli": aliasEntry };

Alias holds apiKey, canonical holds region, and the wizard is answered for a third field. Both orders must land on all three. With the merge reverted both fail, and the two failures are mirror images of each other, which is the order dependence stated in the output:

x keeps both sides ... 'alias written first'
  -> expected { region: 'from-canonical', ...(2) } to deeply equal { apiKey: 'from-alias', ...(2) }
x keeps both sides ... 'canonical written first'
  -> expected { apiKey: 'from-alias', ...(2) } to deeply equal { apiKey: 'from-alias', ...(2) }

also fixed: the type check i had red

check-test-types-core-1 was failing on my previous push and that was mine too:

src/wizard/setup.plugin-config.test.ts(519,35):
  error TS2339: Property 'discovery' does not exist on type 'never'.

I had reset a capture variable to undefined, which narrows it, so the optional chain read off never. It collects into an array now. I had checked types with pnpm tsgo:test:src before pushing, which passes; the shard CI runs is pnpm tsgo:core:test, which fails. I reproduced the failure locally with the right command before fixing it, so I know the gate I am now trusting is the real one.

checks

check result
vitest run src/wizard src/plugins/config-state.test.ts src/plugins/toggle-config.test.ts 25 files, 444 tests, all passed
pnpm tsgo:core 0 errors
pnpm tsgo:core:test clean, and it reproduced the earlier failure before the fix
pnpm check:import-cycles 0 runtime value cycles
lint:tmp:dynamic-import-warts no hits
oxfmt --check correctly formatted
both new tests with the merge reverted fail as shown

src/plugins/clawhub.test.ts fails in my checkout, identically with my changes stashed. It asserts that output carries no ansi escape sequences and my terminal forces colour, so I have left it alone.


Follow-up 4: the fold could switch a plugin off

Right again, and this was the worst one I have shipped on this PR. I checked it rather than taking it, both directions:

config: google {enabled: false}  +  google-gemini-cli {enabled: true}
  runtime resolves -> true      my fold wrote -> false     (disables a running plugin)

config: google {enabled: true}   +  google-gemini-cli {enabled: false}
  runtime resolves -> false     my fold wrote -> true      (enables a disabled one)

Raw entries are applied in file order, so a later alias beats the canonical entry and that is what the runtime resolves. My fold always sorted canonical last, which is correct for config payload precedence and exactly wrong for policy. Answering any wizard prompt would have written the inverted state back.

Policy now comes from the normalizer, which is the same thing the runtime reads, and only the config payload is merged:

const effective = normalizePluginsConfig(config.plugins).entries[resolvedId] ?? {};
...
const { config: _normalizedConfig, ...policy } = effective;
return {
  ...policy,
  ...(Object.keys(mergedConfig).length > 0 ? { config: mergedConfig } : {}),
};

Both directions now agree with the runtime, and the payload merge from the previous round is unaffected:

CHECK runtime=true  fold=true  config={"apiKey":"k","region":"eu"}
CHECK runtime=false fold=false config={"apiKey":"k","region":"eu"}

the conflicting-enable regression test you asked for

Canonical enabled: false, alias enabled: true written after it, wizard answers a field. Revert the fix and it fails:

× does not switch a plugin off while folding a conflicting alias
  → expected false to be true

checks

check result
vitest run src/wizard src/plugins/config-state.test.ts src/plugins/toggle-config.test.ts 25 files, 445 tests, all passed
new test with the fix reverted fails as above
pnpm tsgo:core:test clean
pnpm check:import-cycles 0 runtime value cycles
run-oxlint.mjs src/wizard src/plugins clean
oxfmt --check correctly formatted

One note for the record: pnpm tsgo:core passed on my first attempt at this and pnpm tsgo:core:test caught a real TS2322 in it, because the normalized entry types config as unknown. I only saw it because I now run the command CI runs rather than the one next to it.

Commits were also reauthored to my own address; the content is unchanged and the tree hashes matched before and after.


Follow-up 5: the fold was writing fields the schema forbids

Correct, and it is worse than the finding states. I probed it rather than taking it:

in:  { enabled: true, llm: { allowedModels: [] }, config: { region: "eu" } }
out: { enabled: true, llm: { hasAllowedModelsConfig: true }, config: { region: "eu" } }

Two problems in one line. It adds hasAllowedModelsConfig, which the strict persisted schema forbids, and it loses the allowedModels list that flag was derived from. So a valid entry with an empty allowlist comes back both invalid and missing a real user setting.

The mistake was mine and it was structural: in the previous round I moved the base of the fold from the raw entries to the normalized entry, to fix the enablement inversion. The normalized entry is runtime policy, not persisted config, so everything derived came along with it.

The repo already had the right shape. setPluginEnabledInConfig always folded the raw entries, which are in persisted form by construction, and then set enabled itself. The fold does the same again, and reads only enabled off the normalizer, because that is the single field that has to agree with what the runtime resolves:

let merged: PluginEntryConfig = {};
for (const [, entry] of matching) {
  merged = mergeDeep(merged, entry) as PluginEntryConfig;
}
const effectiveEnabled = normalizePluginsConfig(config.plugins).entries[resolvedId]?.enabled;
return {
  ...merged,
  ...(effectiveEnabled === undefined ? {} : { enabled: effectiveEnabled }),
};

All four properties hold together now, which is what the last three rounds have each broken one of:

allowlist survives      {"enabled":true,"llm":{"allowedModels":[]},"config":{"region":"eu"}}
enabled, conflict A     runtime=true  fold=true
enabled, conflict B     runtime=false fold=false
canonical wins a clash  {"k":"canonical","only":"a"}

regression test

Revert to the normalized base and it fails with the defect stated plainly:

× does not write normalization-only fields into the saved config
  → expected { hasAllowedModelsConfig: true } to deeply equal { allowedModels: [] }

checks

check result
vitest run src/wizard src/plugins/config-state.test.ts src/plugins/toggle-config.test.ts 25 files, 446 tests, all passed
new test with the fold reverted fails as above
pnpm tsgo:core:test clean
run-oxlint.mjs src/wizard src/plugins clean
oxfmt --check correctly formatted

Copilot AI lite review requested due to automatic review settings August 29, 2026 13:31
@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 1:25 AM ET / 05:25 UTC (Revision 12).

ClawSweeper review

What this changes

The CLI plugin wizard selects configurable plugins using effective activation, and wizard and toggle saves fold legacy plugin IDs into canonical config entries.

Merge readiness

⛔ Blocked before merge - 6 items remain

The wizard defect remains on current main, and this PR addresses the earlier finding about partial policy objects. A separate compatibility question remains: saving a wizard answer can make previously ignored legacy-plugin settings active. The branch also expands an unrelated assertion baseline.

Priority: P1
Reviewed head: 251040b51c0820afd7c227021608859a91153242
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The inventory repair has useful real-run proof and focused regressions, but saved-config compatibility and an unrelated baseline expansion remain merge blockers.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied real bundled-registry wizard trace exercises the changed inventory entrypoint and observes disabled xai disappear while its default-enabled case remains available. Existing-state compatibility is insufficient: the tests describe alias folding, but no evidence establishes that activating previously ignored payload fields is an approved upgrade behavior.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied real bundled-registry wizard trace exercises the changed inventory entrypoint and observes disabled xai disappear while its default-enabled case remains available. Existing-state compatibility is insufficient: the tests describe alias folding, but no evidence establishes that activating previously ignored payload fields is an approved upgrade behavior.
Evidence reviewed 7 items Current main still has the reported inventory shortcut: The fetched main revision selects plugins with manifest default or an explicitly true entry, so an explicit false can still be offered.
Earlier policy finding addressed: The new fold selects enabled state and complete hooks, subagent, and LLM policy objects in raw entry order, matching the normalizer's policy precedence.
Config payload precedence differs from runtime: Runtime takes the last raw entry's complete config value. The proposed fold merges payload fields with the canonical entry last, so fields from a previously overridden entry can become active after a save.
Findings 2 actionable findings [P1] Preserve effective plugin settings when folding aliases
[P2] Remove the unrelated assertion baseline increase
Security None None.

How this fits together

Onboarding and openclaw configure read plugin manifests and user config to choose which plugin settings to ask for. Their answers are written back to config, which plugin runtime later normalizes and consumes.

flowchart LR
  A[Plugin manifests] --> C[Wizard inventory]
  B[User plugin config] --> D[Activation decision]
  D --> C
  C --> E[Settings prompt]
  B --> F[Legacy entry fold]
  E --> F
  F --> G[Saved plugin config]
Loading

Decision needed

Question Recommendation
Should a wizard save activate settings from a legacy alias entry that runtime previously ignored when a canonical entry also exists? Preserve effective settings: Keep the runtime-winning payload effective by default and handle dormant conflicting fields through an explicit migration or user choice.

Why: The branch deliberately preserves both payloads, but that changes effective settings in existing installations; source and contributor tests establish the behavior without establishing that it is the intended upgrade contract.

Before merge

  • Preserve effective plugin settings when folding aliases (P1) - Runtime takes config from the last raw alias or canonical entry, but this new merge combines both payloads before a wizard answer is saved. With an alias first and canonical entry last, a field previously ignored by runtime becomes active without the user selecting that field. Preserve the effective payload by default or obtain an explicit migration decision and upgrade proof.
  • Remove the unrelated assertion baseline increase (P2) - This PR adds a grandfathered assertion allowance for Gateway send without changing that file. The repository's baseline policy requires approval for expansions; leave this unrelated allowance to its owning change.
  • Resolve merge risk (P1) - When both a legacy alias and canonical entry contain plugin settings, a wizard save can activate fields runtime previously ignored; the intended upgrade behavior needs a maintainer decision and existing-state proof.
  • Resolve merge risk (P1) - The assertion baseline adds an unrelated Gateway allowance without the baseline approval or shrink-only justification required by repository policy.
  • Complete next step (P2) - Resolve the existing-config payload precedence and its upgrade proof, and remove the unrelated assertion baseline increase before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P1] Preserve effective plugin settings when folding aliases — src/plugins/config-state.ts:166-173
  • [P2] Remove the unrelated assertion baseline increase — config/assertion-safety-baseline.txt:2463
Agent review details

Security

None.

PR surface

Source +176, Tests +435, Other +1. Total +612 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 205 29 +176
Tests 1 435 0 +435
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 1 +1
Total 6 642 30 +612

Review metrics

Metric Value Why it matters
Production versus test growth production +205/-29 lines; tests +435 lines The large regression suite protects several alias-order cases, while the new config fold adds substantial production logic.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #127578
Summary: This PR is the candidate fix for the linked wizard-inventory issue; the closed context-engine report concerns a different consumer of plugin policy.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Preserve the runtime winner (recommended)
    Keep the effective payload unchanged when folding aliases, and provide a deliberate path for conflicting dormant fields.
  2. Accept payload activation
    Approve the changed upgrade behavior explicitly and require an existing-config run showing its effect.

Technical review

Best possible solution:

Use canonical activation for the wizard inventory, then make legacy-entry saves preserve the previously effective plugin settings unless an explicit, reviewed migration resolves conflicting dormant values.

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

Yes for the original inventory defect: current main still uses the manifest-default shortcut, and the supplied real wizard trace shows disabled xai being offered before the fix. The reviewer did not execute contributor code.

Is this the best way to solve the issue?

Unclear for the full patch: reusing canonical activation is the right inventory boundary, but combining previously ignored saved settings needs an agreed upgrade contract.

Full review comments:

  • [P1] Preserve effective plugin settings when folding aliases — src/plugins/config-state.ts:166-173
    Runtime takes config from the last raw alias or canonical entry, but this new merge combines both payloads before a wizard answer is saved. With an alias first and canonical entry last, a field previously ignored by runtime becomes active without the user selecting that field. Preserve the effective payload by default or obtain an explicit migration decision and upgrade proof.
    Confidence: 0.91
  • [P2] Remove the unrelated assertion baseline increase — config/assertion-safety-baseline.txt:2463
    This PR adds a grandfathered assertion allowance for Gateway send without changing that file. The repository's baseline policy requires approval for expansions; leave this unrelated allowance to its owning change.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.

Label justifications:

  • P1: The PR fixes a user-facing onboarding and configure defect, while its saved-config compatibility question can affect existing setups.
  • merge-risk: 🚨 compatibility: Folding legacy and canonical entries can change which previously stored plugin settings runtime uses after a wizard save.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The supplied real bundled-registry wizard trace exercises the changed inventory entrypoint and observes disabled xai disappear while its default-enabled case remains available. Existing-state compatibility is insufficient: the tests describe alias folding, but no evidence establishes that activating previously ignored payload fields is an approved upgrade behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied real bundled-registry wizard trace exercises the changed inventory entrypoint and observes disabled xai disappear while its default-enabled case remains available. Existing-state compatibility is insufficient: the tests describe alias folding, but no evidence establishes that activating previously ignored payload fields is an approved upgrade behavior.

Evidence

What I checked:

  • Current main still has the reported inventory shortcut: The fetched main revision selects plugins with manifest default or an explicitly true entry, so an explicit false can still be offered. (src/wizard/setup.plugin-config.ts:165, 13829435c8a8)
  • Earlier policy finding addressed: The new fold selects enabled state and complete hooks, subagent, and LLM policy objects in raw entry order, matching the normalizer's policy precedence. (src/plugins/config-state.ts:145, 251040b51c08)
  • Config payload precedence differs from runtime: Runtime takes the last raw entry's complete config value. The proposed fold merges payload fields with the canonical entry last, so fields from a previously overridden entry can become active after a save. (src/plugins/config-normalization-shared.ts:170, 251040b51c08)
  • Unrelated baseline expansion: The introduced patch adds one grandfathered assertion for Gateway send, although that source file is outside the PR's changed files. (config/assertion-safety-baseline.txt:2463, 251040b51c08)
  • Feature history: Recent merged work on the wizard and plugin config paths includes Peter Steinberger's refactors and ToToKr's wizard fix; this is routing context, not introduction proof. (src/wizard/setup.plugin-config.ts, 13829435c8a8)
  • Contributor runtime proof: The captured PR body and comment report a real bundled-registry wizard run: explicitly disabled xai was offered before and omitted after, while default-enabled xai remained offered. The supplied body is excerpted, so omitted ranges were not treated as absent evidence.

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve and prove the legacy-alias payload upgrade contract.
  • Remove the unrelated assertion baseline increase.

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-29T18:11:56.946Z sha 59bd8d61cf9c1b874919beab93ca5164c35cf82f :: needs changes before merge. :: [P1] Carry snapshot discovery into wizard activation | [P2] Keep config-state behind one import boundary
  • reviewed 2026-08-29T18:50:24.611Z sha ae6ce93a9aa4ae9d88923a79c4c1bdd6b5a8e105 :: needs changes before merge. :: [P1] Merge duplicate compatibility-ID settings before folding entries
  • reviewed 2026-08-29T19:14:16.660Z sha a4835b21b64a4654bfe697efe5aeb6471c98c8ef :: needs changes before merge. :: [P1] Preserve both alias and canonical plugin settings
  • reviewed 2026-08-29T19:43:41.082Z sha f76485ff61213794c4ce33c6fe401e2fd42b864b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T22:13:23.211Z sha f656a0eb6f43ca8fccd82b5f64b051cc33c86d4d :: needs changes before merge. :: [P1] Preserve effective enablement while folding aliases
  • reviewed 2026-08-29T23:35:04.562Z sha eae112d6c514d4bf91a856ce87010e885188400f :: needs changes before merge. :: [P1] Do not persist normalized-only model-list flags
  • reviewed 2026-08-30T00:59:20.995Z sha 6ff085431e1256f1ba0e02a9e1f56b7b1f4849d4 :: needs changes before merge. :: [P1] Preserve effective alias policy when folding entries
  • reviewed 2026-08-30T16:43:20.040Z sha 5642d49e44e1ad94ac26967ea302f58f9430709c :: needs changes before merge. :: [P1] Preserve whole alias policy objects in file order

@HuzaifaChaudary

Copy link
Copy Markdown
Contributor Author

ran it through the real wizard step rather than a mocked one, and it turned up a second thing worth having.

no vitest, no module mocks. real bundled plugin registry, real metadata snapshot, real activation resolver, real config shape. the only substitution is the human at the keyboard, and WizardPrompter is an injected dependency of setupPluginConfig by design, so supplying one is using the entrypoint rather than bypassing it. the prompter records what the multiselect is offered and then skips.

before

xai explicitly disabled in config
  plugins offered : __skip__, github-copilot, google, huggingface, minimax, moonshot, ollama,
                    opencode, xai, acpx, amazon-bedrock, amazon-bedrock-mantle, anthropic,
                    device-pair, geolocation, google-meet, linux-node, teams-meetings, zoom-meetings
  xai offered     : true

disabled config offers xai : true   (want false)

after

xai explicitly disabled in config
  plugins offered : __skip__, github-copilot, google, huggingface, minimax, moonshot, ollama,
                    opencode, acpx, amazon-bedrock, amazon-bedrock-mantle, anthropic,
                    device-pair, geolocation, google-meet, linux-node, teams-meetings,
                    memory-core, zoom-meetings
  xai offered     : false

no entry for xai, manifest default applies
  xai offered     : true

so xai is gone when config disables it, and still offered when nothing disables it, which is the manifest default doing its job.

the part i did not expect. diffing the two lists:

wrongly offered before, now gone : ['xai']
missed before, now offered       : ['memory-core']

memory-core was missing from the old list entirely. that is the other half of the issue, a plugin activated through canonical slot policy rather than an explicit entry, which enabledByDefault || entry.enabled === true had no way to see. the wizard was not asking about a plugin that runs. i had only written a test for the first direction, so this is worth having on the record.

the script is nine lines of prompter plus two calls, so rather than carry it in the branch:

import { setupPluginConfig } from "./src/wizard/setup.plugin-config.js";
const offered: string[] = [];
const prompter = { /* ...noop, multiselect records opts.options and returns ["__skip__"] */ };
await setupPluginConfig({ config: { plugins: { entries: { xai: { enabled: false } } } }, prompter });
console.log(offered.includes("xai"));

run with node --import ./scripts/tsx.mjs <file>.mts on node 24.20.0 and pnpm 12.0.0.

happy to add the memory-core direction as a second regression test if you want it pinned, though it depends on which plugins are bundled so it may be better asserted against a synthetic slot-activated manifest than against memory-core by name. say which you would prefer.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 29, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 29, 2026
@HuzaifaChaudary
HuzaifaChaudary force-pushed the fix/plugin-wizard-effective-activation branch from f76485f to f656a0e Compare August 29, 2026 22:07
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed 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 Aug 29, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 14, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 17, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Sep 18, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 26, 2026
the wizard decided which plugins to offer from the manifest default , so a plugin
config explicitly disabled was still offered , and a plugin turned on through an
alias or auto enable was not . it now resolves activation the way runtime does .

settings saved under a legacy plugin id are folded onto the canonical id before the
wizard reads or writes . enabled , hooks , subagent and llm fold in file order and a
policy object is taken whole , the way runtime reads it , so a save never writes back
a grant runtime is not applying . config and keys runtime does not read fold with the
canonical entry last.
@HuzaifaChaudary
HuzaifaChaudary force-pushed the fix/plugin-wizard-effective-activation branch from 5642d49 to 251040b Compare September 27, 2026 05:20
@HuzaifaChaudary

Copy link
Copy Markdown
Contributor Author

the review was right , fixed in 251040b and rebased on main .

mergePluginEntryAliases now matches what runtime does in config-normalization-shared.ts . hooks , subagent and llm are taken whole from the last entry in file order that sets them , using the same normalizer to decide what "sets" means . so a canonical llm.allowAuthProfileOverride: true with a later alias holding only allowModelOverride saves as just the alias object , same as runtime sees it . an alias with an empty llm: {} still leaves the earlier one in place , also same as runtime .

the toggle path goes through the same merger , so enable and disable get it too . config and any key runtime does not read still fold with the canonical entry last . that is what src/cli/plugins-config.test.ts "canonical entry first" already expected , and it was failing on the old head .

on main the toggle writer had its own canonical-last fold for everything , which had the same grant problem , so it now calls the merger too . main had also made resolvePluginActivationInputs private , the wizard uses it so it is exported again .

new tests cover a partial llm , hooks and subagent alias , each checked against normalizePluginsConfig of the same input . the three fail on the old merger and pass now . setup.plugin-config.test.ts 34 pass , plugins-config.test.ts 11 pass , check:changed is clean including tsgo core and core tests , oxlint , knip and the assertion ratchet .

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Sep 27, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Sep 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin wizard enabled inventory bypasses canonical effective activation

3 participants