Repository navigation
fix(chat): preserve literal reasoning markers in answers - #1066
Conversation
Restrict reasoning extraction to leading envelopes and preserve code examples. Add regression coverage for #1047.
dovvnloading
left a comment
There was a problem hiding this comment.
Reviewed both changed files against #1047, including the provider regex definitions, the current main response parser, and regression coverage. No blocking findings in the reviewed diff: matching only contiguous leading envelopes preserves fenced/inline protocol examples, the Harmony final boundary prevents reparsing visible content, and the conservative closing-only heuristic trades ambiguous inline delimiters for preservation of the answer. The new tests cover genuine reasoning, deduplication, retry behavior, and code-node extraction. Main's intervening changes do not edit either changed file; its updated fenced-code parser is compatible with the new XML cases. CI build and POSIX jobs have passed; Windows/full pytest and frontend checks are still running. The nightly-only Playwright job is skipped as expected. I could not clone the repository locally (GitHub DNS unavailable), so I have not independently executed the full suite. This is a review comment rather than self-approval (the authenticated account is the PR author). Ready for squash auto-merge only after all four required CI checks pass; no admin bypass or gate changes.
Summary
Fixes #1047.
Reasoning parsing previously searched the entire reply for think/fallback/Harmony markers, which could strip literal protocol examples from the final answer and misclassify them as reasoning.
Validation
Full repository tests have not been run: cloning GitHub from the execution environment was unavailable. The local harness used a minimal provider shim rather than the full provider runtime. Keeping this PR in draft for CI/full-suite review.
Compatibility note
Unmarked closing-only reasoning is inherently ambiguous. The more conservative fallback deliberately leaves inline or code-like closing-tag sequences visible instead of guessing that they are reasoning. Explicit leading envelopes and Harmony boundaries remain supported.