Skip to content

feat(plugins): show blocked hook permissions in the Control UI - #182274

Closed
ljluestc wants to merge 1 commit into
openclaw:mainfrom
ljluestc:feat/plugin-blocked-hook-diagnostics
Closed

ljluestc wants to merge 1 commit into
openclaw:mainfrom
ljluestc:feat/plugin-blocked-hook-diagnostics

Conversation

@ljluestc

Copy link
Copy Markdown
Contributor

feat(plugins): show blocked hook permissions in the Control UI

Related: #155227 (first milestone: host-observed diagnostics). Overlaps #136474, which records the same refusals for the CLI and /status and is still open; this branch uses the same reason vocabulary so the two can converge.

What Problem This Solves

When host hook policy blocks a typed hook, the registry logs a warning and drops the registration. A common case is a non-bundled plugin without plugins.entries.<id>.hooks.allowConversationAccess=true. The Control UI showed the plugin as enabled and active, with no sign that some of its hooks were not running. The operator in #155227 found the cause only in Gateway logs, and then had to hunt for the right control under plugin settings → Permissions.

Why This Change Was Made

One owner, from refusal to rendering:

  1. Producer: registerTypedHook (src/plugins/registry-registrars-tools-hooks.ts) now records { hookName, reason, configPath } on the live PluginRecord.blockedHooks at the point where it refuses. Warning messages are unchanged.
  2. Protocol: PluginRuntimeStatusSchema gains optional blockedHooks (closed object, maxItems: 64). This is an additive field, not a protocol version bump. Swift and Kotlin generation checks pass.
  3. Projection: plugins.list includes runtime.blockedHooks only for records with status loaded. A record that is no longer loaded doesn't describe live hook behavior.
  4. Control UI:
    • The installed-plugin row shows a compact Access blocked warning.
    • The detail page shows one warning per blocking permission, naming the hooks.
    • Review permissions navigates to ?view=settings&setting=hooks.<grant>. The settings editor scrolls to that permission row, focuses its control, and marks it.
    • The existing permission controls, effective values, read-only handling, and reset/inherit menu are reused unchanged. No new settings surface was added.
    • Saving the toggle doesn't clear the notice. It clears when plugins.list reports the reloaded runtime without the blocker. A cleared notice confirms registration, not that the hook has run.
  5. Docs: docs/tools/plugin.md describes the notice and what clearing it means.

Production LOC: +219/-17. That includes the schema, i18n strings, CSS, the docs paragraph, and comments. Tests: +198/-2, plus a new 137-line E2E file.

User Impact

  • Operators can see from the Plugins page, without shell access or logs, when an enabled plugin has hooks the host is refusing. They can see which permission causes it and reach that control in one click.
  • Grants are never changed automatically. Explicit denials, inherited defaults, and read-only users keep their existing behavior. Read-only users see the notice and the disabled control.
  • No Lossless-specific behavior. Missing manifest metadata doesn't suppress the notice.

Not In This PR

The issue leaves these product decisions open:

  • Upgrade-result and notification-surface warnings.
  • Links from the memory and context-engine status pages.
  • Manifest-declared permission requirements.
  • A saved → applying → applied → failed state machine. The notice already follows runtime truth.

Accepted edge case: if a schema refresh with a cached schema re-renders the permission rows after the editor has looked for the target, the one-time scroll/focus can be missed. The notice and link still work. A review found this window narrow and the result recoverable, so I didn't add retry machinery for it.

