Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixes/9783-namespace-identity-pivot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **Translator**: keep the Responses namespace identity map across the hub-and-spoke pivot — namespace sub-tool calls routed to non-OpenAI targets (Kiro, Cursor) no longer come back flattened (`unsupported call: functions__exec` in Codex CLI) (#9783 — thanks @VXNCXNX)
16 changes: 2 additions & 14 deletions open-sse/handlers/chatCore.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { extractRequestToolIdentityMap } from "./chatCore/requestToolIdentity.ts";
import { injectMemoryAndSkills } from "./chatCore/memorySkillsInjection.ts";
import { resolveChatCoreRequestSetup } from "./chatCore/requestSetup.ts";
import { buildFailureUsageRecord } from "./chatCore/failureUsage.ts";
Expand Down Expand Up @@ -2264,20 +2265,7 @@ export async function handleChatCore({
// the latter is a Kiro/Claude passthrough alias channel with string values,
// while namespace identities carry `{namespace, name}` for the #7936 response
// seam. Extract first because Kiro merge may reuse `_toolNameMap` below.
//
// #9780 — prefer the dedicated channel: on a pivot the openai->claude/gemini
// step publishes its own alias map on `_toolNameMap`, so that property alone
// yields aliases here. The `_toolNameMap` read stays as the fallback for the
// non-pivot producers (executors/base.ts, cliproxyapi.ts, antigravity).
const namespaceIdentityMap = translatedBody._namespaceToolIdentityMap;
const requestToolIdentityMap =
namespaceIdentityMap instanceof Map
? namespaceIdentityMap
: translatedBody._toolNameMap instanceof Map
? translatedBody._toolNameMap
: null;
delete translatedBody._namespaceToolIdentityMap;
delete translatedBody._toolNameMap;
const requestToolIdentityMap = extractRequestToolIdentityMap(translatedBody);

// Kiro: sanitize tool schemas before dispatch. Kiro returns 400 "Improperly
// formed request" for unsupported JSON-Schema keywords (anyOf/$ref/if-then,
Expand Down
26 changes: 26 additions & 0 deletions open-sse/handlers/chatCore/requestToolIdentity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type NamespaceIdentity = { namespace: string; name: string };

/**
* Extract the #7936 request-tool identity map from the translated body and
* strip both side channels before dispatch.
*
* #9780 — prefer the dedicated `_namespaceToolIdentityMap`: on a pivot the
* openai->claude/gemini step publishes its own alias `Map<string, string>` on
* `_toolNameMap`, so that property alone can yield aliases instead of
* identities. The `_toolNameMap` read stays as the fallback for the non-pivot
* producers (executors/base.ts, cliproxyapi.ts, antigravity).
*/
export function extractRequestToolIdentityMap(
translatedBody: Record<string, unknown>
): Map<string, NamespaceIdentity> | null {
const namespaceIdentityMap = translatedBody._namespaceToolIdentityMap;
const requestToolIdentityMap =
namespaceIdentityMap instanceof Map
? namespaceIdentityMap
: translatedBody._toolNameMap instanceof Map
? translatedBody._toolNameMap
: null;
delete translatedBody._namespaceToolIdentityMap;
delete translatedBody._toolNameMap;
return requestToolIdentityMap as Map<string, NamespaceIdentity> | null;
}
Loading