Commit Graph
8502 Commits
Author SHA1 Message Date
pood1eandClaude Opus 5.5 ed3317d02b feat(openai): let API-key accounts send an isolated session ID on Chat Completions
Self-hosted routers such as vllm-router keep a session on one decode
replica by the X-Session-ID header, but the Chat Completions outbound path
forwards only accept-language and user-agent from the client. The new
account extra key `openai_chat_session_id` makes that path send the
client's session as X-Session-ID, isolated per API key with
isolateOpenAIUpstreamSessionID. The session comes from the same sources
as x-opencode-session: client session headers first, then the
prompt_cache_key or metadata.user_id remembered before protocol
conversion, so /v1/responses and /v1/messages requests converted to Chat
Completions keep their sessions. Account header overrides still apply
last, and accounts without the key send the same headers as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 04:53:38 -08:00
github-actions[bot] f53641e53c chore: sync VERSION to 0.2.26 [skip ci] 2026-11-28 08:23:23 +00:00
shaw 9494105c7e Revert "Merge pull request #7672 from william-drakemond/fix/updater-require-checksum"
This reverts commit 2b47d8a36c, reversing
changes made to e38f8ad784.
v0.2.26
2026-11-28 16:14:12 +08:00
Wesley Liddick cd3a998434 Merge pull request #9132 from william-drakemond/pr/aistudio-thought-signature
fix(openai): 为发往 AI Studio 的历史 tool_calls 补齐 Gemini thought_signature / Add Gemini thought signatures to AI Studio tool-call history
2026-11-28 13:06:33 +08:00
Wesley Liddick 122cda9896 Merge pull request #9131 from william-drakemond/pr/chat-stream-null-tool-index
fix(apicompat): 无 index 的并行 tool_calls 不再合并为同一项 / Keep index-less parallel tool calls separate
2026-11-28 13:06:26 +08:00
Wesley Liddick 8d5b3fda3c Merge pull request #9130 from william-drakemond/pr/merge-assistant-commentary-after-tool-calls
fix(apicompat): 合并紧跟在 tool_call 后的 assistant 文本消息 / Merge assistant commentary after tool calls
2026-11-28 13:06:19 +08:00
Wesley Liddick 86bae77dab Merge pull request #9129 from william-drakemond/pr/responses-input-object-arguments
fix(apicompat): ResponsesInputItem.Arguments 兼容 JSON 对象格式 / Accept JSON object arguments in ResponsesInputItem
2026-11-28 13:06:12 +08:00
Wesley Liddick a233668015 Merge pull request #9127 from fengshao1227/fix/antigravity-quota-exhausted-switch-immediately
fix(antigravity): QUOTA_EXHAUSTED 429 立即冷却并切换账号,不再同号退避重试
2026-11-28 13:06:05 +08:00
Wesley Liddick 2eaf0e645d Merge pull request #9126 from fengshao1227/fix/pending-oauth-form-always-verify-email
fix(auth): 第三方首登建号表单不再按全局邮箱验证开关隐藏验证码
2026-11-28 13:05:56 +08:00
Wesley Liddick 5b2498bac9 Merge pull request #9125 from fengshao1227/fix/anthropic-message-start-output-usage-v2
fix(gateway): 原生 Anthropic 流保留 message_start 已上报的 output_tokens
2026-11-28 13:05:49 +08:00
Wesley Liddick 60793b1bde Merge pull request #9124 from fengshao1227/fix/chat-bridge-incomplete-terminal-event
fix(apicompat): Chat→Responses 流在 length 截断时以 response.incomplete 收尾
2026-11-28 13:05:41 +08:00
Wesley Liddick 8fbc096757 Merge pull request #8704 from yakwu/fix/usage-tooltip-viewport-clamp
fix(frontend): keep info tooltips inside the viewport on mobile
2026-11-28 13:05:34 +08:00
Wesley Liddick 099818d164 Merge pull request #8244 from AndersonBY/codex/antigravity-quota-precision
fix(antigravity): preserve fractional quota utilization
2026-11-28 13:05:25 +08:00
William Drake efda6f6fb0 fix(openai): add Gemini thought signatures to AI Studio tool-call history
Google AI Studio rejects replayed function calls without a thought signature (400 "Function call is missing a thought_signature in functionCall parts"). The signature arrives in tool_calls[].extra_content.google, which Codex Responses history cannot preserve, so follow-up turns after tool calls fail when routed to AI Studio.

