fix(codex-responses): cap over-long call_id instead of failing the request - #72006
Closed
Imacx-maria wants to merge 1 commit into
Closed
fix(codex-responses): cap over-long call_id instead of failing the request#72006Imacx-maria wants to merge 1 commit into
Imacx-maria wants to merge 1 commit into
Conversation
…quest
The codex app-server names MCP tool calls
``codex_mcp__<server>__<tool>_exec-<uuid4>``. A 36-character uuid plus
``_exec-`` already leaves only 22 characters for the server and tool names, so
real ids run well past the Responses API's 64-character ``call_id`` limit.
Measured on a live install:
94 codex_mcp__codex_apps__google_calendar.search_events_exec-<uuid>
93 codex_mcp__codex_apps__google_calendar.create_event_exec-<uuid>
92 codex_mcp__openaiDeveloperDocs__search_openai_docs_exec-<uuid>
82 codex_mcp__hermes-tools__kanban_complete_exec-<uuid>
Replaying such a transcript over the Responses wire — a background-review
fork, or any codex_app_server -> codex_responses downgrade — then dies on:
Invalid 'input[187].call_id': string too long. Expected a string with
maximum length 64, but got a string with length 71 instead.
That is a non-retryable client error, so the entire call is lost. Observed
repeatedly on a live gateway: every background-review pass failed this way,
meaning the runtime's self-review stage silently never ran.
Cap instead of fail. ``_cap_call_id`` keeps a readable prefix and appends a
sha256 digest of the FULL original id, so distinct calls cannot collide and
the result is exactly 64 characters. It is a pure function of the input, so
replays and prefix caches stay stable (AGENTS.md Pitfall NousResearch#16 — deterministic
IDs in tool call history). Ids already within the limit are returned
untouched, leaving the ordinary ``call_...`` shape unaffected.
Applied inside ``_preflight_codex_input_items``, the single choke point every
request passes through, at all three write sites — function_call plus both
function_call_output branches (string and multimodal array). Uniform
application in one pass is what keeps a call and its output referencing the
same id; the tests assert that pairing explicitly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018tF9BacnKsd4w7KXmFeKP6
Collaborator
Contributor
|
Thanks for the focused regression coverage. This is an automated hermes-sweeper review; current
The member triage note correctly identified this as duplicate work; the current-main implementation now provides the requested behavior and regression coverage. |
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.
Problem
The codex app-server names MCP tool calls
codex_mcp__<server>__<tool>_exec-<uuid4>. A 36-character uuid plus_exec-already leaves only 22 characters for the server and tool names, so real ids run well past the Responses API's 64-charactercall_idlimit. Measured on a live install:Replaying such a transcript over the Responses wire — a background-review fork, or any
codex_app_server->codex_responsesdowngrade — then dies on:code: string_above_max_length, a non-retryable client error, so the entire call is lost. Observed repeatedly on a live gateway: every background-review pass failed this way, meaning the runtime's self-review stage silently never ran at all. Any MCP-heavy transcript on this runtime is affected, because effectively every MCP call id exceeds the limit.Fix
Cap instead of fail.
_cap_call_idkeeps a readable prefix and appends a sha256 digest of the full original id, so distinct calls cannot collide and the result is exactly 64 characters:It is a pure function of the input, so replays and prefix caches stay stable (AGENTS.md Pitfall #16 — deterministic IDs in tool call history). Ids already within the limit are returned untouched, leaving the ordinary
call_...shape completely unaffected.Applied inside
_preflight_codex_input_items— the single choke point every request passes through — at all three write sites:function_callplus bothfunction_call_outputbranches (string and multimodal array). Uniform application within one pass is what keeps a call and its output referencing the same id.Tests
call_...ids are untouched