Skip to content

Strip reasoning when only the closing </think> reached the output - #75

Merged
ThinkOffApp merged 1 commit into
mainfrom
fix/stray-think-close
Sep 27, 2026
Merged

ThinkOffApp merged 1 commit into
mainfrom
fix/stray-think-close

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

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 produce reasoning</think> answer (or just </think> answer); strip_scaffold only 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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
carwatch-dev Ready Ready Preview Sep 27, 2026 11:00am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T11:02:57.382690Z 354ffab PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThinkOffApp
ThinkOffApp merged commit 772206e into main Sep 27, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread carwatch/grounding.py
Comment on lines +79 to +81
after = cleaned[closes[-1].end():].strip()
if after:
cleaned = after

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

This branch was successfully deployed

1 active deployment
Preview — 354ffab6 Deployed Sep 27, 2026 by vercel[bot]
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.

1 participant