Skip to content

fix(mcp): stop revoked App actions after catalog waits - #126415

Merged
steipete merged 3 commits into
mainfrom
steipete/mcp-app-grant-revalidation-20260819
Aug 19, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/mcp-app-grant-revalidation-20260819

Conversation

@steipete

@steipete steipete commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted: Yes. The implementation and validation used AI coding tools, with a clean final autoreview.

What Problem This Solves

Fixes an issue where a board-granted MCP App interaction could remain effective after the operator removed or replaced the granting widget while the request was waiting for MCP catalog work. An in-flight App tool call could therefore execute after revocation, tool discovery could return stale capability inventory, and a pin operation could persist stale interactive authority.

Why This Change Was Made

Interactive MCP App boundaries now revalidate the exact live board grant after awaited catalog/list work and immediately before tool dispatch, capability return, or interactive pin persistence. Pinning that loses authority during tool resolution downgrades to the existing read-only representation; ordinary catalog failures retain their existing error behavior. Resource reads and reconstructed read-only Apps are unchanged.

User Impact

Removing or replacing a granted board App now reliably stops delayed interactive work before it crosses the MCP boundary. Operators no longer see a revoked App complete a side-effecting call after removal, and stale pins cannot retain interactive tool declarations.

Evidence

  • Pre-fix deterministic Gateway regressions: delayed mcp.app.callTool and mcp.app.listTools returned success after revocation; board pinning checked the grant once and remained interactive; the standalone bridge returned HTTP 200.
  • Pre-fix real-process proof: a real mock-provider turn created an interactive App view, a real Streamable HTTP MCP catalog refresh was held, the widget was removed, and release produced HTTP 200 with postRevocationExecuted: true.
  • Post-fix real-process proof: node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-mcp-app-grant-revalidation.e2e.test.ts — 1/1 passed on the final local tree; the same flow returned HTTP 403 with MCP App widget grant is no longer active, and the MCP child recorded no post-revocation call.
  • Focused owner proof: node scripts/run-vitest.mjs src/gateway/server-methods/mcp-app.test.ts src/gateway/server-methods/board.test.ts src/gateway/server-methods/board.runtime-boundaries.test.ts src/gateway/mcp-app-standalone.test.ts — 66/66 passed.
  • node scripts/check-changed.mjs -- <nine changed paths> — passed for core, coreTests, extensionTests, testRoot, and tooling lanes.
  • git diff --check — passed.
  • Final Codex autoreview after all follow-up edits — clean, no accepted/actionable findings.
  • The first CI head exposed an unrelated flaky Chrome helper test: its real loopback WebSocket shutdown path used a 20 ms budget despite the owning Chrome probe contract being 200 ms. The final head uses the canonical budget; the exact case passed 10/10 repetitions and the full chrome.test.ts file passed 36/36.

Production LOC: +12/-2 (net +10), justified by post-await authorization at the shared dispatch/list and board-persistence owners. Tests and test support: +764/-203; 213 added lines are a mechanical split of pre-existing runtime-boundary board tests required to bring the touched test owner below its line limit.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Aug 19, 2026
@steipete
steipete marked this pull request as ready for review August 19, 2026 19:30
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 19, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 4:15 PM ET / 20:15 UTC.

ClawSweeper review

What this changes

The PR prevents a revoked board-granted MCP App from calling tools, returning interactive tools, or being pinned as interactive after an awaited catalog refresh.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this protected maintainer PR open for final human approval and exact-head CI. The current main path authorizes before catalog work but not after it; this branch closes that authority race at dispatch, capability-return, and pin-persistence boundaries.