Evidence

  • Visual: the Playwright mock-Gateway flow ui/src/pages/plugins/plugin-blocked-hooks.e2e.test.ts captured before/after screenshots from the same fixture. I inspected them; they are local only and not yet embedded here.
    • Before (main): the row shows no warning, and the settings page shows "Read conversation context" unchecked and unmarked.
    • After: the row shows "Access blocked: some plugin hooks are not running. Review permissions". Review lands on ?view=settings&setting=hooks.allowConversationAccess with that row marked and its checkbox focused. The detail notice names before_prompt_build. After the toggle is saved, the notice remains. After plugins.list reports the applied runtime, the notice is gone.
  • pnpm test src/plugins/loader.test.ts --maxWorkers=1 -t "prompt injection is disabled|conversation typed hooks": 4 passed. These cover the real loader recording each reason, the config path, and the absence of blockers when allowed.
  • pnpm test src/gateway/server-methods/plugins.runtime-owner.test.ts --maxWorkers=1: 4 passed, about 42s wall, most of it suite setup. Covers the loaded record projecting blockedHooks and a disabled record omitting them.
  • pnpm test ui/src/pages/plugins --maxWorkers=4: 16 + 1 files, 128 + 188 tests passed. New tests:
    • Notice grouping and copy, including plugin ids that contain dots.
    • Detail notice text, the focused and marked row, and the review link callback.
    • The setting param is dropped on tab switches.
  • pnpm test:ui:e2e ui/src/pages/plugins/plugin-blocked-hooks.e2e.test.ts: 1 passed, about 34s wall.
  • pnpm protocol:check: passed (registry, generated schema, Swift/Kotlin determinism, since guard).
  • pnpm tsgo:core, pnpm tsgo:ui, pnpm tsgo:core:test: clean.
  • oxlint and oxfmt --check on the touched files, pnpm lint:ui:styles, pnpm ui:i18n:verify, pnpm format:docs:check, git diff --check: clean.
  • Fresh independent review: no backend or protocol findings. Three UI findings were fixed:
    • Notices are keyed by reason, so a focused review link survives catalog refreshes.
    • The focus guard is scoped per plugin.
    • The setting param no longer sticks across tab links, and review links keep other search params.
  • Not run: a live Gateway with a real non-bundled plugin, such as Lossless Claw, through hot reload. The E2E test uses the mock Gateway, and the loader tests use real plugin registration.

🤖 Generated with Claude Code

Record typed hooks the registry refuses under host hook policy on the live
plugin record, expose them as plugins.list runtime.blockedHooks, and show an
Access blocked notice with a Review permissions link that focuses the
blocking setting.

Refs openclaw#155227
@clawsweeper

clawsweeper Bot commented Oct 24, 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 docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: L labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR exposes policy-blocked plugin hooks in the Control UI and links each warning to the existing permission control.

Example: Lossless Claw registers before_prompt_build without allowConversationAccess=true.

  • Before: The plugin appears enabled while the refused hook is discoverable only through diagnostics.
  • After: An Access blocked notice names the refusal and opens hooks.allowConversationAccess for review.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful diagnostic work, but required real-behavior proof is absent and the focus implementation has two actionable defects.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: An enabled plugin can have refused hooks without an actionable warning directing the operator to its existing permission controls.
Reason: The diagnostic improvement has concrete value, but it implements only part of the linked exploratory request and overlaps an existing broader UI implementation.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: this PR addresses a current plugin-diagnostics gap and contains useful focused work, but two UI defects and an unresolved scope decision prevent acceptance.

Priority: P2
Reviewed head: 87e10df3f15fc302f6109e523083851bf96ccd2f
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should this smaller diagnostic milestone proceed separately from the broader UI recovery implementation in fix(plugins): expose blocked hook permissions and recovery #160899, and which refusal contract should the UI and health views share?
  • Recommendation: Coordinate one shared milestone: Select one refusal contract and implementation branch, preserving this PR's focused UI contribution where useful.
  • Why: The linked request is exploratory, no written maintainer approval on this PR settles its scope, and the open implementations propose overlapping representations.

Before merge

  • Add real behavior proof - The refusal producer is exercised by reported loader tests and the UI by a mock-Gateway browser test, but no shared artifact exercises this branch through a real Gateway and external-plugin reload; attach redacted runtime output and before/after screenshots, including the latest-stable upgrade scenario, with IPs, API keys, phone numbers, and non-public endpoints removed. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Use refs and the shared focus primitive instead of DOM queries (P2) - The new focus path adds three querySelector/querySelectorAll calls in a Solid-owned editor and one createEffect where the per-file baseline permits none. scripts/check-control-ui-controllers.mts rejects these queries outside its explicit foreign-DOM owners, and settings-editor.tsx is not an allowed owner. Consequently the repository's Control UI guard rejects this patch even if the reported targeted lint commands pass. Capture the relevant elements through refs and reuse the existing pending-focus primitive without raising the baselines.
  • Reveal the permission when an existing search filters it out (P2) - Open a blocked plugin's settings, enter a search that excludes the conversation-access permission, then click the notice's Review permissions link. The editor retains its query because the plugin identity has not changed; permissionFields filters out the requested row, and this new effect either receives no target or finds no matching element. The link therefore leaves the blocking permission hidden and unfocused. Clear or bypass the filter for an explicit review request and cover this retained-editor interaction.

