chore(sync): 精选 cherry-pick 上游 v0.2.10 并保留 fork 定制 - #275
Merged
ranxi2001 merged 12 commits intoOct 2, 2026
Merged
Conversation
(cherry picked from commit 8490a81)
(cherry picked from commit 2cc459e)
(cherry picked from commit aa3a3ea)
(cherry picked from commit e2c35cf)
(cherry picked from commit 13fcfc0)
(cherry picked from commit e878ab7)
(cherry picked from commit 453b796)
(cherry picked from commit b13200d)
(cherry picked from commit ece1ecc)
(cherry picked from commit 0416c9e)
(cherry picked from commit 6a69dd0)
6 tasks done
Production gained 9699d9e and 502db27 (from Wei-Shaw#273). Both this branch (upstream 13fcfc0) and 502db27 added a closeStatus field to openAIResponsesWSUsageLogCase and a configurable close-code assertion. Keep a single field and production's closeStatus local, and drop the now-redundant tc defaulting block; the assertions are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
解决的问题与行为变化
-x来源,并保留 fork 现有定制(冲突处理见下表)。主要变化:claude-sonnet-5-5:模型列表、协议转换、思考强度目录、定价(输入 $2/M、输出 $10/M、缓存写 $2.5/M(1h $4/M)、缓存读 $0.2/M)。cyber_policy_user_allowlist,默认空)。名单内用户:cyber_log_only),不写本地会话屏蔽、不计入自动封号、WebSocket 不断开,已有会话屏蔽对其不生效;risk_control_log_only,动作记为 allow),不拦截请求、不记录违规哈希、不触发封号与通知;关联记录与来源
2f3fed2fdb0787141294cec81487a5df30426f7f,范围 v0.2.9...v0.2.10。没有整包 merge tag,也没有重复引入上游 merge commit。30c6ec46bfeat: support Claude Sonnet 5.58490a81862e052e6e5style: satisfy Sonnet 5.5 lint checks2cc459e243911bf52bfeat(dashboard): toggle recent usage between tokens and spendingaa3a3ea78e1290d54afix(account): prevent whitelist model mapping conflictse2c35cf3932740b3e5fix(gateway): resolve composite routes for websocket aliases13fcfc0f3fed355d1afix(gateway): constrain account model route ownershipe878ab710d508637c7fix(gateway): enforce composite model ownership in legacy scheduling453b796df9054a6f4bfix(gateway): forward received chat stream usageb13200d7a0a2ecb959fix(gateway): normalize streamed Anthropic usageece1ecccc11e4a28e0fix(gateway): avoid ambiguous late-cache input subtraction0416c9ede553f72565feat: add risk control user allowlist6a69dd051冲突与适配(全部在对应 cherry-pick 提交内完成,没有单独的整合提交):
13fcfc0f3)ensureCompositeTargetPlatform。ingress:没有采用上游把BeforeRequest改用rawForHash的部分。fork 的BeforePayloadParse预检已经用客户端原始帧判定模型候选,这正是上游此处要修的问题;BeforeRequest仍用解析后载荷合并解析器注入的能力,并做会话身份与内容审核。上游新增的 7 个组合分组 WebSocket 测试(含「准入使用公开模型名」)全部通过。response.create的版本。fork 会转发session.update等非 turn 帧,不能按通道帧数断言。453b796df)getOpenAIAccountScheduler多一个priority参数,测试按「高级调度关闭」前提传false。6a69dd051)cyber_session_identity_strict_enabled和上游的cyber_policy_user_allowlist。Forget和请求采集配置刷新,并加入上游保留已保存白名单的逻辑。FindCyberSessionBlockedForIdentity,新 helper 为findBlockedCyberSessionForIdentity,HTTP 和 WebSocket 共用。WebSocket 连接内屏蔽保留 fork 的本地准入关闭错误。严格会话身份校验对白名单用户照常执行:它是身份协议要求,不属于封号或本地屏蔽。TestCyberAllowlistedUserBypassesExistingBlocksAndContinuesWebSocket改用明确的session_id:先验证已屏蔽会话被放行,再验证命中后没有为 WebSocket 会话写入新屏蔽。原版用prompt_cache_key,在 fork 中不算会话身份,断言会失去意义。i18n 保留 fork 的cyberSessionBlockHint(明确会话 ID 语义),加入上游白名单文案。e5cd88b3c)502db27d2(来自 #273)和上游13fcfc0f3都给openAIResponsesWSUsageLogCase加了closeStatus字段和可配置的关闭码断言。保留一个字段和 production 的写法,删除多余的默认值赋值,断言内容不变。复现与验收
502db27d2(含 feat(prism): isolate concurrent turns and select account models #269、fix(pelican): 智商测试/鹈鹕测智对 Claude 不再返回为空,并传递思考强度 #271、feat(pelican): 补齐结果 API 管理开关和用户调用信息 #272,以及维护者直接推送的9699d9ee4、502db27d2)。最初基于bf9405e4a完成同步,变基到eceb5632b时用git range-diff核对 11 条提交全部等价;之后 production 又新增上述两个提交,用合并提交e5cd88b3c合入。Go 1.27.0、pnpm 9.15.9,在独立克隆中使用 mock、本地模拟上游和 Docker 集成测试,没有请求生产模型、没有修改运行配置。claude-sonnet-5-5;组合分组用别名建立 Responses WebSocket,第二轮换用其他公开模型名。openai_gateway_ws_composite_test.go(7 个用例)、openai_cyber_allowlist_test.go、risk_control_allowlist_test.go、cyber_policy_allowlist_test.go、setting_cyber_allowlist_test.go、gateway_sonnet55_toolset_beta_test.go,以及调度、流式用量、仪表盘缓存相关用例。协议、调度或传输改动补充
实际验证
当前 head:
e5cd88b3c(在553f72565上合并 production502db27d2)。backend:go vet -tags=unit ./...、go vet -tags=integration ./...backend:go test -tags=unit -count=1 ./...internal/service的TestPriorityOAuthProfitUsesUserChargeAndTheoreticalCost(浮点 3.9999999999999996 ≠ 4)和internal/reauthruntime的TestStopCancelsPreparationAndCannotRestart,在未改动的 productionbf9405e4a与eceb5632b上同样失败(本机 macOS arm64)。internal/mihomo的时序用例只在全量并发时超时,单独运行该包通过。backend:go test -tags=integration -count=1 ./...internal/repository(Docker 中的 Postgres / Redis)和migrations;失败项与上一行相同backend:golangci-lint v2.13.2./...backend:go generate ./ent;backend/cmd/server:wire v0.7.0553f72565上重新生成,与提交内容无差异;合并进来的 production 提交不涉及ent和cmd/servermake test-frontend553f72565;合并进来的 production 提交只改后端,前端代码与当前 head 相同)pnpm --dir frontend run test:runpnpm --dir frontend run build502db27d2go vet、两边都改到的后端包和前端全量检查通过,详见 #277 的验证表。两个 PR 先合哪个都可以。兼容性与运行影响
cyber_policy_user_allowlist(逗号或空白分隔的正整数用户 ID,默认空,空即关闭;格式不合法时整份拒绝保存),设置接口和 DTO 同步增加该字段。Sonnet 5.5 加入模型列表与定价。组合分组 WebSocket 在连接内切换公开模型名,会改为要求重新建连。cyber_log_only/risk_control_log_only记录,不计入自动封号次数;移出名单后,这些历史事件也不会补计(上游设计)。文档与用户可见变化
docs/COMPOSITE_GROUPS.md随上游补充 WebSocket 别名说明。PR 合并不代表已发布或部署。Agent 使用声明
提交前自查
🤖 Generated with Claude Code