Strip reasoning when only the closing </think> reached the output - #75
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 354ffab616
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| after = cleaned[closes[-1].end():].strip() | ||
| if after: | ||
| cleaned = after |
There was a problem hiding this comment.
Preserve literal closing tags in ordinary answers
When an answer legitimately discusses or quotes one of these tokens, this unconditionally discards everything through the last closing tag. For example, Use \` to close the reasoning block.becomes only `` to close the reasoning block.`` Because strip_scaffold processes every model response in both the agent and webchat paths, technical questions or code examples containing these tags are silently corrupted; only treat a closing tag as scaffold when its surrounding position/context indicates an actual leaked reasoning prefix.
Useful? React with 👍 / 👎.
27 Sep on the VTA (Qwen3.6-35B, voice path): the answer posted to the room and handed to piper began with a bare
</think>. Chat templates that start the model inside the think block producereasoning</think> answer(or just</think> answer);strip_scaffoldonly removed PAIRED blocks. Now, after the paired pass, text up to the last closing tag is dropped when an answer remains after it (never empties the reply).Tests: 4 new in tests/test_scaffold_leak.py (2 fail on main); 180/180.
🤖 Generated with Claude Code