Tool calls always hang: Codex function_call loses call_id
Quick fix
A commenter confirmed non-empty id/name checks restore tool calls. The post also suggests bypassing CC Switch Responses translation to connect directly to…
Symptom
Section titled “Symptom”Codex 不再派发工具、不发第二轮请求、不报错,会话循环沉默。Codex stops dispatching tools, sends no second-round request, and reports no error. The session loop goes silent.
In the report, when CC Switch converts upstream Chat Completions streaming responses into Responses events, the tool call id in the first delta is valid, but subsequent empty strings overwrite the accumulated state, leaving call_id empty in response.output_item.done and response.completed. Codex relies on call_id to pair tool calls with results, so tool dispatch stops. The author reproduced this with qwen3.7-max, qwen3.6-plus, deepseek-v4-flash, and glm-5.2. Toggling reasoning did not resolve the issue.
A comment described an unsupported call: variant: both id/name in cc-switch-cli can be overwritten by empty values. The GUI already protects name, but still lacks protection for id. The commenter stated that non-streaming calls are unaffected and that Kimi's own service did not exhibit this issue. The commenter later confirmed that adding non-empty checks restored normal behavior. This is user verification after a code change; the original post does not establish whether the patch was merged or which release includes it. A closed issue alone does not establish that a fix has been released.
Check the streaming events: if call_id is non-empty in response.output_item.added but becomes empty in response.output_item.done and response.completed, this matches the original report. Another symptom described in the comments is that name is also empty and unsupported call: is reported.
If modifying the source, preserve existing accumulated values in push_tool_call_delta in streaming_codex_chat.rs: update state.call_id only when id in id_delta is non-empty, and update state.name only when name in name_delta is non-empty. A commenter confirmed that this change restored tool calls, but provided no released version containing the fix.
If you cannot modify the source, use the author's reported temporary workaround: switch to a route that bypasses CC Switch Responses translation, such as connecting Codex directly to official OpenAI. The original post states that no configuration bypasses this translation defect and that codex-cli 0.142.2 no longer supports wire_api = "chat".
After the change, verify with a streaming request that includes tool calls: call_id in the final events should match response.output_item.added, and subsequent empty values should not clear the tool name. Check that Codex continues dispatching tools and sending follow-up requests.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- Now that the cause has been found, can it be fixed?
- A commenter provided a code change that adds non-empty checks for id/name and later confirmed that it restored normal behavior. The original post provides no patch merge record or released version containing the fix.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.