Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Model rewrites can bypass exact-model CN mappings and deny rules, while Anthropic conversion can send effort above the configured ceiling without rechecking enforcement.
2 open issues
1 file not reviewed
frontend/pnpm-lock.yaml: Generated file
What changed in this PR
Extends composite-group reasoning-effort policies to DeepSeek, Kimi, Zhipu, and MiniMax, addressing the policy gap described in #8308.
Changes:
- Applies mappings, ceilings, and deny rules across native and converted Messages paths, while preserving requested and forwarded effort metadata.
- Adds final-effort checks and regression coverage for provider normalization, model matching, retries, and streaming.
- Raises the frontend
follow-redirectsoverride and locked version to 1.16.2.
| File | Description |
|---|---|
| frontend/pnpm-lock.yaml | Locks follow-redirects to 1.16.2. |
| frontend/package.json | Raises the follow-redirects override minimum. |
| backend/internal/service/openai_reasoning_effort_policy.go | Adds final ceiling and converted-request validation helpers. |
| backend/internal/service/openai_gateway_messages.go | Applies CN policies and preserves original bodies for retries. |
| backend/internal/service/openai_gateway_messages_cn_policy_test.go | Tests converted CN policies, capabilities, and retry behavior. |
| backend/internal/service/openai_gateway_messages_chat_fallback.go | Applies policies around Chat Completions conversion. |
| backend/internal/service/openai_gateway_messages_anthropic_native.go | Enforces native Messages policies and records original effort. |
| backend/internal/service/openai_gateway_messages_anthropic_native_test.go | Tests native mapping, denial, metadata, and GLM normalization. |
| backend/internal/service/openai_gateway_chat_completions_raw.go | Rechecks ceilings before raw upstream forwarding. |
| backend/internal/handler/openai_chat_completions.go | Uses the ceiling-binding policy helper. |
| backend/internal/handler/openai_chat_completions_reasoning_policy_test.go | Tests forwarded effort and provider-normalization boundaries. |
| backend/internal/handler/composite_platform.go | Enables CN policy binding and Anthropic-compatible values. |
| backend/internal/handler/composite_platform_test.go | Tests supported platforms, binding, and omitted effort. |
Review effort: Balanced
| if service.IsCNProvider(effectiveAPIKeyPlatform(c, apiKey)) { | ||
| maxEffort, mappings = anthropicCompatibleReasoningEffortPolicy(maxEffort, mappings) | ||
| } | ||
| c.Request = c.Request.WithContext(service.WithOpenAIReasoningEffortPolicy(c.Request.Context(), maxEffort, mappings, overLimit)) |
There was a problem hiding this comment.
已在 caaaae7 修复并补充出站边界回归:原始 public model 保持绑定,映射仅执行一跳;CN 的 Chat/Responses→原生 Anthropic 转换后重新执行 cap-only 检查,最终强度及计费元数据一致。本地完整检查和当前 head 的远端 CI、安全检查均通过。
| writeChatCompletionsError(c, http.StatusBadRequest, "invalid_request_error", err.Error()) | ||
| return nil, err | ||
| } | ||
| if cappedBody, changed, policyErr := applyFinalOpenAIReasoningEffortCeiling(ctx, upstreamBody, upstreamModel); policyErr != nil { |
There was a problem hiding this comment.
已在 caaaae7 修复并补充出站边界回归:原始 public model 保持绑定,映射仅执行一跳;CN 的 Chat/Responses→原生 Anthropic 转换后重新执行 cap-only 检查,最终强度及计费元数据一致。本地完整检查和当前 head 的远端 CI、安全检查均通过。
|
感谢修复 CN 目标的推理强度策略缺口。审计中复核确认了两个回归,需要修复后再合并: 1. Chat Completions 原始转发的上限复检没有限定 CN 平台,非 CN 目标出现 403
OpenAI APIKey 账号接 GLM 等第三方 OpenAI 兼容上游、走 raw chat 是 main 上正式支持的组合(见 复现:OpenAI 分组 + OpenAI APIKey 账号,上游模型
上限为 建议:复检加 2. CN GLM 目标上,关闭 thinking 的请求被误判为超限 403Messages → Chat 转换时 复现:composite 分组 → Zhipu(chat_completions 协议),上游 建议:GLM 检查跳过 3. 需要确认的设计点
4. 与 #8161 的冲突两者改同一函数 另:PR 描述写"升级 DOMPurify 至 3.4.17",实际 diff 是 follow-redirects 1.16.1→1.16.2(已与 main 相同),描述请更正。 |
冲突处理:本地续写模型用 turn state,不引入 previous_response_id;按会话绑定是否存在触发一次重试,并补 ContinuationDisabled 状态。测试按二开完整历史重放校正。 Co-Authored-By: Claude Code <noreply@anthropic.com>
…osite-reasoning-mapping
…osite-reasoning-mapping
|
已在原分支整合最新 main 并解决冲突,保留已合入的推理强度合成行为;补齐显式 none 映射后拒绝诊断保留原始请求值的出站回归。此前平台边界、关闭 thinking、GLM 降档和单跳映射修复均保留。另以独立安全提交升级 Go 至 1.27.4,修复新公布的 GO-2026-6859,未添加豁免。本地完整检查、前端 3110 项测试及当前 head 4eda963 的远端 CI、安全检查均通过;当前无冲突,等待复核。 |
Restore Antigravity Responses custom-tool roundtrips and correct Embeddings platform scheduling. Harden OAuth probe fencing, request-scoped Gemini 403 behavior, OpenAI stream failover and WebSocket current-turn safety. Preserve Claude/GPT-6.2/Grok protocol details and model observations; correct Fable/Kimi quota refreshes and user-vs-account cost reporting. Bound scheduler fallback, request memory retention and shutdown/stream lifecycles without unapproved pricing or schema changes. Local checks: complete Go unit packages, PostgreSQL 18.1/Redis 8.4 repository and audit integration, focused -race, frontend typecheck/lint/1858 Vitest/build, backend lint 0 issues and embedded server build. Remote CI/Security Scan remain pending. Upstream references: Wei-Shaw/sub2api Wei-Shaw#8833 Wei-Shaw#8875 Wei-Shaw#8856 Wei-Shaw#8730 Wei-Shaw#8990 Wei-Shaw#8806 Wei-Shaw#8832 Wei-Shaw#8809 Wei-Shaw#8164 Wei-Shaw#8804 Wei-Shaw#8773 Wei-Shaw#8309.

问题
聚合分组路由到 DeepSeek 等国产多协议平台时,已配置的推理强度映射不会绑定到请求;原生 Anthropic 直通路径也没有应用策略,导致显式的
low → max配置静默失效。根因
策略绑定只允许 OpenAI / Anthropic 目标,原生
/v1/messages直通路径在转发前未执行绑定的策略。改动
验证
重复检查与边界
已核对 #5602、#8161、#5171 和 #5919:它们未覆盖本次国产目标原生直通的策略绑定与应用缺口。不新增平台能力、不改变未配置流量;实际供应商端点未进行在线请求验证。
Fixes #8308