问题描述
使用 Codex CLI 通过 moonbridge 连接 DeepSeek V4 Pro 时,会话频繁异常中断,主要有两个错误:
1. ReasoningSummaryDelta without active item
当 DeepSeek 返回 thinking 内容时,moonbridge 无条件发送 response.reasoning_summary_part.added、response.reasoning_summary_text.delta、response.reasoning_summary_part.done 事件。但 Codex Responses API 在没有 active response item 的情况下无法处理这些事件,导致大量错误(单次会话 1640+ 次)。
错误日志:
ReasoningSummaryDelta without active item
临时修复: 在 adapter.go 中注释掉了 3 处 reasoning summary 事件发送,并在配置中设置 supports_reasoning_summaries: false。
2. apply_patch 工具类型映射失败
当 codex_tool_proxy 扩展启用时,apply_patch 被展开为 5 个代理工具(apply_patch_add_file 等)。但 DeepSeek 有时直接调用 apply_patch 而非代理工具名。此时 BuildToolMapFromCore 构建的映射表中没有 apply_patch 条目,导致 fallback 到 function_call 类型,Codex 无法处理。
错误日志:
Fatal error: tool apply_patch invoked with incompatible payload
apply_patch verification failed: invalid patch: The first line of the patch must be '*** Begin Patch'
临时修复: 在 BuildToolMapFromCore 中增加 fallback 注册逻辑,当代理工具存在时同时注册原始工具名。
环境
- moonbridge 版本:最新 main 分支
- Codex CLI 版本:0.134.0
- 上游模型:DeepSeek V4 Pro(通过
https://api.deepseek.com/anthropic)
- 配置:
mode: Transform,codex_tool_proxy 默认启用
建议修复方向
- ReasoningSummary: adapter 应检查是否有 active item 才发送 reasoning summary 事件,或在配置
supports_reasoning_summaries: false 时完全跳过
- apply_patch 映射:
BuildToolMapFromCore 应自动为代理工具注册原始工具名的 fallback 条目
问题描述
使用 Codex CLI 通过 moonbridge 连接 DeepSeek V4 Pro 时,会话频繁异常中断,主要有两个错误:
1. ReasoningSummaryDelta without active item
当 DeepSeek 返回 thinking 内容时,moonbridge 无条件发送
response.reasoning_summary_part.added、response.reasoning_summary_text.delta、response.reasoning_summary_part.done事件。但 Codex Responses API 在没有 active response item 的情况下无法处理这些事件,导致大量错误(单次会话 1640+ 次)。错误日志:
临时修复: 在
adapter.go中注释掉了 3 处 reasoning summary 事件发送,并在配置中设置supports_reasoning_summaries: false。2. apply_patch 工具类型映射失败
当
codex_tool_proxy扩展启用时,apply_patch被展开为 5 个代理工具(apply_patch_add_file等)。但 DeepSeek 有时直接调用apply_patch而非代理工具名。此时BuildToolMapFromCore构建的映射表中没有apply_patch条目,导致 fallback 到function_call类型,Codex 无法处理。错误日志:
临时修复: 在
BuildToolMapFromCore中增加 fallback 注册逻辑,当代理工具存在时同时注册原始工具名。环境
https://api.deepseek.com/anthropic)mode: Transform,codex_tool_proxy默认启用建议修复方向
supports_reasoning_summaries: false时完全跳过BuildToolMapFromCore应自动为代理工具注册原始工具名的 fallback 条目