fix(claude-code): prefix tool names to bypass OAuth validation#10620
Closed
hannesrudolph wants to merge 2 commits intomainfrom
Closed
fix(claude-code): prefix tool names to bypass OAuth validation#10620hannesrudolph wants to merge 2 commits intomainfrom
hannesrudolph wants to merge 2 commits intomainfrom
Conversation
Anthropic rejects third-party tools when using Claude Code OAuth tokens. This adds an 'oc_' prefix to tool names when sending to the API and strips the prefix from responses, allowing Roo Code tools to work with Claude Code OAuth authentication.
Contributor
Re-review complete. Previously flagged item is resolved.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
4 tasks
Addresses review feedback: when tool_choice specifies a specific tool (type: 'tool'), the name must also be prefixed to match the prefixed tool names in the tools array.
|
@hannesrudolph why has this been closed? |
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.
Summary
Closes #10566
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.