fix: strip _claudeCodeRequiresLowercaseToolNames before serialization

The sentinel field set by remapToolNamesInRequest() was being included in
the JSON body sent to Anthropic, which rejects unknown top-level fields
with 400 invalid_request_error. Stripped before JSON.stringify in both
code paths:
- buildAndSignClaudeCodeRequest (CC bridge / anthropic-compatible-cc-*)
- base executor serialization path (native claude/ provider)

Pre-existing bug, not introduced by issue #2260 changes.
This commit is contained in:
Mourad Maatoug
2026-05-15 18:07:57 +02:00
parent d0d8638a02
commit 4d000f1eb0
2 changed files with 7 additions and 1 deletions

View File

@@ -856,6 +856,11 @@ export class BaseExecutor {
// CLI fingerprint ordering — always-on for native Claude OAuth, opt-in
// for other providers. Header + body field order is itself a fingerprint.
let finalHeaders = headers;
// Strip internal sentinel fields set by remapToolNamesInRequest before
// serializing — Anthropic rejects unknown top-level fields (issue #2260).
delete (transformedBody as Record<string, unknown>)[
"_claudeCodeRequiresLowercaseToolNames"
];
let bodyString = JSON.stringify(transformedBody);
const shouldFingerprint =

View File

@@ -354,7 +354,8 @@ export async function buildAndSignClaudeCodeRequest(
obfuscateInBody(body);
}
// Step 7: Serialize with CCH placeholder
// Step 7: Serialize with CCH placeholder (strip internal sentinel fields)
delete (body as Record<string, unknown>)["_claudeCodeRequiresLowercaseToolNames"];
const serialized = JSON.stringify(body);
// Step 8: Sign with xxHash64