mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
de1768d3ba
## Summary Fixes streaming issue where Claude models return only 1-4 characters instead of full responses when used through certain API providers/proxies. ## Environment - **OS**: Windows - **Models affected**: Claude models (e.g., claude-haiku-4-5-20251001) - **API Provider**: AAAI API proxy (https://api.aaai.vip/v1) - **Working models**: GLM, Google models work correctly ## Problem When using Claude models in both TUI and exec modes, only 1-4 characters are displayed despite the backend receiving the full response. Debug logs revealed that some API providers send SSE chunks with an empty string finish_reason during active streaming, rather than null or omitting the field entirely. The current code treats any non-null finish_reason as a termination signal, causing the stream to exit prematurely after the first chunk. The problematic chunks contain finish_reason with an empty string instead of null. ## Solution Fix empty finish_reason handling in chat_completions.rs by adding a check to only process non-empty finish_reason values. This ensures empty strings are ignored and streaming continues normally. ## Testing - Tested on Windows with Claude Haiku model via AAAI API proxy - Full responses now received and displayed correctly in both TUI and exec modes - Other models (GLM, Google) continue to work as expected - No regression in existing functionality ## Impact - Improves compatibility with API providers that send empty finish_reason during streaming - Enables Claude models to work correctly in Windows environment - No breaking changes to existing functionality ## Related Issues This fix resolves the issue where Claude models appeared to return incomplete responses. The root cause was identified as a compatibility issue in parsing SSE responses from certain API providers/proxies, rather than a model-specific problem. This change improves overall robustness when working with various API endpoints. --------- Co-authored-by: Eric Traut <etraut@openai.com>
de1768d3ba
ยท
2025-11-16 19:50:36 -08:00
History
codex-core
This crate implements the business logic for Codex. It is designed to be used by the various Codex UIs written in Rust.
Dependencies
Note that codex-core makes some assumptions about certain helper utilities being available in the environment. Currently, this support matrix is:
macOS
Expects /usr/bin/sandbox-exec to be present.
Linux
Expects the binary containing codex-core to run the equivalent of codex sandbox linux (legacy alias: codex debug landlock) when arg0 is codex-linux-sandbox. See the codex-arg0 crate for details.
All Platforms
Expects the binary containing codex-core to simulate the virtual apply_patch CLI when arg1 is --codex-run-as-apply-patch. See the codex-arg0 crate for details.