fix(claude-code): prefix tool names to bypass OAuth validation #10620
+382
−8
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.
Summary
Anthropic rejects third-party tools when using Claude Code OAuth tokens. This PR prefixes tool names with
oc_when sending requests to the API and strips the prefix from tool names in responses, allowing Roo Code tools to work with Claude Code OAuth authentication.This is based on the approach suggested in #10570 - thank you to @anomalyco @fernando234234.
This PR is blocked pending approval from Anthropic.
We are concerned that implementing this workaround could lead to widespread bans of users utilizing the Claude Code integration in Roo Code. Anthropic has recently taken action against third-party clients, and we want to ensure this change does not put our users at risk.
We will not merge this PR until we receive explicit confirmation from Anthropic that this approach is acceptable.
Changes
src/integrations/claude-code/streaming-client.tsTOOL_NAME_PREFIX = "oc_"constantprefixToolName()andstripToolNamePrefix()for use by other modulesprefixToolNames()andprefixToolNamesInMessages()createStreamingMessage()to:src/integrations/claude-code/__tests__/streaming-client.spec.tsprefixToolNameandstripToolNamePrefixfunctionsTesting
All 23 tests in the streaming-client test suite pass, including the new tests for the tool name prefixing functionality.
Important
This PR prefixes tool names with
oc_in API requests and strips the prefix in responses to bypass Anthropic's OAuth validation, pending approval from Anthropic.oc_in API requests and strips prefix in responses increateStreamingMessage()instreaming-client.ts.tool_useblocks andtool_choice.prefixToolName(),stripToolNamePrefix(),prefixToolNames(),prefixToolNamesInMessages(), andprefixToolChoice()instreaming-client.ts.streaming-client.spec.ts.This description was created by
for f578dfb. You can customize this summary. It will automatically update as commits are pushed.