Skip to content

Fix Codex OAuth Responses proxy input normalization#1735

Open
ruizanthony wants to merge 1 commit into
agent0ai:mainfrom
ruizanthony:fix/codex-oauth-responses-input
Open

Fix Codex OAuth Responses proxy input normalization#1735
ruizanthony wants to merge 1 commit into
agent0ai:mainfrom
ruizanthony:fix/codex-oauth-responses-input

Conversation

@ruizanthony

Copy link
Copy Markdown

This PR fixes a Codex OAuth proxy compatibility issue when Agent Zero uses LiteLLM Responses API.

LiteLLM can send input as a string or empty string in some Responses API paths. The local Codex OAuth proxy forwarded that payload unchanged to the Codex upstream /responses endpoint, which expects input to be a list and returns {"detail":"Input must be a list"}.

The fix normalizes input inside prepare_responses_body() before forwarding:

  • list: preserved;
  • dict: wrapped in a one-item list;
  • non-empty string: wrapped as a user message;
  • empty string or None: converted to an empty list.

Regression tests cover string input and empty string input.

Checks run:

  • /a0/venv/bin/python -m py_compile plugins/_oauth/helpers/codex.py plugins/_oauth/helpers/routes.py tests/test_oauth_codex.py
  • /a0/venv/bin/python -m pytest tests/test_oauth_codex.py -q — 37 passed

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