Skip to content

fix(openai): return 429 for empty upstream output#227

Merged
CJackHwang merged 1 commit intodevfrom
codex/change-empty-responses-to-429
Apr 6, 2026
Merged

fix(openai): return 429 for empty upstream output#227
CJackHwang merged 1 commit intodevfrom
codex/change-empty-responses-to-429

Conversation

@CJackHwang
Copy link
Copy Markdown
Owner

Motivation

  • Upstream empty responses (not content-filtered) are semantically throttling-like; map those cases to HTTP 429 Too Many Requests instead of 502 Bad Gateway while keeping the existing error code for clients.

Description

  • Change empty-output handling in internal/adapter/openai/upstream_empty.go to write http.StatusTooManyRequests for non-filtered empty upstream output while preserving error.code == "upstream_empty_output".
  • Update tests in internal/adapter/openai/handler_toolcall_test.go and internal/adapter/openai/responses_stream_test.go to expect 429 for the empty-upstream non-stream paths.

Testing

  • Ran the targeted unit tests with go test ./internal/adapter/openai -run "UpstreamOutputEmpty|ContentFilterErrorWhenUpstreamFilteredWithoutOutput" and they passed (ok).

Codex Task

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Apr 6, 2026 8:56am

@CJackHwang CJackHwang marked this pull request as ready for review April 6, 2026 09:09
@CJackHwang CJackHwang merged commit 13687ce into dev Apr 6, 2026
3 checks passed
@CJackHwang CJackHwang deleted the codex/change-empty-responses-to-429 branch April 6, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant