Skip to content

feat(core): add metadata field to ResponseItem#28355

Merged
owenlin0 merged 5 commits into
mainfrom
owen/carry_responses_api_item_metadata
Jun 15, 2026
Merged

feat(core): add metadata field to ResponseItem#28355
owenlin0 merged 5 commits into
mainfrom
owen/carry_responses_api_item_metadata

Conversation

@owenlin0

@owenlin0 owenlin0 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR adds an optional metadata field to ResponseItem for Responses API calls. Only mechanical plumbing, no actual values populated and sent yet. Turns out just adding a new field to ResponseItem has quite a large blast radius already.

This change is backwards compatible because metadata is optional and omitted when absent, so existing response items and rollout history without it still deserialize and requests that do not set it keep the same wire shape. For provider compatibility, we strip out metadata before non-OpenAI Responses requests so Azure and AWS Bedrock never see this field.

My followup PR here will actually make use of it to start storing and passing along turn_id: #28360

What changed

  • Added ResponseItemMetadata with optional turn_id, plus optional metadata on Responses API item variants and inter-agent communication.
  • Preserved item metadata through response-item rewrites such as truncation, missing tool-output synthesis, compaction history rebuilding, visible-history conversion, rollout/resume, and generated app-server schemas/types.
  • Strip item metadata from non-OpenAI Responses requests while preserving it for OpenAI-shaped requests.
  • Updated the mechanical fixture/test construction churn required by the new optional field.

@owenlin0 owenlin0 changed the title [codex] carry Responses API item metadata core: add metadata field to ResponseItem Jun 15, 2026
@owenlin0 owenlin0 changed the title core: add metadata field to ResponseItem feat(core): add metadata field to ResponseItem Jun 15, 2026
@owenlin0 owenlin0 force-pushed the owen/carry_responses_api_item_metadata branch from 1537199 to e5daf04 Compare June 15, 2026 17:59
@owenlin0 owenlin0 marked this pull request as ready for review June 15, 2026 18:02
@owenlin0 owenlin0 requested a review from a team as a code owner June 15, 2026 18:02
@owenlin0 owenlin0 requested a review from pakrym-oai June 15, 2026 20:29
ResponseItem::FunctionCallOutput {
call_id: call_id.clone(),
output: FunctionCallOutputPayload::from_text("aborted".to_string()),
metadata: metadata.clone(),

@pakrym-oai pakrym-oai Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be None?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good catch, agreed

@owenlin0 owenlin0 merged commit 040dafa into main Jun 15, 2026
31 checks passed
@owenlin0 owenlin0 deleted the owen/carry_responses_api_item_metadata branch June 15, 2026 22:05
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 15, 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