Findings

  • [P2] Use refs and the shared focus primitive instead of DOM queries — ui/src/pages/plugins/settings-editor.tsx:435-437
  • [P2] Reveal the permission when an existing search filters it out — ui/src/pages/plugins/settings-editor.tsx:425-428

Tests

  • Missing end-to-end proof: Provide a real Gateway/browser flow covering refusal, permission navigation, hot-reload clearing, read-only behavior, and a latest-stable upgrade with settings intact, attach sanitized before/after images, and demonstrate the regression failing on the base.
Agent review details

How this fits together

Plugin registration checks host hook policy, the live registry records refusals, plugins.list projects them, and the Control UI renders warnings alongside existing permission controls.

flowchart LR
A[Plugin hook registration] --> B[Host hook policy]
B --> C[Live plugin record]
C --> D[Gateway plugin inventory]
D --> E[Control UI warning]
E --> F[Existing permission editor]
Loading

Technical review

Best possible solution:

Expose one lifecycle-scoped refusal contract through existing plugin views and permission controls, using ref-owned focus that reveals a filtered target.

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

Current-main source confirms that denied typed hooks produce warnings without structured Control UI linkage; this read-only review performed no live reproduction.

Is this the best way to solve the issue?

Recording refusals at the existing policy owner and reusing permission controls is a sound direction, but focus must survive filtering and the overlapping implementations need one agreed contract.

Full review comments:

  • [P2] Use refs and the shared focus primitive instead of DOM queries — ui/src/pages/plugins/settings-editor.tsx:435-437
    The new focus path adds three querySelector/querySelectorAll calls in a Solid-owned editor and one createEffect where the per-file baseline permits none. scripts/check-control-ui-controllers.mts rejects these queries outside its explicit foreign-DOM owners, and settings-editor.tsx is not an allowed owner. Consequently the repository's Control UI guard rejects this patch even if the reported targeted lint commands pass. Capture the relevant elements through refs and reuse the existing pending-focus primitive without raising the baselines.
    Confidence: 0.99
  • [P2] Reveal the permission when an existing search filters it out — ui/src/pages/plugins/settings-editor.tsx:425-428
    Open a blocked plugin's settings, enter a search that excludes the conversation-access permission, then click the notice's Review permissions link. The editor retains its query because the plugin identity has not changed; permissionFields filters out the requested row, and this new effect either receives no target or finds no matching element. The link therefore leaves the blocking permission hidden and unfocused. Clear or bypass the filter for an explicit review request and cover this retained-editor interaction.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 83c72975d9e4.

Provenance checked

  • Hook-policy refusal handling keeps the original intent (0dbd5c8: Separate operator hook grants from capability consent and enforce conversation-access policy; later diagnostic consolidation preserved registration policy.)
  • Plugin settings and overview ownership keeps the original intent (feat: unify installed and catalog plugin overviews #149216: Unify installed and catalog overviews while keeping permissions in existing Settings controls; the Solid migration preserved routes, drafts, and domain ownership.)
  • Plugin reload documentation keeps the original intent (54a9860: Remove obsolete Gateway restart guidance; the added paragraph retains live-reload guidance and distinguishes registration from execution.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +202, Tests +333, Docs +7. Total +542 across 21 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 12 219 17 +202
Tests 8 335 2 +333
Docs 1 8 1 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 21 562 20 +542

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #155227
Summary: This PR implements part of the exploratory permission-diagnostics request, overlapping two open implementations without establishing supersession.

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:

  • P2: This improves diagnosis of partially blocked plugins while existing in-product permission controls remain available.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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.

Reviewed October 24, 2026, 1:53 AM ET / 05:53 UTC.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 31, 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

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant