Skip to content

fix(openai): use empty instructions fallback#2257

Open
dahetaoa wants to merge 1 commit intoWei-Shaw:mainfrom
dahetaoa:remove-default-openai-instructions
Open

fix(openai): use empty instructions fallback#2257
dahetaoa wants to merge 1 commit intoWei-Shaw:mainfrom
dahetaoa:remove-default-openai-instructions

Conversation

@dahetaoa
Copy link
Copy Markdown

@dahetaoa dahetaoa commented May 7, 2026

Summary

  • stop injecting the semantic default You are a helpful coding assistant. when Responses instructions is missing
  • normalize missing, nil, blank, or non-string instructions to an empty string instead
  • keep existing non-empty instructions and extracted system messages unchanged

Why

Direct testing against the ChatGPT Codex internal endpoint showed that omitting instructions returns 400 {"detail":"Instructions are required"}, while sending "instructions": "" succeeds. This keeps the required field without adding an unintended system prompt.

Tests

  • go test -race ./internal/service -run 'TestApplyCodexOAuthTransform|TestOpenAIGatewayService_OAuthResponsesUsesEmptyInstructionsWhenMissing|TestOpenAIGatewayService_OAuthMessagesBridgeDoesNotInjectDefaultInstructions|TestOpenAIImageGeneration'
  • go test ./internal/service
  • go test ./internal/pkg/openai ./internal/pkg/apicompat

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@dahetaoa
Copy link
Copy Markdown
Author

dahetaoa commented May 7, 2026

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

github-actions Bot added a commit that referenced this pull request May 7, 2026
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