Skip to content

fix(plugins): read plugin policy through the canonical enable owner - #205673

Closed
SunnyShu0925 wants to merge 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/plugin-policy-canonical-owner
Closed

SunnyShu0925 wants to merge 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/plugin-policy-canonical-owner

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #205672

What Problem This Solves

Running openclaw doctor with plugins.allow: [] and an enabled Codex entry silently drops the personal Codex asset reminder, the /tools inventory notice tells operators to add browser to plugins.allow even when the browser plugin was disabled somewhere else entirely, and the OpenShell workspace binding ignores a padded denylist entry and enables File Transfer against the operator's policy.

  • Problem: three call sites decided plugin enablement by hand instead of asking the existing policy owner, so they disagreed with what actually loads. The doctor scan treated any allow array as authoritative and never consulted entries, so an empty allowlist (which restricts nothing, as established in fix(diffs): honor empty plugin allowlists for language packs #191708) turned the scan off. The /tools notice blamed plugins.allow for every missing browser and produced no notice at all when the plugin was denylisted. The OpenShell workspace binding compared raw ids in allow/deny/entries, so " File-Transfer " never matched the denylist and the binding enabled File Transfer anyway.
  • Solution: each site now normalizes with normalizePluginsConfig and asks resolveEffectiveEnableState for the decision, which returns both enabled and the reason (plugins disabled / blocked by denylist / disabled in config / not in allowlist). The notice now names that reason and only suggests editing plugins.allow when the allowlist is actually the cause.
  • What changed: extensions/openshell/src/worker-workspace.ts, src/commands/doctor/shared/codex-native-assets.ts and src/agents/tools-effective-inventory.ts replace their hand-rolled checks with the shared owner; the new scenarios are folded into three existing test cases (net test line delta -1).
  • What did NOT change: the decision order, empty-allowlist semantics and every other rule still live in resolveEffectiveEnableState; no new option, schema, or config surface was added, and the two notices keep their existing ids and severities.

Why This Change Was Made

  • Best fix: route all three call sites through the single existing owner (normalizePluginsConfig + resolveEffectiveEnableState) rather than teaching each site the policy rules again. The owner already encodes the order deny -> entry -> allowlist and the empty-allowlist rule, and the repo already uses it this way from extensions/browser/src/plugin-enabled.ts and extensions/codex/index.ts, so this removes duplicated policy instead of adding a fourth variant.
  • Alternative(s): patching each site locally (add an allow.length > 0 guard, add a deny check, normalize the ids inline) was rejected because it leaves three copies of the same policy that can drift again; writing a new shared helper for these three callers was rejected because the owner already exists.
  • Risk: the doctor scan and the OpenShell gate now consult the bundled default (enabledByDefault) as well as the config, so a Codex config block or an explicit allowlist entry counts as opt-in even with an empty allowlist. That matches what the Codex plugin itself gates on, and the widest supported case (no plugins section at all) still skips the scan, as before. The notice's accessory sentence changed for non-allowlist causes, so any doc that quoted the old sentence needs a look.

User Impact

Operators who keep an empty plugins.allow now still see the personal Codex asset reminder, and when the browser tool is missing the reason reported matches the reason the plugin is actually off. Following that advice no longer means widening plugin policy for a plugin that was disabled on purpose. An operator who denylisted File Transfer (even with padded whitespace in the id) no longer gets it silently re-enabled by an OpenShell workspace binding.

Evidence

Every cell below states its full plugins input. Doctor cells share one HOME fixture containing two personal skills (.codex/skills/tweet-helper/SKILL.md and .agents/skills/agent-helper/SKILL.md); the count is grep -c 'Personal Codex CLI assets found' on doctor --non-interactive output. Every tools.effective cell also has browser: { enabled: true } in the config; the notice column quotes the browser-plugin-not-allowed message.

Case Full plugins input Before (base 1342a4e) After (head eb5e466)
doctor, empty allow + enabled entry {"allow":[],"entries":{"codex":{"enabled":true}}} 0 asset lines 1 line, 2 skills
doctor, enabled entry, no allow key (control) {"entries":{"codex":{"enabled":true}}} 1 line, 2 skills 1 line, 2 skills
doctor, padded allow id (control) {"allow":[" CODEX "]} 1 line, 2 skills 1 line, 2 skills
doctor, padded deny id (control) {"allow":[],"deny":[" Codex "]} 0 0
doctor, allowlist without codex (control) {"allow":["slack"]} 0 0
doctor, no plugins section (control) (key absent) 0 0
tools.effective, entry disabled {"allow":[],"entries":{"browser":{"enabled":false}}} plugins.allow does not include browser disabled in config
tools.effective, plugins globally disabled {"enabled":false,"allow":[]} plugins.allow does not include browser plugins disabled
tools.effective, denylisted {"deny":["browser"]} no notice at all blocked by denylist
tools.effective, browser enabled (control) {"entries":{"browser":{"enabled":true}}} no notice no notice
tools.effective, empty allow only (control) {"allow":[]} no notice no notice
tools.effective, other allow + entry on (control) {"allow":["slack"],"entries":{"browser":{"enabled":true}}} no notice no notice
Case Before (base 1342a4e) After (head eb5e466)
openshell worker configure, plugins.deny: [" File-Transfer "] + agent workspace binding exit 0; config rewritten with File Transfer enabled and the workspace binding applied exit 1; refusal message; config file byte-identical
upgrade, latest stable -> head, same state dir, {"allow":[],"entries":{"codex":{"enabled":true}}} stable doctor: 0 asset lines head doctor --fix then doctor: 1 line, 2 skills; plugins subtree preserved

Both arms were built with node --import ./scripts/tsx.mjs scripts/build-all.mts cliStartup and driven by the shipped launcher, each case in an isolated OPENCLAW_STATE_DIR and HOME. The base arm is frozen at 1342a4e, an ancestor of this PR's base dd89642; the three touched production files are byte-identical between those two commits (git diff empty), so the base arm exercises exactly the base behavior of every changed line.

Doctor scan, real openclaw doctor

Both arms report their own commit, so the cells cannot be confused:

$ node openclaw.mjs --version
OpenClaw 2026.11.10 (1342a4e)     # base arm
OpenClaw 2026.11.10 (eb5e466)     # this head

$ OPENCLAW_STATE_DIR=<isolated> HOME=<isolated> node openclaw.mjs doctor --non-interactive
# base, plugins: {"allow":[],"entries":{"codex":{"enabled":true}}}
(no "Doctor info" section at all - grep -c 'Personal Codex CLI assets found' => 0)

# this head, same config
┌  Doctor info ────────────────────────────────────────────────────────────╮
│  - Personal Codex CLI assets found (2 skills, 0 plugins, 0 config        │
│    files, 0 hook files) in <home>/.codex and <home>/.agents/skills;      │
│    native Codex-mode agents use isolated per-agent homes and will not    │
│    load them.                                                            │
└──────────────────────────────────────────────────────────────────────────╯

Counts across the six doctor configs are the first six rows of the table above: base 0 1 1 0 0 0, head 1 1 1 0 0 0; only the empty-allow-plus-entry cell changed.

/tools inventory, real Gateway + real RPC

A real Gateway (node openclaw.mjs gateway --port <port> --auth token ...) served the cells, the session came from sessions.create, and each cell is a full gateway call. Five cells ran as config hot-reloads on one Gateway per arm; the plugins disabled cell ran as a cold Gateway start on both arms (its base notice only fires when allow is an array, which is why its input includes allow: []).

$ node openclaw.mjs gateway call tools.effective --params '{"sessionKey":"agent:main:dashboard:..."}' --json

# base, plugins: {"allow":[],"entries":{"browser":{"enabled":false}}}
{"id":"browser-plugin-not-allowed","severity":"warning","message":"Browser is configured, but plugins.allow does not include browser. Add \"browser\" to plugins.allow or remove the restrictive plugin allowlist."}

# this head, same config
{"id":"browser-plugin-not-allowed","severity":"warning","message":"Browser is configured, but the browser plugin is disabled by plugin policy (disabled in config). Remove the plugin disable that applies to browser."}

# base, plugins: {"enabled":false,"allow":[]}  (cold start)
{"id":"browser-plugin-not-allowed","severity":"warning","message":"Browser is configured, but plugins.allow does not include browser. Add \"browser\" to plugins.allow or remove the restrictive plugin allowlist."}

# this head, same config (cold start)
{"id":"browser-plugin-not-allowed","severity":"warning","message":"Browser is configured, but the browser plugin is disabled by plugin policy (plugins disabled). Remove the plugin disable that applies to browser."}

# this head, plugins: {"deny":["browser"]}   (base printed no notice at all)
{"id":"browser-plugin-not-allowed","severity":"warning","message":"Browser is configured, but the browser plugin is disabled by plugin policy (blocked by denylist). Remove the plugin disable that applies to browser."}

# controls (browser enabled / allow:[] only / allow:["slack"] + entry on) - no notices on either arm

OpenShell binding, real shipped openshell worker configure

Config: plugins.deny: [" File-Transfer "] plus an agent workspace binding (agentId: main, remoteRoot: /sandbox/agent-main) and the worker profile/model settings the command requires. The OpenShell sandbox peer is a synthetic executable that answers only the node-identity and workspace-check sandbox calls; every OpenClaw step — config snapshot, plugin policy decision, binding composition, config mutation — runs from the shipped bundle. No real OpenShell device is available locally.

$ OPENCLAW_STATE_DIR=<isolated> HOME=<isolated> node openclaw.mjs openshell worker configure demo-sandbox --worker-profile w1 --apply

# base (1342a4e): exit 0
# config file CHANGED: entries.file-transfer.enabled: true written, workspace
# binding and cloudWorkers profile applied despite the deny entry.

# this head (eb5e466): exit 1
Agent workspace binding requires File Transfer; preserve the existing plugin restriction and enable it explicitly before retrying.
# config file UNCHANGED (cmp against the pre-run copy: identical).

Upgrade path, latest stable -> head on the same state

One state dir, config plugins: {"allow":[],"entries":{"codex":{"enabled":true}}}, the same two-skill HOME fixture throughout:

$ openclaw --version                      # npm [email protected]
OpenClaw 2026.11.10 (6ea542f)
$ openclaw doctor --non-interactive       # stable: grep count => 0

$ node openclaw.mjs doctor --fix          # this head, migration entry, exit 0
$ node openclaw.mjs doctor --non-interactive
# grep count => 1 ("2 skills"); plugins subtree parsed-equal to the input
# ({"allow":[],"entries":{"codex":{"enabled":true}}}); both SKILL.md assets
# intact; no files removed.

Built bundle form

The bundles the two arms actually executed:

base  dist/codex-native-assets-*.mjs
  isCodexPluginConfigured(e){const t=e.plugins;if(t?.enabled===false)return false;const n=t?.allow;
  if(Array.isArray(n))return n.some(e=>normalizeOptionalLowercaseString(e)===`codex`); ... }

head  dist/codex-native-assets-*.mjs
  isCodexPluginConfigured(e){const t=normalizePluginsConfig(e.plugins);return resolveEffectiveEnableState({
  id:`codex`,origin:`bundled`,config:t,rootConfig:e,enabledByDefault:t.entries.codex!==void 0||t.allow.includes(`codex`)}).enabled}

Focused tests

The new scenarios are folded into the existing cases, so the test line delta is -1 (+19 / -20):

$ vitest run src/agents/tools-effective-inventory.test.ts src/commands/doctor/shared/codex-native-assets.test.ts extensions/openshell/src/worker-cli.test.ts
 Test Files  3 passed (3)
      Tests  25 passed (25)

Red on base: with only the three production files reverted to base and the tests kept, exactly the four new scenarios fail:

# base production files, this head's tests
 Test Files  3 failed (3)
      Tests  4 failed | 21 passed (25)
# failing: inventory deny row, inventory disabled-in-config row,
# codex empty-allow-plus-entry row, openshell padded-deny binding case

What was not tested

The OpenShell binding has no real sandbox device here; the shipped run above uses a synthetic sandbox peer (disclosed in that section), backed by the red-on-base worker-cli test. Local verification ran the targeted vitest lanes and the shipped builds; the repository-wide typecheck runs in CI.

Open PR collision check

Searched open PRs by file name and by changed-file list: #199068 (roboclaw-bot) and #194876 (saariuslystoned) both touch src/agents/tools-effective-inventory.ts, but only around the gateway/metadata scope in the middle of the file and around the notices assembly at the end; this change is confined to buildToolInventoryNotices, which neither edits. No open PR touches the other two files. Rechecked on 2026-11-26 against the current open-PR snapshot: #205688, #205657 and #205659 share no file with this change.

@clawsweeper

clawsweeper Bot commented Nov 26, 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 commands Command implementations agents Agent runtime and tooling extensions: openshell size: S labels Nov 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 26, 2026
@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR routes Doctor, browser inventory notices, and OpenShell workspace admission through the existing normalized plugin-enablement owner.

Example: Configure plugins.allow as [] and plugins.entries.codex.enabled as true, with two personal Codex skills present.

  • Before: Doctor omits the personal Codex asset reminder.
  • After: Doctor reports both skills and explains their isolation from native agents.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with shipped-entry-point evidence and reported base-red/head-green regressions; required hosted validation remains incomplete.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The updated terminal captures exercise Doctor through the shipped CLI, browser notices through real Gateway RPC, and OpenShell's local policy rejection through the shipped configure command. OpenShell uses a synthetic executable peer for unchanged sandbox interactions; the changed policy owner and configuration-preservation result execute in the shipped bundle. The body now identifies complete browser inputs and records the latest-stable upgrade, resolving the prior proof requests. Inspected images belong to the separate language-pack PR and do not support this change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators receive missing or misleading plugin diagnostics, and OpenShell can configure File Transfer despite a normalized deny entry.
Reason: The repair restores documented policy consistency through existing APIs without adding a feature, option, or permission model.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs three current plugin-policy inconsistencies with no actionable correctness findings; required CI has not completed successfully.

Reviewed head: eb5e466ed183b1aaafb38c1f3f8a690e66801317

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin configuration enters the shared normalization and activation owner, whose decisions govern diagnostic output and OpenShell workspace configuration admission.

flowchart TD
  A[Plugin configuration] --> B[Canonical normalization]
  B --> C[Canonical activation policy]
  C --> D[Doctor asset reminder]
  C --> E[Browser inventory notice]
  C --> F[OpenShell workspace admission]
Loading

Technical review

Best possible solution:

Retain the focused caller changes so the existing activation owner consistently governs diagnostics and workspace admission.

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

Current-main source establishes the empty-allowlist skip, incomplete browser diagnosis, and raw OpenShell deny comparison; supplied before-and-after CLI evidence corroborates those paths, without reviewer execution.

Is this the best way to solve the issue?

Reusing normalization and activation APIs is the smallest complete repair because it removes competing policy decisions while preserving existing owners and configuration contracts.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Doctor Codex asset eligibility keeps the original intent (027ea5f: Per-agent Codex isolation required explaining that personal CLI assets are not loaded implicitly.)
  • Browser inventory notices keeps the original intent (f3ba962: Explain why configured browser automation is absent and provide recovery guidance.)
  • OpenShell workspace admission keeps the original intent (38f411f: Compose canonical workspace bindings without overriding operator plugin restrictions or existing grants.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f3ba962 adds src/agents/tools-effective-inventory.ts:123 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f3ba962fd05b; files: src/agents/tools-effective-inventory.ts)

PR surface

Source +16, Tests -1. Total +15 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 41 25 +16
Tests 3 19 20 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 60 45 +15

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #205672
Summary: This PR is the focused fix candidate for the linked issue's three handwritten plugin-policy decisions.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

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

  • Complete the required CI gate on the reviewed head.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-26T01:44:27.779Z sha 8ec28dc :: needs real behavior proof before merge. :: none

Reviewed November 26, 2026, 12:35 AM ET / 05:35 UTC (Revision 2).

@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 26, 2026
SunnyShu added 2 commits November 26, 2026 10:45
Three call sites decided plugin enablement by hand instead of asking the
existing policy owner, so they disagreed with what actually loads:

- OpenShell workspace binding compared raw allow/deny/entry ids, so a policy
  entry like " File-Transfer " never blocked the binding.
- The doctor Codex asset scan treated any allow array as authoritative, so an
  empty allowlist skipped the entries check and skipped the scan.
- The /tools inventory notice blamed plugins.allow for every missing browser,
  even when the plugin was disabled elsewhere, and stayed silent for a deny.

Each now calls normalizePluginsConfig + resolveEffectiveEnableState, and the
notice names the actual reason the plugin is off.
@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 26, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/plugin-policy-canonical-owner branch from 8ec28dc to eb5e466 Compare November 26, 2026 05:28
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 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 Nov 26, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus. #205672 was fixed on main by #207215 (d1888b8) and #207238 (9bbd5f5), which cover all three call sites this PR touched — the doctor Codex asset reminder, the /tools browser notice, and the OpenShell File Transfer gate now all go through the activation resolver. Closing this PR as superseded to avoid duplicate/conflicting changes.

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

Labels

agents Agent runtime and tooling commands Command implementations extensions: openshell impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

[Bug]: plugin policy is read by hand in three places, so the doctor scan and /tools notice disagree with what actually loads

1 participant