Skip to content

fix(sse): suppress </think> by default on Chat Completions (#8245) - #8309

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.49from
Prudhvivuda:fix/8245-suppress-think-close-default
Jul 24, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.49from
Prudhvivuda:fix/8245-suppress-think-close-default

Conversation

@Prudhvivuda

@Prudhvivuda Prudhvivuda commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #8245

Test plan

  • node --import tsx/esm --test tests/unit/think-close-marker-suppress-5245.test.ts tests/unit/think-close-marker-responses-format.test.ts tests/unit/claude-to-openai-think-close-5123.test.ts tests/unit/anthropic-stream-thinking-close-marker.test.ts tests/unit/glm-think-close-marker-leak.test.ts (20/20 pass)
  • Streaming Chat Completions through a Claude-format provider (e.g. kimi-coding) with a plain UA: no </think> in delta.content; reasoning_content still present
  • Same request with x-omniroute-thinking-marker: on: marker emitted for fix(translator): emit </think> close marker for Anthropic thinking blocks #4633 clients
  • /v1/responses path still suppresses even with header on

…apw#8245)

Claude→OpenAI translation was emitting a literal </think> into
delta.content for ordinary Chat Completions clients. Reasoning already
ships as reasoning_content, so default to suppress and keep
x-omniroute-thinking-marker: on as the diegosouzapw#4633 opt-in.
@Prudhvivuda

Copy link
Copy Markdown
Contributor Author

CI note — Quality Gates failures look pre-existing on release/v3.8.49

The 8 red Quality Gates jobs on this PR do not appear caused by the #8245 change. This PR only touches open-sse/utils/thinkCloseMarker.ts + related unit tests.

This PR’s coverage (passed in CI)

CI logs show the #8245 / think-close tests green, including:

  • claudeToOpenAIResponse suppresses </think> on finish when suppressThinkClose=true (#8245)
  • thinking block followed by text: </think> suppressed when suppressThinkClose=true (#8245)
  • openai chat format suppresses the marker by default (#8245)
  • GLM suppress / opt-in emit cases

What’s actually failing (unrelated / tip pollution)

Job Failure Related to #8245?
Unit Tests (shards) ReferenceError: PROVIDER_BREAKER_FAILURE_STATUSES is not defined at src/sse/handlers/chat.ts:1340 (+ unrelated catalog/i18n drift) No
Vitest auto/glm assertion in provider-family-combos.test.ts No
Fast Quality Gates Stale allowlist entry open-sse/executors/muse-spark-web.ts in check:error-helper No
Docs Gates Env sync: chaos/notion/VNC vars missing from .env.example No
ESLint warnings lint:json --max-warnings 0 base noise No

Same Quality Gates pattern is also red on recently merged tip PRs (e.g. #8296, #8287), so this looks like current release/v3.8.49 tip CI rather than a regression from this PR.

Happy to rebase once tip is green, or adjust if reviewers want anything else on the #8245 path itself.

@diegosouzapw
diegosouzapw merged commit 14f4c67 into diegosouzapw:release/v3.8.49 Jul 24, 2026
5 checks passed
@diegosouzapw

Copy link
Copy Markdown
Owner

Merged into release/v3.8.49 — thanks @Prudhvivuda! Validated via local merge-train (32-core .113) + a per-file discriminator confirming zero regressions vs the pure release tip; CI reds on this PR were pre-existing base-red drift (tracked separately). 🙏

HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…apw#8245) (diegosouzapw#8309)

Claude→OpenAI translation was emitting a literal </think> into
delta.content for ordinary Chat Completions clients. Reasoning already
ships as reasoning_content, so default to suppress and keep
x-omniroute-thinking-marker: on as the diegosouzapw#4633 opt-in.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…apw#8245) (diegosouzapw#8309)

Claude→OpenAI translation was emitting a literal </think> into
delta.content for ordinary Chat Completions clients. Reasoning already
ships as reasoning_content, so default to suppress and keep
x-omniroute-thinking-marker: on as the diegosouzapw#4633 opt-in.
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.

fix(api): </think> leaks into OpenAI Chat Completions content on Claude-format providers

2 participants