Skip to content

Fix Codex provider: use SSE streaming as required by API - #53

Merged
gburachas merged 1 commit into
mainfrom
fix/codex-streaming
Feb 23, 2026
Merged

gburachas merged 1 commit into
mainfrom
fix/codex-streaming

Conversation

@gburachas

Copy link
Copy Markdown
Owner

Summary

  • Codex API requires stream: true — was set to false, causing 400 error
  • Rewrote provider to consume SSE event stream via httpx streaming
  • Parses response.output_text.delta, response.function_call_arguments.delta, response.output_item.added, response.completed events
  • Added retry logic with exponential backoff for 429/500-504 errors
  • Friendly ChatGPT usage limit error messages

Fixes #52

Test plan

  • 94 tests pass
  • Run pytoclaw agent with Codex OAuth and verify streaming response works

🤖 Generated with Claude Code

The Codex API requires stream=true. Rewrote the provider to use httpx
streaming, parse SSE events (data: lines separated by \n\n), and
accumulate text deltas, function call arguments, and usage stats.

Added retry logic with exponential backoff for transient errors
(429, 500-504, rate limits). Friendly error messages for ChatGPT
usage limits.

Fixes #52

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gburachas
gburachas merged commit ad0baf7 into main Feb 23, 2026
0 of 2 checks passed
@gburachas
gburachas deleted the fix/codex-streaming branch February 23, 2026 03:46
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.

Codex provider fails: Stream must be set to true

1 participant