Priority: P0
Reviewed head: b2a3a399a925e47e5e943330a327e698deb08f82
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused authority-boundary repair with meaningful owner and real-process coverage; only exact-head CI and the unavailable local SDK-source check remain.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides an after-fix isolated Gateway and real Streamable HTTP MCP flow showing HTTP 403 and no post-revocation tool call.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides an after-fix isolated Gateway and real Streamable HTTP MCP flow showing HTTP 403 and no post-revocation tool call.
Evidence reviewed 7 items Current-main race: Current main checks interaction before the awaited catalog lookup and then dispatches the tool without a second authorization check.
Dispatch repair: The PR rechecks the live grant immediately after callable-tool catalog resolution and before the tool dispatch.
Pin-persistence repair: The board pin flow now rechecks after resolving allowed tools and persists no declared tools when authority was revoked during that wait.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-mcp-app-grant-revalidation.e2e.test.ts

Result: FAIL (partial) — step 2 expect_output 1 passed: expected terminal output was not visible within 30 seconds: "1 passed"

runner@runnervm76f27:/tmp/clawsweeper-live-proof-126415-JFD147/target$ node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-mcp-app-grant-revalidation.e2
e.test.ts
[test] starting test/vitest/vitest.e2e.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126415-JFD147/target

node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-mcp-app-grant-revalidation.e2e.test.ts
[openclaw] Building TypeScript (dist is stale: missing_private_qa_dist - private QA dist entry missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
  - tsdown:deps (44%)
  - rolldown-plugin-dts:generate (24%)
  - rolldown-plugin-dts:fake-js (21%)
See https://rolldown.rs/reference/InputOptions.checks#plugintimings for more details.

[tsdown-build] invocation 1/11 finished in 4.8s
[tsdown-build] invocation 2/11 finished in 21.1s































Assertions:

  • FAIL expect_output: 1 passed

How this fits together

Board widgets mint MCP App views whose interactive authority comes from a specific live grant. Gateway operations may wait on MCP catalog work, then dispatch tools, return capabilities, or persist a pinned view.

flowchart LR
  A[Board widget grant] --> B[Grant-bound App view]
  B --> C[Catalog or tool lookup]
  C --> D[Live grant recheck]
  D -->|active| E[Tool call or tool list]
  D -->|revoked| F[Denied request or read-only pin]
Loading

Decision needed

Question Recommendation
Should this protected P0 grant-revocation repair be accepted once exact-head CI is green? Approve after exact-head CI: Accept the owner-boundary repair once the remaining checks validate the MCP fixture and the current head remains mergeable.

Why: The maintainer label requires explicit human handling for a change that governs when previously granted interactive authority becomes invalid.

Before merge

  • Resolve merge risk (P1) - The E2E fixture calls the pinned MCP SDK notification helper, but direct SDK-source inspection was unavailable in this node_modules-less, network-restricted review checkout; exact-head CI should validate that fixture contract.
  • Resolve merge risk (P2) - Production code grows by 10 net lines; the localized post-await checks are justified because a shared wrapper would run after dispatch or would incorrectly gate intentionally readable resource operations.
  • Complete next step (P2) - No repair job is warranted: the patch already addresses the source-proven defect, while the protected maintainer label requires human final approval.
Agent review details

Security

None.

PR surface

Source +10, Tests +561. Total +571 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 2 12 2 +10
Tests 7 764 203 +561
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 776 205 +571

Review metrics

Metric Value Why it matters
Production versus test delta production +12/-2 (net +10); tests/test support +764/-203 The small production increase adds authorization checks at three awaited authority boundaries; most churn is regression coverage and a mechanical test split.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the localized post-await checks at the dispatch, capability-return, and pin-persistence owners, then merge only after human approval and exact-head checks validate the pinned MCP fixture.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the localized post-await checks at the dispatch, capability-return, and pin-persistence owners, then merge only after human approval and exact-head checks validate the pinned MCP fixture.

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

Yes, source-reproducible: the E2E deterministically holds a real child Gateway's Streamable HTTP catalog refresh, removes the board widget, and checks for denial with no tool execution. It was not run here because this read-only worktree has no dependencies and must not reconcile them.

Is this the best way to solve the issue?

Yes. Rechecking the exact live grant immediately after awaited discovery and before each interactive output or side effect is the narrow owner-boundary repair; an outer wrapper would either run too late or restrict preserved read-only resource access.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix isolated Gateway and real Streamable HTTP MCP flow showing HTTP 403 and no post-revocation tool call.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster. Replaced prior rating: 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P0: A revoked interactive App could otherwise complete a side-effecting MCP tool call after its granting widget was removed.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster. Replaced prior rating: 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides an after-fix isolated Gateway and real Streamable HTTP MCP flow showing HTTP 403 and no post-revocation tool call.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix isolated Gateway and real Streamable HTTP MCP flow showing HTTP 403 and no post-revocation tool call.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame assigns the MCP App interaction guard and board pin path to Peter Steinberger's recent work, and this PR repairs that same owner boundary. (role: recent area contributor; confidence: high; commits: ea72ce9e9820, b2a3a399a925; files: src/gateway/mcp-app-operations.ts, src/gateway/server-methods/board.ts)
  • Jason (Json): The earlier MCP widget authority hardening commit is central history for the grant model this repair preserves. (role: feature owner; confidence: medium; commits: 6304a47762cc; files: src/gateway/server-methods/board.ts)

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 (1 earlier review cycle)
  • reviewed 2026-08-19T19:37:12.221Z sha 01b7b43 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head b2a3a399a925e47e5e943330a327e698deb08f82.

  • node scripts/run-vitest.mjs src/gateway/server-methods/mcp-app.test.ts src/gateway/server-methods/board.test.ts src/gateway/server-methods/board.runtime-boundaries.test.ts src/gateway/mcp-app-standalone.test.ts — 66/66 passed.
  • node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-mcp-app-grant-revalidation.e2e.test.ts — 1/1 passed through a real child Gateway, mock provider, board grant/remint, standalone ticket, and held Streamable HTTP catalog. Pre-fix: HTTP 200 and the tool executed after revocation. Fixed: HTTP 403 and no execution.
  • node scripts/check-changed.mjs -- extensions/browser/src/browser/chrome.test.ts src/gateway/mcp-app-operations.ts src/gateway/mcp-app-standalone.test.ts src/gateway/server-methods/board.runtime-boundaries.test.ts src/gateway/server-methods/board.test.ts src/gateway/server-methods/board.ts src/gateway/server-methods/mcp-app.test.ts test/e2e/qa-lab/runtime/gateway-mcp-app-grant-revalidation.e2e.test.ts test/e2e/qa-lab/runtime/gateway-node-mcp.fixture.mjs — passed; git diff --check passed.
  • The first-head unrelated Chrome graceful-shutdown flake was repaired at the test owner by using the canonical 200 ms loopback WebSocket stop budget; the exact case passed 10/10 and the full file passed 36/36.
  • Exact-head required CI is green: run 32296985975, including openclaw/ci-gate.

ClawSweeper's exact-head review has no actionable code or security finding and identifies this as the best owner-boundary fix. Its remaining maintainer-decision and proof requests are resolved: owner decision is land, exact-head CI is green, and direct inspection of pinned @modelcontextprotocol/sdk 1.30.0 confirms McpServer.sendToolListChanged() delegates to the connected server without awaiting the underlying asynchronous notification. The active or late refresh publisher is non-blocking under policy; no re-review requested.

Final Codex autoreview is clean. Production is +12/-2 (net +10), justified by live revalidation at the shared dispatch/list and board-persistence owners; tests/test support are +764/-203, including 213 mechanically moved board runtime-boundary lines. Revoked board authority must fail before delayed tool dispatch, capability return, or interactive pin persistence. Maintainer decision: land.

@steipete
steipete merged commit 14c02a4 into main Aug 19, 2026
229 checks passed
@steipete
steipete deleted the steipete/mcp-app-grant-revalidation-20260819 branch August 19, 2026 20:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
* fix(mcp): revalidate app grants after catalog work

* test(mcp): track grant proof temp state

* test(browser): use canonical graceful stop budget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: browser gateway Gateway runtime maintainer Maintainer-authored PR P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant