Skip to content

Merge upstream core gateway fixes - #1

Merged
SilkageNet merged 20 commits into
mainfrom
codex/merge-upstream-core-fixes
Jun 26, 2026
Merged

Merge upstream core gateway fixes#1
SilkageNet merged 20 commits into
mainfrom
codex/merge-upstream-core-fixes

Conversation

@SilkageNet

Copy link
Copy Markdown
Contributor

Summary

  • Cherry-pick upstream core/gateway/ops/auth fixes onto the internal fork baseline.
  • Keep payment, subscription, balance, redeem, promo, affiliate, announcement, and non-target OAuth changes out.
  • Preserve internal fork cleanup boundaries with no commercial module reintroduction.

Included upstream work

  • OpenAI images/content moderation passthrough fixes.
  • Codex/OpenAI gateway fixes for codex_cli_only, default instruction handling, transport failover, overloaded errors, and apicompat tool arguments.
  • Token refresh invalidated non-retryable handling.
  • Admin usage cache token breakdown stats and tests.
  • Ops dashboard chart sizing fix.
  • OIDC auth identity error handling fix.
  • Antigravity standard-tier project fallback and related UI/test updates.
  • Claude Code terminal template attribution env var.

Skipped intentionally

  • Billing/balance/payment/subscription/order/redeem/promo/affiliate/announcement changes.

Verification

  • go test ./... -timeout=5m
  • pnpm --dir frontend run typecheck
  • pnpm --dir frontend run test:run
  • make build-backend
  • make build-frontend

404QAQ and others added 20 commits June 26, 2026 10:44
…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)
@SilkageNet

Copy link
Copy Markdown
Contributor Author

Self-review before merge:

  • Verified upstream core gateway fixes were merged while commercial/SaaS modules remain removed.
  • Fixed CI drift in workflows, lint/staticcheck, frontend critical tests, and internal baseline schema.
  • Latest PR checks are green: CI (frontend, golangci-lint, test) and Security Scan (frontend-security, backend-security).
  • Local verification included backend unit/integration tests and frontend/build checks during the branch work.

@SilkageNet
SilkageNet marked this pull request as ready for review June 26, 2026 04:24
@SilkageNet
SilkageNet merged commit e7fe86b into main Jun 26, 2026
12 checks passed
@SilkageNet
SilkageNet deleted the codex/merge-upstream-core-fixes branch June 26, 2026 04:24
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.