Skip to content

fix: propagate model-suffix/config effort to response streaming and harden affinity#603

Merged
icebear0828 merged 4 commits into
devfrom
fix/egress-log-request-details
May 27, 2026
Merged

fix: propagate model-suffix/config effort to response streaming and harden affinity#603
icebear0828 merged 4 commits into
devfrom
fix/egress-log-request-details

Conversation

@icebear0828
Copy link
Copy Markdown
Owner

Summary

修复 4 个 bug,新增代理面板"粘贴 URL"模式。核心问题:/v1/chat/completions/v1/messages 路由在判断是否向客户端透传推理内容时,错误地读取原始请求字段而非翻译后的 codexRequest,导致通过 model suffix(如 gpt-5.4-high)或 default_reasoning_effort 配置注入的 effort 虽然已正确发到上游,但 Codex 返回的 reasoning deltas 被代理静默丢弃,客户端误以为 effort 无效。

Changes

  • fix(routes) wantReasoning/wantThinking 改为翻译后从 codexRequest.reasoning?.effort 判断,不再只看显式 reasoning_effort/thinking.type 字段 (src/routes/chat.ts, src/routes/messages.ts, tests/unit/translation/openai-to-codex.test.ts)
  • fix(auth) SessionAffinityMap 改存 SHA-256 hash 而非原始 instructions 字符串,防止大 system prompt 占用过多内存;implicit-resume 比对逻辑同步更新 (src/auth/session-affinity.ts, src/routes/shared/proxy-session-helpers.ts, src/routes/shared/proxy-session-context.ts)
  • fix(translation) Codex developer role 在转 OpenAI 兼容格式时映射为 system,避免不接受 developer role 的 provider 返回 400;CodexInputItem 类型补充 developer role (src/translation/codex-request-to-openai.ts, src/proxy/codex-types.ts)
  • fix(routes/proxies) host 字段粘贴完整 URL 时不再 double-prefix (src/routes/proxies.ts)
  • feat(web) 代理面板新增"粘贴 URL"模式,可直接粘贴 http://user:pass@host:port 等完整 URL (web/src/components/ProxyPool.tsx, shared/hooks/use-proxies.ts, shared/i18n/translations.ts)
  • fix(web) JSX ternary false branch 补 Fragment 包装,修复 Vite build 失败 (web/src/components/ProxyPool.tsx)
  • chore config version bump 26.519.81530 / build 3178

Test Plan

  • npm test — 239 files, 2357 passed
  • npm run build — Vite + tsc clean
  • pre-push hook 全绿后推送

Notes

default_reasoning_effort 配置或 model suffix(-high/-low 等)注入的 effort 现在能正确触发客户端可见的 reasoning 内容输出。之前这类配置只影响上游请求,客户端侧完全静默。

…arden affinity

- wantReasoning/wantThinking now derived from codexRequest.reasoning?.effort
  after translation; previously only explicit client fields were checked, so
  effort injected via model suffix (e.g. gpt-5.4-high) or default_reasoning_effort
  config was sent upstream but the returned reasoning deltas were silently dropped
- SessionAffinityMap stores instructions as SHA-256 hash instead of raw string
  to bound per-entry memory usage; implicit-resume comparison updated to match
- developer role in Codex requests now mapped to system for OpenAI-compatible
  backends that reject the developer role; CodexInputItem type updated accordingly
- Proxy host field now accepts a full URL directly to avoid double-prefix when
  user pastes http://... or socks5://... into the host input
- Dashboard proxy panel adds "Paste URL" mode as alternative to field-by-field
  entry; i18n strings added for zh/en
- Config version bump to 26.519.81530 / build 3178
- [CRITICAL] null instructions → hash regression: record() now accepts
  string|null|undefined and uses sha256(instructions ?? "") so that
  no-system-prompt sessions store sha256("") instead of undefined,
  matching the comparison side in proxy-session-context; callers no
  longer coerce null→undefined via ?? undefined
- [HIGH] ProxyPool handleAdd useCallback missing urlMode/newRawUrl deps
  caused URL paste mode to always see stale empty values and never
  submit; also reset urlMode in resetForm()
- [MEDIUM] proxy name credential leak: when name is empty and falls back
  to the full URL, strip username/password before using as display name
Cover three missing paths from PR review:
- empty name with credential URL → name has creds stripped
- full URL pasted into host field → accepted as-is
- explicit name takes precedence over URL fallback
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.

1 participant