Skip to content

fix(plugins): start explicit non-bundled hook plugins lacking onCapabilities - #78229

Closed
Beandon13 wants to merge 1 commit into
openclaw:mainfrom
Beandon13:fix/openclaw-78196-legacy-extension-startup
Closed

Beandon13 wants to merge 1 commit into
openclaw:mainfrom
Beandon13:fix/openclaw-78196-legacy-extension-startup

Conversation

@Beandon13

Copy link
Copy Markdown
Contributor

Fixes #78196.

Root cause

v5.3 tightened hasHookRuntimeStartupIntent to require either a
manifest activation.onCapabilities: [\"hook\"] declaration or
explicit hooks.* policy keys. Pre-v5.3 external extensions
(claw-guard, approval-formatter, …) shipped before that metadata
existed and were activated solely via
plugins.entries.<id>.enabled = true plus plugins.allow. After
v5.3, those plugins quietly fall through canStartExplicitHookPlugin
because their startup intent is empty, so the gateway daemon skips
them with no error or warning.

The CLI-side path (openclaw plugins inspect) keeps reporting them
as Status: loaded because each CLI invocation re-imports the plugin
in its own short-lived Node process — that path is fine. The
long-lived gateway daemon, which is the process that needs the hook
wired to handle tool calls, is the one that silently skips them.

Net effect for the reporter: before_tool_call from claw-guard
never fires, audit.jsonl stops advancing, and tool calls run
unaudited.

What the fix does

Treat any non-bundled plugin that the user has explicitly enabled
(activationSourcePlugins.entries[pluginId]?.enabled === true) as
having legacy hook startup intent. Bundled plugins keep their
manifest-driven activation. Merely allowlisted (but not explicitly
enabled) plugins remain ambient and are still skipped — the existing
allow-vs-load distinction is preserved.

Tests

  • Added two regression cases in channel-plugin-ids.test.ts
    reusing the existing external-hook-policy fixture (origin:
    global, no manifest hook capability, no explicit hook policy):
    • explicitly enabled + allowed => loads at startup
    • allowlisted only, no entry => still does NOT load (negative case)

Real behavior proof

Unit tests only. Local vitest blocked before tests by the existing
@openclaw/fs-safe/config infra gap. The behavior change is a single
new short-circuit in hasHookRuntimeStartupIntent and is exercised by
the new positive/negative cases.

…ilities (openclaw#78196)

Pre-v5.3 external extensions (claw-guard, approval-formatter, ...)
shipped without `activation.onCapabilities: ["hook"]` metadata — that
metadata didn't exist yet — and they often did not set explicit
`hooks.*` policy keys either. Users enabled them with
`plugins.entries.<id>.enabled = true` plus `plugins.allow`. After v5.3
tightened gateway startup, hasHookRuntimeStartupIntent only returned
true when a manifest declared the hook capability or the entry carried
explicit hook policy, so legacy plugins were silently skipped at
gateway boot. Single-shot CLI commands (`openclaw plugins inspect`)
re-imported the plugin in their own process and printed the register
banner, which made the daemon-only failure invisible. Net effect for
the reporter: ClawGuard's `before_tool_call` hook never fired, so
`audit.jsonl` froze and tool calls ran unaudited.

Treat any non-bundled plugin that the user has explicitly enabled
(`entry?.enabled === true`) as having legacy hook startup intent, in
addition to the existing manifest/onCapabilities and explicit hook
policy paths. Bundled plugins keep their existing manifest-driven
activation. Merely allowlisted (but not explicitly enabled) plugins
remain ambient and are still skipped — this preserves the current
allow-vs-load distinction.

Test plan
- Added `loads explicitly enabled legacy external plugins lacking
  hook-capability metadata (openclaw#78196)` and the negative ambient-load case
  to channel-plugin-ids.test.ts using the existing
  `external-hook-policy` fixture (origin: global, no manifest hook
  capability, no explicit hook policy).
- Local vitest blocked before any test by the
  `@openclaw/fs-safe/config` import gap shared by all PRs in this
  worktree; behavior change is single-branch and exercised by the new
  cases.
@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 6, 2026
@clawsweeper

clawsweeper Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: this is a useful candidate for the linked legacy external hook startup regression, but it is not merge-ready because the enabled-only fallback can bypass explicit startup opt-outs and the PR still has only unit-test proof for a Gateway/runtime behavior change.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #78196
Summary: This PR is the active candidate fix for the canonical legacy external hook startup regression; related items either duplicate that runtime bug or cover broader documentation/product questions.

Members:

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

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

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

Yes, at source level: current main excludes enabled-only legacy external hook plugins before Gateway runtime loading unless they declare hook activation metadata or hook policy config. I did not run the live Docker/Gateway reproduction in this read-only review.

Is this the best way to solve the issue?

No, not as-is. The startup planner is the right layer, but the patch must preserve explicit startup opt-outs and include after-fix real Gateway proof before it is the best merge path.

Security review:

Security review needs attention: The diff widens in-process native plugin startup and can bypass an explicit startup opt-out.

  • [medium] Avoid widening native plugin startup execution — src/plugins/gateway-startup-plugin-ids.ts:442
    Non-bundled plugins run inside the Gateway process; making enabled-only plugins startup candidates despite activation.onStartup: false expands when trusted local code executes.
    Confidence: 0.9

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-05-06T02:51:19Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is mock_only and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • MkDev11: Authored the merged explicit hook plugin startup planning change and regression coverage in the affected planner/test files. (role: adjacent hook-startup contributor; confidence: high; commits: d6900ee50037; files: src/plugins/gateway-startup-plugin-ids.ts, src/plugins/channel-plugin-ids.test.ts)
  • Shakker: Added the explicit startup opt-out behavior and tests that this PR needs to preserve. (role: startup opt-out contributor; confidence: high; commits: 7754158292ba; files: src/plugins/gateway-startup-plugin-ids.ts, src/plugins/channel-plugin-ids.test.ts)
  • vincentkoc: Introduced registry-based Gateway startup planning, which supplies the startup plugin ID set consumed by Gateway loading. (role: startup planner feature introducer; confidence: medium; commits: 674d188153ae; files: src/plugins/gateway-startup-plugin-ids.ts, src/plugins/channel-plugin-ids.test.ts)
  • steipete: Recently unified plugin startup metadata planning across the startup planner, lookup table, and related tests. (role: recent area contributor; confidence: medium; commits: fecac7e40aef; files: src/plugins/gateway-startup-plugin-ids.ts, src/plugins/plugin-lookup-table.ts, src/plugins/channel-plugin-ids.test.ts)

Codex review notes: model internal, reasoning high; reviewed against 010b61746379.

@byungskers

This comment was marked as low quality.

@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jun 14, 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 stale Marked as stale due to inactivity triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed stale Marked as stale due to inactivity labels Jul 20, 2026
@steipete

Copy link
Copy Markdown
Contributor

Closing per ClawSweeper review verdict duplicate_or_superseded (decision packet 2026-07-03T21:04:20.831Z). This item was part of the audited close backlog (openclaw/clawsweeper#920) stranded by an apply-lane defect, drained manually after re-verification. If this is wrong, reopen and ClawSweeper will re-review.

@steipete steipete closed this Jul 29, 2026
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. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Extension plugins silently skipped by gateway loader in v5.3+ (loads in CLI process, not in long-running daemon)

4 participants