fix(codex): return proper error instead of empty response on context overflow#1786
fix(codex): return proper error instead of empty response on context overflow#1786SethBurkart123 wants to merge 6 commits intorouter-for-me:mainfrom
Conversation
Ensure context overflow and similar upstream terminal SSE failures are surfaced as OpenAI-compatible errors instead of falling through to empty successful completions.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where Codex model chat completions exceeding the context window would result in an empty response, disrupting client applications. The changes introduce proper handling and propagation of terminal Server-Sent Event (SSE) errors, such as context length overruns and rate limits, directly within the response stream. This ensures that client-side tools receive meaningful error messages instead of ambiguous empty responses, significantly improving the reliability and user experience for long conversations. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly propagates Server-Sent Event (SSE) errors from the codex backend to the client, which is a great improvement for error handling in streaming responses. My review includes suggestions to improve the implementation's robustness and maintainability. Specifically, I've recommended using structs instead of map[string]any for building JSON, refining the error message fallback logic, and making type assertions in tests safer to prevent panics.
Use a human-readable fallback message when upstream omits error.message, and harden test type assertions for clearer failures.
|
bump |
luispater
left a comment
There was a problem hiding this comment.
Thanks for fixing the empty-success response path here — surfacing terminal SSE failures is the right direction. I found one blocking gap before I’d approve: the new SSE error path drops retry-after semantics for quota/usage-limit events. The existing HTTP error path preserves that via parseCodexRetryAfter / newCodexStatusErr, and the auth conductor uses RetryAfter() to mark credentials unavailable until the real reset time. With this patch, usage_limit_reached delivered over SSE falls back to generic quota backoff instead of the upstream reset window. Please preserve or compute retryAfter in parseCodexSSEError and add a test covering a usage_limit_reached payload with resets_at / resets_in_seconds.
e207c39 to
7913502
Compare
Currently, when a client requests a chat completion from a codex model which exceeds the context of the model, an empty response is given which messes with a large number of clients such as Droid. These changes pass and emit the error which fully fixes long conversations for many third party cli tools.
If you have any issues please reach out I'll be happy to fix it up (I'd love if this issue would be fully fixed).