Skip to content

fix(openai): support Codex agent input items - #2455

Open
0YHR0 wants to merge 3 commits into
envoyproxy:mainfrom
0YHR0:agent/support-codex-agent-input-items
Open

fix(openai): support Codex agent input items#2455
0YHR0 wants to merge 3 commits into
envoyproxy:mainfrom
0YHR0:agent/support-codex-agent-input-items

Conversation

@0YHR0

@0YHR0 0YHR0 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

Allow Responses API requests containing Codex-emitted agent_message and agent_reasoning input items to pass through OpenAI-compatible backends.

Root cause

The Responses input-item union rejected these types before the request reached the upstream provider.

Fix

Preserve the raw JSON for both types, so their evolving Codex-specific fields are forwarded unchanged without requiring an incomplete schema model.

Related Issue

Fixes #2442

Testing

  • go test ./internal/apischema/openai -run '^TestResponseInputItemUnionParam(MarshalJSON|UnmarshalJSON)$' -count=1

Signed-off-by: 0YHR0 <97868579@qq.com>
@0YHR0
0YHR0 requested a review from a team as a code owner July 30, 2026 08:42
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 30, 2026
@dosubot

dosubot Bot commented Jul 30, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-08-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about ai-gateway Add Dosu to your team

@codecov-commenter

codecov-commenter commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.04%. Comparing base (25afc17) to head (ebcd272).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2455      +/-   ##
==========================================
- Coverage   85.05%   85.04%   -0.01%     
==========================================
  Files         159      159              
  Lines       22645    22655      +10     
==========================================
+ Hits        19261    19268       +7     
- Misses       2217     2219       +2     
- Partials     1167     1168       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nacx nacx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@nacx
nacx enabled auto-merge (squash) July 30, 2026 11:05
…gent-input-items

# Conflicts:
#	internal/apischema/openai/openai.go
#	internal/apischema/openai/openai_test.go
auto-merge was automatically disabled August 2, 2026 07:56

Head branch was pushed to by a user without write access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Responses API rejects Codex-emitted agent_message and agent_reasoning input item types

3 participants