Repository navigation
fix(mcp-app): pass trusted toolMeta to session resource tool policy checks (#186775, #186777) - #186793
fix(mcp-app): pass trusted toolMeta to session resource tool policy checks (#186775, #186777)#186793xuilen wants to merge 4 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesPasses trusted plugin ownership into session tool-policy checks for model-created and standalone MCP Apps. Example: An MCP App calls notes__write_note with tools.profile set to coding.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains This PR fixes a current MCP App policy bug, but the latest mock annotation leaves an obsolete baseline entry that still blocks CI. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Gateway projects MCP catalog tools, checks session policy and App authority, obtains approval when needed, and sends permitted calls through the session-owned MCP transport. flowchart LR
A[App request] --> B[Trusted catalog projection]
B --> C[Session tool policy]
C --> D[App authority and approval]
D --> E[Execution revalidation]
E --> F[MCP transport]
Technical reviewBest possible solution: Keep the production metadata repair, replace the mock-forwarding assertion with focused real-policy coverage, and restore the original mock factory or prune its obsolete baseline entry. Do we have a high-confidence way to reproduce the issue? Current-main source shows both callers losing trusted ownership, and supplied real-Gateway comparisons demonstrate the resulting coding-profile rejection; this review executed no target code. Is this the best way to solve the issue? The production patch is the smallest complete repair: preserve the existing projection and pass its metadata into the existing policy owner at both affected callers. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bde3017359ed. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +2, Tests +13. Total +15 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 29, 2026, 5:28 AM ET / 09:28 UTC (Revision 4). |
|
The tests-only supplement is now available as xuilen/openclaw#2, targeting your Published head: The 10-case policy regression uses the real materializer, trusted plugin metadata, and policy evaluator through both App entry points. It covers the coding allowance, explicit plugin/group denials despite an exact-name allowance, denial added after preparation, and revoked request authority before execution. The isolated Gateway E2E uses a deterministic local model protocol fixture and real MCP HTTP transport. It proves standalone discovery/launch/call, creates a model App through an actual tool call and retrieves its view from chat history, and checks that session denial and subsequent server/tool revocation cause no additional upstream calls. Validation on the supplement based on your head:
Earlier red/green evidence: all 10 new cases fail on unmodified main Remaining coverage limits: this does not prove the complete cross-requester or revocation-during-await matrix requested above. It does not exercise external models, native harnesses, browser rendering, or an existing user's installation. I am not claiming all upstream review requirements are resolved. The complete patch is retained below as an alternative to merging the supplement PR. Copy only the diff block into The Node setting matches the validated runtime; automatic Bun selection could not start on this macOS host because a compatible SQLite library is unavailable. Complete tests-only patch (2 files, 510 added lines) |
…ion-runtime.test.ts
|
Updated in 2f64fea: fixture metadata now specifies \pluginId: 'bundle-mcp'\ and asserts exact ownership propagation. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Updated in 3abaa2e: added // mock-isolation:\ annotation on ./session-resource-tool-policy.js\ mock to satisfy the \check:test-mock-exports\ baseline ratchet. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Closes #186775
Closes #186777
What Problem This Solves
Fixes: MCP App tool calls are rejected by session tool policy when invoking permitted plugin tools (such as
bundle-mcp), and standalone apps filter out allowed plugin tools.User Impact
User impact: Model-created and standalone MCP App tool calls can reliably execute permitted plugin tools according to the session's tool capability profile without false policy rejections.
Why This Change Was Made
Both
prepareModelCreatedAppToolCall(insrc/gateway/mcp-app-operations.ts) andprepareMcpAppExtensionRuntime.assertTool(insrc/gateway/mcp-app-extension-runtime.ts) invokeresolveSessionResourceToolPolicy, but previously passed only the stringtoolNamewhile omittingtoolMeta.Consequently, the downstream policy evaluator (
isConversationToolAllowed) cannot determine the tool's plugin ownership (such aspluginId: "bundle-mcp"), causing tools allowed under plugin policy profiles (such as the defaultcodingprofile) to fail session policy checks withSESSION_RESOURCE_TOOL_POLICY.This change:
toolMeta: getPluginToolMeta(projectedTool)toresolveSessionResourceToolPolicyinmcp-app-extension-runtime.ts.toolMeta: getPluginToolMeta(projected)toresolveSessionResourceToolPolicyinmcp-app-operations.ts.Evidence
src/gateway/mcp-app-extension-runtime.test.ts: all 12 tests pass, including new assertions confirmingtoolMetapropagation.CI maintenance (2026-10-30)
The mock-isolation annotation removes one factory from the unannotated-mock inventory. Regenerated the shrink-only baseline with the repository's
check-test-mock-exports.mts --prune; it removes exactly that stale entry (6565 -> 6564), with no new allowance.Before regeneration, the check reproduced the same stale-entry failure as CI. After regeneration:
Mock factory ratchet OK: 6564 grandfathered factories.git diff --checkalso passes. The local command used the repository-declared TypeScript 7.1.0-dev.20261016.1 from an isolated dependency directory because the shared local install had an older version withouttypescript/astexports; the checker source was unchanged.This maintenance changes only the generated baseline. It does not change production behavior. Other checks previously passed on head 3abaa2e; those are prior-head CI evidence, not a result for the proposed next commit. The new commit still needs its own CI run.