Skip to content

fix(openai): preserve JSON instructions in Codex OAuth input#3337

Open
ddnio wants to merge 1 commit into
Wei-Shaw:mainfrom
ddnio:codex/openai-json-mode-developer-input
Open

fix(openai): preserve JSON instructions in Codex OAuth input#3337
ddnio wants to merge 1 commit into
Wei-Shaw:mainfrom
ddnio:codex/openai-json-mode-developer-input

Conversation

@ddnio

@ddnio ddnio commented Jun 17, 2026

Copy link
Copy Markdown

Summary

  • map Codex OAuth input items with role: "system" to role: "developer" instead of dropping them
  • keep mirroring extracted system text into top-level instructions for the ChatGPT internal Codex endpoint
  • add regression coverage for Responses JSON object requests where the only json instruction is in the system message

Why

The previous transform removed system messages from input after copying their text into instructions. That can break OpenAI Responses JSON object validation because the Responses API requires the word json to appear in the input messages when text.format.type is json_object.

Keeping the message in input as developer preserves the JSON-mode instruction while still avoiding the unsupported system role for the Codex OAuth upstream.

Validation

  • go test ./internal/service -run 'TestApplyCodexOAuthTransform|TestExtractSystemMessagesFromInput|TestIsInstructionsEmpty' -count=1
  • go test ./internal/service -count=1
  • git diff --check upstream/main...HEAD

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign, please reply with the following comment:

I have read the CLA Document and I hereby sign the CLA

You only need to sign once — it will be valid for all your future contributions to this project.


I have read the CLA Document and I hereby sign the CLA


欧阳丹 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant