Skip to content

fix(responses): preserve callable identities across translation and shims - #541

Closed
M1k0t0 wants to merge 20 commits into
Menci:mainfrom
M1k0t0:floway/responses-tool-compatibility
Closed

M1k0t0 wants to merge 20 commits into
Menci:mainfrom
M1k0t0:floway/responses-tool-compatibility

Conversation

@M1k0t0

@M1k0t0 M1k0t0 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Responses requests can reuse a callable name across namespaces, function/custom declarations, and replayed history. Translation can conflate these identities, while server-tool shims can mistake a namespaced client call for an injected helper. For example, a historical function read must remain distinct when the next request declares a custom tool named read.

This change preserves those identities through translation, continuation, and hosted-tool execution:

  • Use one translator-owned mapping for declarations, additional_tools / tool_search_output, replay, and selectors in both Responses → Chat Completions and Responses → Anthropic Messages. Restore source names, namespaces, callable kinds, argument events, and echoed tool fields on the return path.
  • Keep names containing . or __ literal unless an explicit namespace is present. Allocate distinct aliases for callable kinds and namespace tuples, preserve namespace descriptions, and bound collision lookup and long-name processing.
  • Reserve client declarations and history when naming server-tool helpers. Dispatch only unnamespaced helper calls, reject identity changes between item creation and completion, and preserve allowed_tools subsets and original choice echoes across helper iterations.
  • Keep native Responses payloads intact and isolate translated provider payloads from canonical history and response echoes. Cover both translation APIs directly and the HTTP continuation, retry, compact-expansion, and server-tool paths.

Validation on bddaf78eb:

  • pnpm run verify passed, including lint, typecheck, 6,434 tests across 588 files, repository checks, and the web build.
  • Installer harness: 66 passed, 44 skipped because this host lacks PowerShell or the pinned Codex 0.144.5 executable.

@M1k0t0
M1k0t0 force-pushed the floway/responses-tool-compatibility branch from 2dbf4dd to c89bcfa Compare September 27, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant