Skip to content

fix(streaming_codex_chat): prevent empty call_id/name from overwritin…#3928

Open
luantu wants to merge 1 commit into
farion1231:mainfrom
luantu:main
Open

fix(streaming_codex_chat): prevent empty call_id/name from overwritin…#3928
luantu wants to merge 1 commit into
farion1231:mainfrom
luantu:main

Conversation

@luantu

@luantu luantu commented Jun 9, 2026

Copy link
Copy Markdown

Root cause: push_tool_call_delta() unconditionally overwrites state.call_id and state.name even when id_delta/name_delta are empty strings (Some("") instead of None). Some upstream providers (DeepSeek via thirdparty) send empty id/name in late streaming chunks, corrupting previously-set correct values.

Fixes:

  1. push_tool_call_delta: skip empty string overwrites
  2. finalize_tools "already added" path: add defensive fallback for empty call_id/name before emitting output_item.done

Fixes the [SRV-006] connection closed before message completed symptom caused by Codex rejecting tool calls with empty name.

Summary / 概述

Fix tool call state corruption when streaming providers send empty id/name deltas in late chunks, which caused Codex to reject tool calls with empty name and disconnect.

Related Issue / 关联 Issue

N/A

Screenshots / 截图

N/A - no UI changes.

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查
  • pnpm format:check passes / 通过代码格式检查
  • cargo clippy passes (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)
  • Updated i18n files if user-facing text changed / 如修改了用户可见文本,已更新国际化文件

…g tool call state

Root cause: push_tool_call_delta() unconditionally overwrites
state.call_id and state.name even when id_delta/name_delta are
empty strings (Some("") instead of None). Some upstream providers
(DeepSeek via Ruijie) send empty id/name in late streaming chunks,
corrupting previously-set correct values.

Fixes:
1. push_tool_call_delta: skip empty string overwrites
2. finalize_tools "already added" path: add defensive fallback
   for empty call_id/name before emitting output_item.done

Fixes the [SRV-006] connection closed before message completed
symptom caused by Codex rejecting tool calls with empty name.
@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

2 participants