apps/cli: pre-approve mcp__studio__ tools so classifier outages don't block the agent#3332
Draft
lezama wants to merge 2 commits into
Draft
apps/cli: pre-approve mcp__studio__ tools so classifier outages don't block the agent#3332lezama wants to merge 2 commits into
lezama wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related
A user ran
/annotatewhile Anthropic'sclaude-sonnet-4-6model — which the SDK'sautopermission mode uses as its safety classifier — was having a transient outage. Every Studio MCP tool call (mcp__studio__site_info,mcp__studio__open_annotation_browser, …) failed with:The agent kept retrying and never recovered until Sonnet came back, so the user was completely blocked.
Proposed Changes
PreToolUsehook withmatcher: '^mcp__studio__'that returnspermissionDecision: 'allow'. This pre-approves every tool exposed by the Studio MCP server (createStudioTools/createRemoteSiteTools) so they bypass the SDK's auto classifier entirely.hooksblock so it's always present. TheAskUserQuestioninterceptor is now the second matcher in the samePreToolUsearray; behavior unchanged.onAskUser-provided and not-provided modes.Why this is safe
~/Studio/(with their own WordPress/wp-cli sandbox) or the user's own WordPress.com sites authenticated via OAuth (wpcom_request). They cannot escape the user's environment.apps/cli/ai/system-prompt.ts).Bash,Write,Edit,Read,Grep,Glob, …) are unaffected — they continue to go through the auto classifier.#3242 deliberately moved to SDK
automode and dropped the ad-hoccanUseToolgating. This change preserves that intent (no manual gating logic, no allowlist diff to maintain) while removing the availability dependency on Sonnet for tools we ship and trust.Testing Instructions
npm test -- apps/cli/ai/tests/agent.test.ts— 5 tests pass, including 3 new ones covering the hook registration.npm test -- apps/cli/ai/tests/— full AI test suite (109 tests) passes.npm run typecheck --workspace apps/cli— passes.permissionMode: 'plan'on a build, then run anystudio codecommand that hits an MCP tool — Studio tools should still execute (they no longer ask the classifier), while aBashcall would still go through the gate.Pre-merge Checklist