chore(upgrade): 升级 Sub2API 到 0.1.178 - #5
Merged
Conversation
Replace if-then-t.Fatal nil checks with testify require.NotNil so staticcheck can prove the pointer is non-nil before field access. Fixes SA5011 in payment_handler_test, parse_test, and openai_images_incomplete_test.
OpenAI OAuth 账户收到 402 deactivated_workspace(ChatGPT Team 工作区被停用)时, 将同一 Team(credentials.chatgpt_account_id 相同)的其余 active 账户一并置为 error 并进程内立即熔断,让调度瞬间切走,避免流量继续打到已死的兄弟账户。 - 触发条件仅限 402 + detail.code == deactivated_workspace;通用 402 与 401 行为不变 - 调用点两处:fastpath 各类早退之前 + HandleUpstreamError 顶部,进程内 60s 按 Team 去重 - 逐账户 SetError(错误信息标注触发账户),单账户失败不中断其余 - 默认生效,无配置开关
后端: - 协议凭证维度 credentials[api_protocol] ∈ chat_completions(默认)/anthropic/responses(deepseek) - /v1/messages 零转换直通原生 Anthropic 端点(kimi/zhipu/deepseek),CC/Responses 入站交叉组合走 apicompat 双向转换链(responses/chat_completions anthropic-native 转发器) - count_tokens:anthropic 协议透传原生端点;其余 CN 协议本地 tiktoken 估算 - Coding Plan 额度探测(5h/weekly 滚动窗口)+ payg 余额探测(kimi/deepseek), deepseek 双币种 CNY+USD 明细,任一币种达标不停调 - 周期任务 [CNBalance] 并发探测 + 预算随工作量放大;响应式 429 冷却到最早窗口 重置点;余额不足可恢复临时停调;智谱 CREDIT_LIMIT 不污染窗口解析 - CC→anthropic 流式客户端断开后继续排水上游保住 usage 计量 前端: - 创建/编辑弹窗 account_mode + api_protocol + base_url 联动预设(含 watcher 竞态防护) - 用量单元格:kimi/zhipu coding 显示 5h/weekly 窗口,kimi/deepseek payg 显示余额, 多币种并列展示;探测失败保留快照;挂载自动探测 5min 去抖 - 调度阈值设置面板补 kimi/zhipu 平台(对齐后端 AllowedSchedulingThresholdPlatforms)
89d826b raised backend/go.mod to `go 1.26.6` and updated the three CI workflows' version assertions, but left the Go builder image in all three Dockerfiles pinned at 1.26.5. Since the official golang images set GOTOOLCHAIN=local, the toolchain is not auto-downloaded and any image build fails hard at `go mod download`. CI does not catch this: the workflows build with actions/setup-go, not with these Dockerfiles. Also extend the Go-upgrade checklist in DEV_GUIDE.md, which listed only the CI files -- that omission is why the Dockerfiles were missed.
…ng-image-follows-gomod fix(docker): Go 构建镜像跟上 go.mod 的 1.26.6(否则任一 Dockerfile 构建都直接失败)
…ast-policy-ui fix(frontend): clarify OpenAI Fast/Flex policy rules
- 三个文件补 gofmt 规范对齐(结构体尾部注释、const 块字段对齐) - isSupportedProvider 在 validateProvider 改用能力集合后无引用,删除
feat: add Ollama Cloud usage query action
…main fix: skip expiry reminders without SMTP config
…main fix(ops): avoid single-insert fallback after batch failure
把已有的本地窗口统计接到 Free 24h 与付费 7d/30d 进度条,避免只显示官方百分比。
fix(openai): complete bulk account settings
Skip the prepaid chip without a positive balance, and skip used/limit when monthly limit is 0.
… stubs - user_repo.create(): keep the TxFromContext fast path, but restore tolerance for dbent.ErrTxStarted in the self-owned-transaction branch. ent's Client.Tx only inspects the driver type, so a repository built from a tx-bound client (client-injected transactions, e.g. the integration fixture testEntTx + tx.Client()) hits ErrTxStarted; reuse that client instead of failing. Fixes the two red integration tests in allowed_groups_contract_integration_test.go. - createUserAndClaimInvitation: roll back via defer (matching the OAuth registration precedent) so a panic inside the transaction cannot leak the connection. - settingRepoStub: guard call counters and state with a mutex; the new concurrency regression test exercises it from multiple goroutines and the unsynchronized counters were flagged by -race.
…nsform path The struct field alone never reached the wire: the raw passthrough pipeline is covered by enableMixedGeminiToolInvocations (Wei-Shaw#5711), but TransformClaudeToGeminiWithOptions builds GeminiToolConfig from scratch and never set the flag, so gemini-* models entering through the Claude format gateway could still hit the upstream 400 from issue Wei-Shaw#5709. - Set IncludeServerSideToolInvocations=true when the built tool declarations mix functionDeclarations with googleSearch, matching the raw-path injection semantics. - Replace the marshal-roundtrip-only test with behavior tests that drive TransformClaudeToGeminiWithOptions: mixed tools set the flag, function-only and web-search-only requests leave it unset.
… and de-drift models version - Replace ApplyCodexCanonicalIdentity with CodexCanonicalAuthIdentity / ApplyCodexCanonicalAuthIdentity: the credential face (auth.openai.com token exchange / refresh / PAT whoami) now sends the originator + canonical User-Agent pair and no version header, matching codex-rs default_headers(); the version gate (Wei-Shaw#3901) only exists on the /backend-api/codex inference face. whoami keeps its original header shape (originator + UA) with the canonical UA source. - Token exchange and refresh send the full pair instead of a bare UA, eliminating the half-identity (UA without originator) combination no real client ever emits. - Codex models manifest: the Version header now follows the client's own client_version when it is valid and >= the upstream floor (same source as the query param, restoring the pre-refactor consistency), falling back to the canonical version otherwise; the query param keeps its verbatim passthrough contract. - Drop the now-unreferenced openAICodexProbeVersion constant and its vacuous consistency assertions; probes resolve their version through resolveCodexOutboundIdentity at runtime.
…er-side-tool-invocations fix(gemini): support includeServerSideToolInvocations in GeminiToolConfig
…tou-race fix(auth): make invitation code consumption atomic with user creation
…utbound-identity fix(Fingerprint): 将 Codex 非推理出站身份统一到推理解析链
…nal-main feat(grok): 用量条补齐本站 24h/7d/30d 聚合,并隐藏空预付与 0 限额已用
…ustom-tools fix(openai): restore API-key custom tool calls
…om-tools fix(openai): 补齐 WS HTTP bridge 的客户端工具适配
…om-tools fix(openai): 补齐客户端工具终止事件恢复
- ChannelsView platformOrder now includes the three CN provider platforms so channel pricing can be configured for them; composite group expansion/attachment stays limited to the five main platforms (matches backend isConcreteRequestPlatform and composite-routes target_platform validation) - SyncPricingModels maps kimi->moonshot, zhipu->zhipu, deepseek->deepseek; also fixes gemini mapping to "google" which matched zero catalog entries (provider key is "gemini") - Add CN platform colors to channel pricing model tag classes
- fetchUsage 显式识别 UsageInfo.Error/ErrorCode/NeedsReauth/IsBanned/IsForbidden (antigravity/grok 等平台失败不走 Go error 通道,此前会被误判为 operational) - 凭据失效语义(401/403)标记 CredentialInvalid → failed 状态; grok quota_unknown 已知未知态豁免不判失败 - 失败快照进 60s 负缓存,避免故障/凭据失效期间以最小 15s 间隔打上游 - 同账号并发抓取由 singleflight 合并(脱离调用方 ctx,45s 总超时兜底)
- remote 模式始终显示搜索框且不做本地过滤,输入 300ms 防抖后 emit('search')
- 关闭/卸载时取消排队中的防抖定时器,避免尾随空 query
- loading 时空态显示加载文案;未设 remote 时行为不变(回归用例保障)
- 选择器改为 /admin/accounts?platform=&search= 服务端搜索(50 条/页, 300ms 防抖由 Select 承担),AbortController + 序列守卫防乱序覆盖 - 已绑定账号不在结果页时用 getById 回填为固定选项,删除「不在列表即 静默清空绑定」;绑定仅在显式切换 provider 或账号确实失效时清空(带提示) - OpenAI 平台配额模式显示 Codex 探测额度消耗提示;checkModeQuotaHint 修正为「不发送探活请求」不再宣称「不产生 LLM 请求」 - grok spec 补齐缺失的 accounts mock;新增账号选择器 7 用例 (加载/防抖搜索/回填保留/失效清空/提示门控/固定选项/切平台清空)
…-platforms fix(channels): 渠道定价支持 Kimi/智谱/DeepSeek 平台
…r-quota-mode feat(monitor): 渠道监控配额模式——关联账号展示用量/余额(重启 Wei-Shaw#5387)
合并官方 v0.1.178(指纹 seed、渠道配额模式、国产供应商、谷峰定价),保留本 fork 窗口图与其它二开定制。 # Conflicts: # backend/cmd/server/VERSION # backend/cmd/server/wire_gen.go # backend/internal/handler/openai_chat_completions.go # backend/internal/handler/openai_gateway_handler.go # backend/internal/service/api_key_auth_cache_impl.go # backend/internal/service/api_key_auth_cache_profit_test.go
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.
摘要
合并官方
v0.1.178(含随后的 VERSION 同步提交),保留本 fork 二开定制。官方带来的主要变化
保留的二开
冲突处理
VERSION→0.1.178-clarence.1wire_gen.go:国产余额巡检 + 额度刷新通知 cleanup 都保留EdgeName/EntryHost/CyberBlockedturnStart与二开 cyber 请求体快照本地验证
go build ./cmd/server/go test ./cmd/server/ ./internal/service/ ./internal/handler/合入后打
v0.1.178-clarence.1发 GHCR 镜像。生产机只拉镜像,不在ccs上构建。