ending with a leaked `</t` close-tag fragment - Codex
Quick fix
Caused by the cc-switch streaming converter not deduplicating and not filtering think tags. Update to a version containing the PR #6319 fix.
Symptom
Section titled “Symptom”The visible Codex output shows the sentence repeated N times, ending with a leaked `</t` close-tag fragment.With a provider that only supports Chat Completions, such as GLM-5.2, when upstream sends `reasoning_content` and `content` in the same SSE delta with overlapping text, `streaming_codex_chat.rs` handles them as independent branches with no deduplication, so the reasoning text repeats in the Codex output. On top of that, once the state machine enters `Text` mode, `split_leading_think_block` only matches the first think block, so later tag fragments such as `</t` leak straight into `output_text.delta`.
Separately, a context-too-small error with the `glm-4.1v-thinking-flashx` model comes from that VLM having too small a context window to carry the large context requests Claude Code sends.
Update `cc-switch` to a version containing the PR #6319 fix. That update added deduplication to `handle_chat_chunk` and introduced the `strip_all_think_tags` and `strip_trailing_close_tag_fragment` helpers in `push_content_delta` to filter leaked tags.
If `glm-4.1v-thinking-flashx` errors, try setting the `maxtokens` request parameter below 16000, or switch to a model with a larger context such as GLM-5.2.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 3 real issues
- Why does GLM-5.2 output repeat?
- Because the provider mirrors `reasoning_content` and `content` in the same SSE delta, and older cc-switch did not deduplicate.
- Does this fix affect other models?
- No. The fix targets only the streaming conversion logic for Chat Completions providers, and all 19 existing tests pass.
- `glm-4.1v-thinking-flashx` reports the context is too small. What now?
- That model is a vision language model (VLM) with a small context window, unsuited to programming directly. Lower the `maxtokens` parameter or switch models.
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.