Before a Chat Completions request goes to generativelanguage.googleapis.com, give each assistant tool call without an existing thought_signature the dummy value skip_thought_signature_validator (matching the native Gemini path). Signatures embedded in Unity/LiteLLM "__thought__" call-id suffixes are not reused because they are issued by a different Google backend and fail with INVALID_THOUGHT_SIGNATURE; the call id itself is kept intact so tool outputs still match. Other upstreams are byte-for-byte unchanged.
2026-11-27 16:21:34 -07:00
William Drake bb58d8103e fix(apicompat): accept JSON object arguments in ResponsesInputItem 2026-11-27 16:21:12 -07:00
William Drake 63b5e11e04 fix(apicompat): merge assistant commentary after tool calls 2026-11-27 16:21:07 -07:00
William Drakemond 59caf6d08b fix(apicompat): keep index-less parallel tool calls separate
Google AI Studio OpenAI-compatible streams send parallel tool calls
without an index, each whole in its own chunk with its own id. A missing
index defaulted to 0, so both calls merged into one item with arguments
like {"cmd":"ls"}{"cmd":"date"} and the stream failed with
invalid tool call arguments (502). Without an index, continue the last
call when the delta has no id or the same id, otherwise open the next
contiguous slot. Indexed streams are unchanged.
2026-11-27 16:21:02 -07:00
Anderson cd65afc0fd merge current upstream main into quota precision fix 2026-11-28 00:23:00 +08:00
li c2f3bcfe3f fix(antigravity): QUOTA_EXHAUSTED 429 立即冷却并切换账号,不再同号退避重试
classifyAntigravity429 已把配额耗尽识别为 antigravity429QuotaExhausted,但
handleSmartRetry 只在 overages 分支用到它;积分不可用或积分重试失败后,因
parseAntigravitySmartRetryInfo 只认 RATE_LIMIT_EXCEEDED,函数返回 Continue,
antigravityRetryLoop 在同一个已耗尽账号上再做 2 次指数退避(1s+2s 和两次
必然失败的上游请求),开启 overages 时还会逐次重复积分重试。

现在该情形按重试用尽时的同一套规则冷却账号(handleError,按 quotaResetDelay
写模型级限流),清理粘性会话并返回 AntigravityAccountSwitchError,与
RATE_LIMIT_EXCEEDED 长延迟分支一致;同时记录 failover 运维事件保留 429 原因。

- 把循环末尾"裸 429 认领 + 冷却"提为 applyAntigravity429Cooldown 共用,
  message-only 的 QUOTA_EXHAUSTED(同属裸 429)仍遵守每请求最多冷却一个账号。
- Claude 路径签名/budget 修正二次重试收到切换信号时转为 failover(新增
  antigravityRetrySwitchToFailover,与 Gemini 路径一致),不再吞掉后返回原始 400。

既有用例 429WithResetDelay_CoolsEveryAccount 断言循环返回 429 响应,改为断言
返回切换信号且每个账号冷却一次,用例本意不变。

Refs #8978
2026-11-27 19:33:54 +08:00
li 418bcedbbd fix(auth): 第三方首登建号表单不再按全局邮箱验证开关隐藏验证码
后端 createPendingOAuthAccount → RegisterOAuthEmailAccount → VerifyOAuthEmailCode
无条件要求本地邮箱验证码(注释写明有意独立于全局 email_verify_enabled),
发码端点 SendPendingOAuthVerifyCode 同样不看该开关。共享表单
PendingOAuthCreateAccountForm 却在全局开关关闭时隐藏发码入口并把验证码
清空提交,导致微信、OIDC、钉钉首登(及需邀请码时的 Linux DO)在关闭邮箱
验证后一律返回 EMAIL_VERIFY_REQUIRED,用户无法完成建号。

门控源自 aea2950b1:后端只给 Linux DO 加了关闭验证时直接登录的分支,
却把门控加在了所有提供方共用的表单上。去掉该门控,始终显示发码入口
并提交用户填写的验证码;普通注册页 RegisterView 不受影响。

原用例把"关闭时隐藏控件、提交空验证码"写成了预期,改为断言控件仍在、
可发码、提交携带验证码。

Fixes #9103
2026-11-27 19:19:03 +08:00
li 289791ab2b fix(gateway): 原生 Anthropic 流保留 message_start 已上报的 output_tokens
/v1/messages 的通用解析 extractSSEUsagePatch 与透传解析 parseSSEUsagePassthrough
在 message_start 分支都不读 usage.output_tokens,只靠后续 message_delta。
上游在 message_delta 前 EOF / 读错误 / 超时时,已观测到的输出用量被记成 0,
造成少计费。Antigravity 解析器与兼容路径的 mergeAnthropicUsage 早已对
message_start 读取 output_tokens > 0,本次对齐这两处。

message_delta 的 output_tokens 是累计值,继续覆盖起始值,不相加。

Fixes #7873
2026-11-27 19:05:47 +08:00
li a0522fae7f fix(apicompat): Chat→Responses 流在 length 截断时以 response.incomplete 收尾
FinalizeChatCompletionsResponsesStream 在 finish_reason=length 时已把
response.status 置为 incomplete 并带上 incomplete_details,但终止事件名
仍固定为 response.completed。按事件类型分派的 Responses 客户端(如 Codex)
会把被 max_tokens 截断的输出当作正常完成。

兄弟转换器 Anthropic→Responses 早已按 status 选择 response.incomplete,
本次对齐。计费用量取自上游原始 chunk 扫描,不读取这批事件,不受影响;
仓库内 Responses→Chat 转换器已把 response.incomplete 识别为终止事件。

既有两条用例把旧事件名编码进 switch 分支、且无"必须看到终止事件"的标志,
改名后断言会被静默跳过;改为匹配 response.incomplete、遇到 completed 直接
失败,并补 sawIncomplete 标志。

Refs #7876
2026-11-27 18:59:27 +08:00
Wesley Liddick 4233cc3d80 Merge pull request #9121 from Wei-Shaw/fix/moderation-anthropic-url-image
fix(moderation): moderate Anthropic URL image sources
2026-11-27 18:35:51 +08:00
shaw 959d365324 fix(moderation): moderate Anthropic URL image sources
Content moderation collected Anthropic image blocks only from source.data, never
from source.url. Since #8312 the /v1/messages -> OpenAI Responses bridge forwards
URL image sources upstream as input_image, so an image sent as
{"type":"url","url":...} (including a data: URI) reached the model without
being moderated, while the same image sent as base64 was. The native Anthropic
path forwarded such images unmoderated as well.

Collect source.url like the other image URL fields; addModerationImage still
accepts only http(s) and data: values.
2026-11-27 18:03:17 +08:00
Wesley Liddick 8aa4d39288 Merge pull request #9115 from NewtonCookie/fix/anthropic-chat-usage
fix: sample Claude usage on chat completions
2026-11-27 17:06:19 +08:00
Wesley Liddick aaec3887d0 Merge pull request #8843 from r266-tech/codex/oauth-deadline-clock-fixture
test(oauth): make late refresh deadline deterministic
2026-11-27 17:06:15 +08:00
Wesley Liddick a2df5a86e9 Merge pull request #8839 from r266-tech/codex/precontent-keepalive-clock-fixture
test(antigravity): stabilize repeated pre-content keepalives
2026-11-27 17:06:11 +08:00
Wesley Liddick d3ae7a17a6 Merge pull request #8756 from r266-tech/codex/synchronize-ws-ttft-fixture
test(openai): synchronize WebSocket TTFT fixtures
2026-11-27 17:06:07 +08:00
Wesley Liddick affdc20c02 Merge pull request #8705 from lzj960515/fix/request-memory-lifecycle
fix(gateway): 减少长会话请求的内存分配与持有
2026-11-27 17:06:02 +08:00
Wesley Liddick 7c6cbda974 Merge pull request #8596 from lkon2112/fix/grok-quota-test-races
test(grok): synchronize free-quota refresh tests
2026-11-27 17:05:57 +08:00
Wesley Liddick f7e0191ac2 Merge pull request #8355 from Yukinoshita-Yukino/codex/kimi-k31-minimal-support
fix(kimi): add K3.1 Pro routing, Codex reasoning and default pricing
2026-11-27 17:05:52 +08:00
Wesley Liddick 25a65452f2 Merge pull request #8312 from zyh-y/fix/anthropic-url-image-sources
fix(apicompat): preserve Anthropic URL image sources
2026-11-27 17:05:48 +08:00
Wesley Liddick 1d65de5cae Merge pull request #8295 from r266-tech/codex/fix-responses-tool-failover
fix(openai): fail over Sol/Terra tool requests on Chat-only accounts
2026-11-27 17:05:43 +08:00
Wesley Liddick 6e537028d4 Merge pull request #8254 from AndersonBY/codex/fix-quota-label-overlap
fix(frontend): keep long quota labels clear of progress bars
2026-11-27 17:05:39 +08:00
Wesley Liddick 6215b9fe5f Merge pull request #8246 from AndersonBY/codex/antigravity-parallel-tool-images
fix(antigravity): keep parallel tool results contiguous across notices
2026-11-27 17:05:35 +08:00
Wesley Liddick 18f8813da3 Merge pull request #8245 from AndersonBY/codex/antigravity-local-usage-stats
fix(accounts): show local Antigravity usage statistics
2026-11-27 17:05:31 +08:00
Wesley Liddick eaf4521e78 Merge pull request #8217 from r266-tech/codex/compact-failure-model
fix(responses): include model in compact failure events
2026-11-27 17:05:26 +08:00
Wesley Liddick 2b47d8a36c Merge pull request #7672 from william-drakemond/fix/updater-require-checksum
fix(update): 在线更新强制校验 checksum,缺失时拒绝安装
2026-11-27 17:05:22 +08:00
shaw fa375e60e1 fix(kimi): keep stripping the Codex none placeholder for K3.1
The previous Codex catalog advertised only "none" for k3.1-pro, so Codex
clients that still hold it send reasoning.effort=none. Preserving none for
K3.1 made those requests fail upstream with HTTP 400 (K3.1 cannot disable
thinking) instead of running at the default effort as they do today.

Keep the existing compatible-upstream rule on the Responses path: strip the
none placeholder for K3.1 exactly like every other Kimi model. The new
catalog no longer advertises none, so current clients are unaffected.
2026-11-27 16:29:02 +08:00
shaw 8950e12524 fix(gateway): keep OpenCode session hints valid JSON
openCodeSessionHintBody built the hint with strconv.Quote, which emits Go
escapes such as \U000f0001 that are not JSON. A session id containing such a
rune (private-use or tag characters, e.g. subdivision flag emoji) was read
back truncated, so different conversations could share one
x-opencode-session. Encode with json.Marshal instead.

Also measure the compaction allocation budget in a child test process, as
main already does for other process-wide allocation counters, so background
goroutines left by other service tests cannot fail it intermittently.
2026-11-27 16:27:11 +08:00
shaw cbe5bfd1cb fix(gateway): sample Claude usage on the Responses bridge too
The Anthropic /v1/responses bridge had the same gap as the Chat Completions
bridge: successful OAuth/setup-token responses never refreshed the 5h/7d
subscription windows. Sample the response headers on 2xx exactly like the
Chat Completions path, and cover both bridges in one regression test.
2026-11-27 16:25:22 +08:00
Yakun WuandClaude Opus 5.5 8cbd318de3 fix(frontend): keep info tooltips inside the viewport on mobile
HelpTooltip always centered its popup above the trigger, so on a ~375px
screen any info icon near the left or right edge (ops dashboard cards,
accounts table headers, modal fields) pushed the tooltip off screen.
Several forms also hand-rolled CSS-only hover popups that are absolutely
positioned from the icon and get cut off by the viewport and the dialog
body.

- Move the placement logic from UsageTable into a shared
  getTooltipPosition helper (utils/floatingPanel.ts): prefer one side,
  flip to the opposite side when it does not fit, otherwise pin to the
  viewport edge; clamp the cross axis.
