Skip to content

[codex] Add optional IDs to response items#28812

Merged
pakrym-oai merged 3 commits into
mainfrom
pakrym/response-item-id-fields
Jun 18, 2026
Merged

[codex] Add optional IDs to response items#28812
pakrym-oai merged 3 commits into
mainfrom
pakrym/response-item-id-fields

Conversation

@pakrym-oai

@pakrym-oai pakrym-oai commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Why

ResponseItem variants do not have a consistent internal ID shape: some variants carry required IDs, some carry optional IDs, and some cannot represent an ID at all. The existing fields also use inconsistent serde, TypeScript, and JSON-schema annotations. A single enum-level access path is needed before history recording can assign and retain IDs.

This PR establishes that internal model only. It intentionally does not generate or serialize IDs; allocation and wire persistence are isolated in the stacked follow-up.

What changed

  • Give every concrete ResponseItem variant an Option<String> ID field.
  • Apply the same internal-only annotations to every ID field: #[serde(default, skip_serializing)], #[ts(skip)], and #[schemars(skip)].
  • Add ResponseItem::id() and ResponseItem::set_id() as the shared accessors.
  • Preserve IDs when history items are rewritten for truncation.
  • Adapt consumers that previously assumed reasoning and image-generation IDs were required.
  • Regenerate app-server schemas so the hidden fields are represented consistently.

The serde catch-all ResponseItem::Other remains ID-less because it must remain a unit variant.

Test plan

  • cargo check --tests -p codex-core -p codex-api -p codex-rollout-trace -p codex-image-generation-extension
  • just test -p codex-protocol
  • just test -p codex-app-server-protocol
  • just test -p codex-api -p codex-rollout-trace -p codex-image-generation-extension
  • just test -p codex-core event_mapping

@pakrym-oai pakrym-oai force-pushed the pakrym/response-item-id-fields branch from 485dfc7 to 6a9a24c Compare June 17, 2026 23:28
@pakrym-oai pakrym-oai changed the title [codex] Expose response item IDs [codex] Add IDs to response items Jun 17, 2026
@pakrym-oai pakrym-oai force-pushed the pakrym/response-item-id-fields branch from 6a9a24c to 9637b32 Compare June 17, 2026 23:37
@pakrym-oai pakrym-oai changed the title [codex] Add IDs to response items [codex] Add optional IDs to response items Jun 17, 2026
@pakrym-oai pakrym-oai marked this pull request as ready for review June 18, 2026 00:10
@pakrym-oai pakrym-oai requested a review from a team as a code owner June 18, 2026 00:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9637b32125

ℹ️ 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".

Comment thread codex-rs/protocol/src/models.rs Outdated
Comment thread codex-rs/app-server-protocol/schema/typescript/ResponseItem.ts Outdated
Comment thread codex-rs/core/src/event_mapping.rs Outdated
@pakrym-oai pakrym-oai merged commit dbd2857 into main Jun 18, 2026
31 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/response-item-id-fields branch June 18, 2026 01:27
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants