Conversation
Contributor
Verification: Looks cleanReviewed the Codex Responses input-item ID length cap. The fix correctly addresses the HTTP 400 Verified:
Good defensive fix for a silent failure mode that would be hard to diagnose in production. |
adambiggs
force-pushed
the
fix/codex-replay-id-length-cap
branch
from
June 15, 2026 16:40
af7067d to
77f1fa2
Compare
adambiggs
force-pushed
the
fix/codex-replay-id-length-cap
branch
from
July 2, 2026 00:05
77f1fa2 to
2db475f
Compare
The chatgpt.com/backend-api/codex endpoint caps input item ids at 64 characters and rejects longer ones with HTTP 400 string_above_max_length. With store=False the backend returns ~400-char encrypted message ids, so echoing them back on the next turn's replay failed the entire request. The id field is optional on replayed assistant messages, so both replay paths (_chat_messages_to_responses_input and _preflight_codex_input_items) now route ids through a shared _replayable_item_id helper that drops anything the backend would refuse instead of sending it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
adambiggs
force-pushed
the
fix/codex-replay-id-length-cap
branch
from
July 9, 2026 07:28
2db475f to
9d40ef9
Compare
3 tasks
Collaborator
|
Thanks for the focused helper-based fix and boundary tests. #62225 has now landed the same 64-character guard at both replay boundaries, with full current CI and end-to-end preflight coverage. Closing as superseded; your parallel contribution is credited on the merged PR and issue closeout. |
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.
What
Both Codex Responses replay paths (
_chat_messages_to_responses_inputand_preflight_codex_input_items) now route assistant-message item ids through a shared_replayable_item_idhelper that omits any id longer than 64 characters instead of sending it.Why
The
chatgpt.com/backend-api/codexendpoint caps input item ids at 64 characters and rejects longer ones with HTTP 400string_above_max_length. Withstore=False(our default) the backend returns ~400-char encrypted message ids onresponse.completed; echoing those ids back insidecodex_message_itemson the next turn fails the entire request, breaking every subsequent turn of the session.idis optional on replayed assistant messages, so dropping a backend-illegal id is safe — the message content,status, andphasestill replay intact (phase is what the prefix-cache guidance actually cares about).How to test
New tests cover the helper's accept/reject boundary (exactly 64 chars accepted, 65+ rejected, whitespace/non-string rejected) and both replay paths: a ~400-char encrypted id is omitted while content/phase survive, and backend-legal ids are preserved verbatim.
Full
tests/agent+tests/run_agentsuites: 5684 passed, 0 failed.To reproduce the original failure manually: run
hermesagainst ChatGPT-plan Codex OAuth (gpt-5.5), complete one assistant turn, then send a second message — pre-fix the second request 400s withstring_above_max_lengthon the replayed message item id.Platforms
Tested on Linux (x86_64, Python 3.11). Pure data-normalization change, no platform-specific behavior.
🤖 Generated with Claude Code