- HelpTooltip measures its popup and uses the helper (above, flipping
  below near the top of the screen); the arrow keeps pointing at the icon.
- UsageTable token/cost tooltips use the same helper.
- Replace the hand-rolled info popups in GroupsView, Create/EditAccountModal
  and the usage stats cache breakdown with HelpTooltip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:31:58 +08:00
Yakun WuandClaude Opus 5.5 5d3ec1aa16 fix(usage): keep token/cost detail tooltips inside the viewport
The token and cost detail tooltips in the usage table were always placed
8px to the right of the info icon. On narrow (mobile) screens the cost
column sits near the right edge, so the non-wrapping tooltip was cut off.

After rendering, measure the tooltip: flip it to the left of the icon when
it does not fit on the right, pin it to the right edge when neither side
fits, and clamp it vertically to the viewport.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:22:26 +08:00
Wesley Liddick e38f8ad784 Merge pull request #9118 from Wei-Shaw/fix/proxy-selector-account-count
fix(accounts): 代理下拉框右侧显示账号数并在打开弹窗时刷新
2026-11-27 15:07:05 +08:00
Wesley Liddick 96148ee93b Merge pull request #9117 from Wei-Shaw/fix/issue-8992-image-safety-risk-control
fix(risk-control): 生图安全系统拒绝纳入风控中心(仅留证)
2026-11-27 15:06:28 +08:00
shaw 397f66aebf fix(risk-control): tighten image safety detection and display
Review follow-up:

- Stop treating parameter errors as safety rejections. The message
  matcher no longer uses a bare "moderation" keyword and rejects
  "unknown/unrecognized/unsupported parameter" style messages, so
  Azure-style "Unrecognized request argument supplied: moderation"
  (param null) and error-passthrough rewrites (which drop param/code)
  are not recorded with the user's prompt.
- Check explicit safety codes before the param exclusion, so Azure
  content filtering (code=content_filter, param=prompt), contentFilter
  and ResponsibleAIPolicyViolation are recorded; response_incomplete is
  only a 400 for content_filter/moderation reasons and counts as well.
- Show image_safety rows with the hit badge instead of the amber error
  badge, and exclude them from the "error" result filter.
2026-11-27 14:45:25 +08:00
shaw 2ad419706d fix(accounts): keep older proxy counts when a newer refresh fails
Review follow-up for the proxy account count refresh:

- Apply a proxy list response only if it is newer than the last applied
  one. Previously a failed newer refresh also discarded a slower older
  success, which could leave the selector empty.
- Refresh proxy counts on every `created` event. Batch creation can
  partially succeed and keep the dialog open, so opening the dialog was
  not enough.
- Test ProxySelector with the real vue-i18n and locale files instead of
  a hand-written mock of the plural rule.
2026-11-27 14:39:04 +08:00
r266-tech abe5903a17 Merge main and use the upstream allocation test isolation 2026-11-27 15:07:06 +09:00
shaw fd2f9770a2 fix(accounts): show proxy account counts on the right and keep them fresh
The proxy selector in the account dialogs showed a bare number next to
the proxy name, and AccountsView loaded the counts only once on mount,
so they went stale after accounts were created, deleted, imported or
rebound.

- Show "N 个账号" / "N account(s)" on the right of each proxy row, before
  the test button, with a tooltip.
- Reload proxies with counts whenever the create, edit or bulk-edit
  dialog opens. A sequence guard drops out-of-order responses and a
  failed reload keeps the previous list.
2026-11-27 13:51:37 +08:00
shaw 75e6df8f4a fix(risk-control): record image safety-system rejections in the risk center
Image requests rejected by the upstream safety system (for example
"Your request was rejected by the safety system") were only visible in
the ops error log. They are now also written to the risk control center
as log-only evidence (action=image_safety, mode=risk_control_log_only):
no hash blacklist, no auto-ban count, no email, response unchanged.

Detection covers HTTP 400 from the native Images API, SSE/Responses
error events, model refusal text and content_filter incompletes. 400s
carrying error.param (e.g. an invalid `moderation` value) are excluded.
The record uses the gateway request ID from context so it joins with the
ops error log; the response header may carry the upstream x-request-id.

Refs #8992
2026-11-27 13:51:32 +08:00