Repository navigation
fix(executors): preserve tool-name casing on native Claude OAuth (#4307) - #4314
Merged
Merged
Conversation
The native-Claude OAuth anti-fingerprint cloak renames a tool named `read` to `Read` on the wire and records the reverse alias on a non-enumerable `_toolNameMap`, which the response side un-cloaks to restore the client's original casing. Since v3.8.27 (#3941/#3968) `execute()` returned a JSON-round-tripped `serializedBody` as `transformedBody`; the round-trip drops the non-enumerable map, so the restore saw an empty map and the cloaked `Read` streamed verbatim to the client. Re-attach the live `_toolNameMap` onto the serialized body before returning (non-enumerable, mirrors antigravity.ts::attachToolNameMap) so tool-name casing round-trips correctly. Regression test exercises base.ts execute() through the claude-OAuth cloak path and asserts the returned transformedBody carries the reverse map. Closes #4307
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…gosouzapw#4307) (diegosouzapw#4314) The native-Claude OAuth anti-fingerprint cloak renames a tool named `read` to `Read` on the wire and records the reverse alias on a non-enumerable `_toolNameMap`, which the response side un-cloaks to restore the client's original casing. Since v3.8.27 (diegosouzapw#3941/diegosouzapw#3968) `execute()` returned a JSON-round-tripped `serializedBody` as `transformedBody`; the round-trip drops the non-enumerable map, so the restore saw an empty map and the cloaked `Read` streamed verbatim to the client. Re-attach the live `_toolNameMap` onto the serialized body before returning (non-enumerable, mirrors antigravity.ts::attachToolNameMap) so tool-name casing round-trips correctly. Regression test exercises base.ts execute() through the claude-OAuth cloak path and asserts the returned transformedBody carries the reverse map. Closes diegosouzapw#4307
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.
Closes #4307
Problem
Native Claude OAuth traffic runs through an anti-fingerprint tool-name cloak (
remapToolNamesInRequest/cloakThirdPartyToolNames) that renames a tool literally namedread→Readon the wire and records the reverse alias (Read → read) on a non-enumerablebody._toolNameMap. The response side un-cloaks the streamedtool_use.nameback to the client's original casing using that map.Since v3.8.27 (#3941/#3968)
execute()returns aJSON.parse(JSON.stringify())-round-trippedserializedBodyasresult.transformedBody. The round-trip drops the non-enumerable_toolNameMap, so chatCore's response-side restore sees an empty map and the cloakedReadstreams verbatim to the client — corrupting the tool name (reporter:read→Read, also affectswrite/bash/etc.). Turning compression off does not help (it is unrelated); works direct-to-OpenRouter (cloak only fires for the nativeclaudeprovider).Fix
open-sse/executors/base.ts— after buildingserializedBody, re-attach the live_toolNameMapfromtransformedBody(non-enumerable, so it never re-serializes upstream). Mirrors the existingantigravity.ts::attachToolNameMappattern and the #4091 capture-boundary guard.Validation (Hard Rule #18 — TDD)
tests/unit/tool-name-case-preserve-4307.test.tsexercises the realbase.tsexecute()through the claude-OAuth cloak path (mockedfetch), asserting:Readsent upstream; map not serialized on the wire);result.transformedBody._toolNameMapis aMaprestoringRead → read(fails RED on unfixed code, passes GREEN with the fix), and stays non-enumerable.Related toolname/cloak/executor suites (4091/4181/oauth-cloak/passthrough/field-400) green (47/47). Lint +
typecheck:coreclean.base.tsfile-size baseline bumped 1358 → 1387 in the same commit.