[codex] Assign response item IDs when recording history#28814
[codex] Assign response item IDs when recording history#28814pakrym-oai wants to merge 1 commit into
Conversation
7acd80a to
bd68179
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd681791d8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| #[ts(optional)] | ||
| id: Option<String>, |
There was a problem hiding this comment.
Strip generated IDs for non-OpenAI providers
For configured Responses-compatible providers where provider.info().is_openai() is false, build_responses_request still only clears metadata, so these newly serializable IDs are sent on every recorded user/context/tool-output item. That changes the request shape for custom/non-OpenAI endpoints that previously received schema-only items and may reject arbitrary id fields; keep the locally generated IDs out of non-OpenAI provider requests just like the Codex metadata is stripped.
Useful? React with 👍 / 👎.
2cf87aa to
4966ca6
Compare
4966ca6 to
009bd87
Compare
Why
Client-created response items enter history without IDs, so their identity is lost across rollout persistence and resume. IDs should be assigned once at the history-recording boundary, while IDs returned by the server must remain unchanged.
The Responses API validates item IDs using type-specific prefixes. Locally generated IDs therefore use the matching prefix plus a hyphenated UUIDv7, keeping them valid while distinguishable from server-generated IDs. Because this changes persisted history and provider request shapes, the behavior is opt-in behind the under-development
item_idsfeature. Compaction triggers remain request controls whose API shape does not accept an ID.What changed
item_idsfeature and expose it inconfig.schema.json.ResponseItemIDs serializable and expose them in the generated app-server schemas.item_idsis enabled, assign an ID during conversation-history preparation if an item has no ID.CompactionTriggerand document why it has no ID.prepare_conversation_items_for_historyis the single response-item ID allocation boundary.Test plan
just test -p codex-featuresjust test -p codex-core response_item_ids_persist_across_resume_and_preserve_server_idsjust test -p codex-core non_openai_responses_requests_omit_item_turn_metadatajust test -p codex-core resize_all_images_prepares_failures_before_history_insertionjust test -p codex-protocoljust test -p codex-app-server-protocoljust test -p codex-api azure_default_store_attaches_ids_and_headers