Repository navigation
Conversation
ei-grad
added a commit
to ei-grad/aichat
that referenced
this pull request
Jul 11, 2026
Strip Qwen-style reasoning only when a lone closing think tag forms a standalone line after a non-empty prefix. Preserve inline, repeated, fenced, and otherwise ambiguous literal close tags so unrelated answer content is not removed without the structural reasoning pattern. Add regression coverage for full tags, close-only output, CRLF and whitespace, plain responses, literal markers, and fenced adversarial examples. This materially reworks the close-only handling proposed in: sigoden#1530 Co-Authored-By: Codex CLI <noreply@openai.com>
ei-grad
added a commit
to ei-grad/aichat
that referenced
this pull request
Jul 11, 2026
Integrate the exact upstream PR head and preserve its original commit and authorship. A separate boundary follow-up narrows the matcher so ambiguous, inline, repeated, and fenced literal tags remain intact. Source: sigoden#1530 Head: c559c1d
ei-grad
added a commit
to ei-grad/aichat
that referenced
this pull request
Jul 11, 2026
Retain the close-only Qwen use case from upstream PR sigoden#1530 while requiring a standalone structural close-tag boundary. Preserve inline, repeated, fenced, and otherwise ambiguous literal markers, with tests for CRLF, whitespace, and full tagged responses. Source: sigoden#1530 Reviewed behavior: ab9e551 Co-Authored-By: Codex CLI <noreply@openai.com>
ei-grad
added a commit
to ei-grad/aichat
that referenced
this pull request
Jul 11, 2026
Integrate the named boundary-hardening branch after the exact sigoden#1530 import. The second parent preserves the reviewed matcher and its ambiguous-literal regression tests as a distinct repair delta. Source: sigoden#1530
Qwen3.6 local models embed the opening think marker in the chat template, so model output only includes reasoning text followed by </think>. strip_think_tag previously required a matching opening tag, leaving thinking content in -e / execute output. Also handle close-only blocks when no opening tag is present, and add regression tests for both tagged and Qwen3.6-style outputs.
syf2211
force-pushed
the
fix/1528-qwen36-thinking-close-tag
branch
from
September 8, 2026 00:26
c559c1d to
fde7163
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
strip_think_tag()so Qwen3.6 local thinking output is removed before execute (-e) and other code-extraction paths.Motivation
Qwen3.6 embeds the opening think marker in the chat template, so model output only contains reasoning text followed by
</think>without a matching opening tag. The existing regex required<think>..., leaving thinking content in-eoutput (fixes #1528).Changes
THINK_CLOSE_ONLY_REto strip from start of text through the first</think>when no opening tag is presentTests
test_strip_think_tag_with_opening_tag— oktest_strip_think_tag_close_only_qwen36— oktest_strip_think_tag_without_thinking— okNotes
Close-only stripping only runs when
</think>is present and<think>is absent anywhere in the text, matching the Qwen3.6 template behavior described in the issue.Fixes #1528