Merge upstream core gateway fixes - #1
Merged
Conversation
…of retrying
When gpt-image upstream returns response.completed with no image but a text
refusal (content moderation, e.g. the model replies "this request was judged
unsafe to generate"), the soft-failure path treated it as a probabilistic
upstream failure and returned a retryable UpstreamFailoverError (502). Retrying
or switching accounts is futile for a content-policy block — it just burns
other accounts' quota and still surfaces an opaque 502 to the client.
Distinguish the two no-image cases:
(A) model text refusal -> 400 content_policy_violation, no retry, refusal
reason passed through to the client.
(B) truly empty response -> unchanged: retryable UpstreamFailoverError (502).
Adds extractOpenAIImagesModelRefusal (extracts the refusal text from
output_text.delta / message output_text, capped at 600 chars) and two unit
tests; the existing empty-response retry test is unaffected.
(cherry picked from commit 9491de0a39a35ff9a58752c1e26e56f5c03d7336)
…al templates (cherry picked from commit 28e7adef095f5512922a3c45b224dea7e67bd68e)
(cherry picked from commit ae5e980dd12f7f8061ba8644788b156565e704cb)
The concurrency / switch-rate / throughput cards on the ops dashboard sit in grid cells that only set `min-h-[360px]` (no definite height). Their inner card uses `h-full`, which resolves to `auto` when the parent height is `auto`. Combined with the Chart.js `responsive` + `maintainAspectRatio: false` charts, this forms a height feedback loop: the canvas reads the parent height to size itself, the content then grows, the next ResizeObserver tick reads an even larger height, and the cards stretch downward without bound. On wide screens (`lg:grid-cols-4`) a sibling card usually fixes the row height via `align-items: stretch`, masking the issue. It surfaces when no sibling bounds the row height — e.g. the single-column (`grid-cols-1`) stacked layout on narrow viewports, or when the concurrency card collapses to little content. `min-h` only sets a floor, not a ceiling. Fix: give the two Chart.js canvas cells a definite height (`h-[360px]`) so the responsive resize has a fixed reference and the loop cannot run. The concurrency card is not a responsive canvas, so it keeps `min-h-[360px]` to avoid clipping its content. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit 9707dedca2f8c57b7f36a015f8577a403a3e7372)
…wed err (cherry picked from commit 82576e0a389d76d4384d68f8edb508ed8725667c)
(cherry picked from commit 65fa728921f8de8d177c020143f8ead8599b032f)
(cherry picked from commit 063454ae9668b2efe12475034186d237013a703a)
(cherry picked from commit 4567f6582b5d61b39c715eef739dd32c43f73c80)
(cherry picked from commit dbdbfb11225d2f036c34287ccc8f6028fe2289ed)
(cherry picked from commit 0a97a5f461557d26cf89fb21da9f191e96de4da8)
(cherry picked from commit 650c50e34bc8754471be629c0689ba69b6e8d682)
(cherry picked from commit cc7612bdbd622d4504321ff3af3f4d04e929640a)
…upstreams
When converting a Chat Completions stream into Responses events, the first
tool_call delta chunk was copied wholesale into stream state (including
function.arguments), then the same chunk's arguments were accumulated again by
the shared `+=` block. For OpenAI this is harmless because its first tool_call
chunk carries empty arguments, but upstreams that pack id+name+arguments into a
single chunk (e.g. GLM/Zhipu) end up with doubled arguments such as
{"cmd":"ls"}{"cmd":"ls"}. Codex then fails to parse the tool call with
"trailing characters", breaking every tool invocation.
Reset the copied arguments so the shared accumulator counts them exactly once,
keeping the emitted delta and the final done/arguments consistent.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 29122e30514f9af95ed8b7c9f8b6aa5984b0b55f)
…ated addition (cherry picked from commit c9f42e1f77b924289dcfb2011e16e836af004b18)
Contributor
Author
|
Self-review before merge:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Included upstream work
Skipped intentionally
Verification