Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 9, 2025

Description

This PR addresses Issue #7817 by filtering out newer Claude Code built-in tools that were not being disabled, causing Roo to attempt to call them incorrectly.

Changes

  • Added a static readonly Set CLAUDE_CODE_BUILTIN_TOOLS containing the three built-in tools to filter
  • Modified the tool_use case handler to silently ignore Claude Code built-in tools
  • Added comprehensive test coverage with multiple test cases

Testing

  • ✅ All existing tests pass
  • ✅ Added new tests specifically for filtering Claude Code built-in tools
  • ✅ Tests verify that built-in tools are silently ignored while other tools still log warnings

Related Issues

Fixes #7817

Checklist

  • Code follows project conventions
  • Tests have been added/updated
  • All tests pass
  • Linting passes
  • Type checking passes

Important

Filters out specific Claude Code built-in tools to prevent incorrect calls by Roo and adds tests to ensure functionality.

  • Behavior:
    • Filters out Claude Code built-in tools ExitPlanMode, BashOutput, KillBash in run.ts to prevent incorrect calls by Roo.
    • Modifies tool_use handler to silently ignore these tools.
  • Testing:
    • Adds tests to verify built-in tools are ignored and other tools log warnings.

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

… KillBash)

- Added CLAUDE_CODE_BUILTIN_TOOLS set to track built-in tools
- Modified tool_use handling to silently ignore built-in tools
- Added comprehensive tests for the filtering behavior
- Fixes #7817
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 9, 2025 14:23
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Sep 9, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like grading my own homework - suspiciously perfect yet somehow still wrong.

export class ClaudeCodeHandler extends BaseProvider implements ApiHandler {
private options: ApiHandlerOptions
// Claude Code built-in tools that should be filtered out
private static readonly CLAUDE_CODE_BUILTIN_TOOLS = new Set(["ExitPlanMode", "BashOutput", "KillBash"])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it make sense to extract this constant to a shared file like src/integrations/claude-code/constants.ts? This would:

  • Provide a single source of truth for Claude Code built-in tools
  • Make it reusable if needed elsewhere
  • Make it easier to maintain if the list changes

Also, I noticed in src/integrations/claude-code/run.ts there's already a list of disabled tools that includes exit_plan_mode (snake_case) but not these PascalCase versions. Should these lists be synchronized?


consoleSpy.mockRestore()
})
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding a test that verifies the Set contains exactly these three tools and no others. Something like:

Suggested change
})
test("should have exactly the expected Claude Code built-in tools", () => {
const expectedTools = new Set(["ExitPlanMode", "BashOutput", "KillBash"])
// Would need to make CLAUDE_CODE_BUILTIN_TOOLS accessible for testing
expect(ClaudeCodeHandler.CLAUDE_CODE_BUILTIN_TOOLS).toEqual(expectedTools)
})

This would prevent accidental additions or removals in the future.

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

@roomote-agent Can't you just add them to the claudeCodeTools list in src/integrations/claude-code/run.ts ?

@roomote
Copy link
Contributor Author

roomote bot commented Sep 9, 2025

Hi @juliettefournier-econ! I see your suggestion about adding the tools to the claudeCodeTools list in src/integrations/claude-code/run.ts. Let me investigate this approach and implement it if it provides a cleaner solution. I'll update the PR shortly.

As suggested by @juliettefournier-econ, this change moves the filtering
of Claude Code built-in tools (ExitPlanMode, BashOutput, KillBash) from
the handler level to the CLI configuration level by adding them to the
claudeCodeTools disallowed list in run.ts.

This is a cleaner approach as it prevents these tools from being used
at the source rather than filtering them after the fact.
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 9, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Sep 9, 2025

Hi @juliettefournier-econ!

I've implemented your suggestion and refactored the code to add the Claude Code built-in tools (ExitPlanMode, BashOutput, KillBash) directly to the claudeCodeTools list in src/integrations/claude-code/run.ts.

This is indeed a cleaner approach as it prevents these tools from being used at the CLI level rather than filtering them after the fact.

Changes made:

  1. ✅ Added the three built-in tools to the claudeCodeTools disallowed list in run.ts
  2. ✅ Removed the CLAUDE_CODE_BUILTIN_TOOLS Set and filtering logic from claude-code.ts
  3. ✅ Updated tests to remove the specific filtering tests (since filtering is now handled at the CLI level)

All tests are passing locally. The PR is ready for review!

Thank you for the excellent suggestion! 🎉

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 10, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 10, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to Triage in Roo Code Roadmap Sep 10, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Sep 10, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 10, 2025
@mrubens
Copy link
Collaborator

mrubens commented Sep 10, 2025

What do you think of switching to allowed tools instead of disallowed tools? Otherwise seems like this will break again soon.

@daniel-lxs
Copy link
Member

@mrubens I think this is done this way cause there's no flag to disallow all tools and having a single tool allowed might make Claude Code try to use it which will probably break something on Roo Code, maybe we should find a tool that doesn't cause any issues and only allow that one?

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

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Some of Claude Code tools are not disabled

6 participants