Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 13, 2025

This PR attempts to address Issue #9214. Feedback and guidance are welcome.

Problem

After the recent refactoring that moved auto-approval logic from ChatView to Task (#9157), the MCP auto-approval behavior changed. When alwaysAllowMcp was enabled with tools marked as "always allow", the UI was still asking for permission in v3.31.1.

Solution

Changed the logic to properly handle MCP tool auto-approval:

  • When alwaysAllowMcp is enabled → auto-approve all MCP tools by default
  • Tools can opt-out by explicitly setting alwaysAllow=false
  • This restores the expected behavior where enabling MCP auto-approval approves all tools

Changes

  • Modified src/core/auto-approval/index.ts to check global alwaysAllowMcp first
  • Added comprehensive test coverage in src/core/auto-approval/__tests__/checkAutoApproval.spec.ts

Testing

  • ✅ All auto-approval tests pass (23 tests)
  • ✅ Type checking passes
  • ✅ The fix properly handles both global and individual tool settings

Fixes #9214


Important

Restores MCP tool auto-approval behavior in index.ts and adds tests in checkAutoApproval.spec.ts to handle global and individual tool settings.

  • Behavior:
    • Restores MCP tool auto-approval when alwaysAllowMcp is enabled in index.ts.
    • Tools can opt-out by setting alwaysAllow=false.
    • Handles both global and individual tool settings.
  • Testing:
    • Adds tests in checkAutoApproval.spec.ts for various scenarios including missing tools, invalid JSON, and unknown servers.
    • Ensures auto-approval logic is correctly applied in all cases.
  • Misc:

This description was created by Ellipsis for b8f00cc. You can customize this summary. It will automatically update as commits are pushed.

…nabled

- Fixed regression introduced in #9157 where MCP tools required individual alwaysAllow property
- When alwaysAllowMcp is true, all MCP tools are now auto-approved by default
- Tools can still opt-out by explicitly setting alwaysAllow=false
- Added comprehensive tests for MCP auto-approval scenarios

Fixes #9204
@roomote roomote bot requested review from cte and mrubens as code owners November 13, 2025 03:02
@roomote roomote bot requested a review from jr as a code owner November 13, 2025 03:02
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 13, 2025
@dosubot dosubot bot added the bug Something isn't working label Nov 13, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 13, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. Found 1 minor issue to address:

  • Remove unused isMcpToolAlwaysAllowed import from src/core/auto-approval/index.ts

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

import type { McpServer, McpTool } from "../../shared/mcp"

import { isWriteToolAction, isReadOnlyToolAction } from "./tools"
import { isMcpToolAlwaysAllowed } from "./mcp"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isMcpToolAlwaysAllowed import is no longer used after the refactoring and should be removed to keep the code clean.

Fix it with Roo Code or mention @roomote and request a fix.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 13, 2025
Copy link

@lemiesz lemiesz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] auto-approved for running MCP tool is not working for v3.31.1

4 participants