fix(streaming_codex_chat): prevent empty call_id/name from overwritin…#3928
Open
luantu wants to merge 1 commit into
Open
fix(streaming_codex_chat): prevent empty call_id/name from overwritin…#3928luantu wants to merge 1 commit into
luantu wants to merge 1 commit into
Conversation
…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.
Owner
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
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:
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 typecheckpasses / 通过 TypeScript 类型检查pnpm format:checkpasses / 通过代码格式检查cargo clippypasses (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)