Skip to content

fix(copilot): stop Requesty/GLM reasoning leaking into content + artifacts - #1

Merged
zebster-cmd merged 3 commits into
requesty-provider-specfrom
fix/requesty-reasoning-leak
Jul 15, 2026
Merged

fix(copilot): stop Requesty/GLM reasoning leaking into content + artifacts#1
zebster-cmd merged 3 commits into
requesty-provider-specfrom
fix/requesty-reasoning-leak

Conversation

@zebster-cmd

Copy link
Copy Markdown
Owner

Why

Models via the Requesty router (notably GLM 5.2) emit chain-of-thought inline as <think>…</think> inside the content stream, not a separate reasoning field. Nothing separated it, so the thinking text was baked into generated HTML artifacts (visible in the preview). A second latent defect folded even natively-separated reasoning into the artifact text.

What changed

  • ThinkTagSplitter (providers/reasoning.ts) — stateful, chunk-boundary-tolerant splitter + stripThinkTags.
  • native-adapter.tsstreamText/streamObject route inline <think> onto the reasoning channel; text() excludes reasoning (emitReasoning:false).
  • native-execution-engine.tsextractTextResponse keeps only text parts and strips inline <think> from them (this is the path code_artifact uses).

Net: code_artifact HTML is reasoning-free whether the model separates reasoning natively or inline. Reasoning still surfaces on its own channel for display.

Scope / decisions

  • Splitter applied universally but conservatively (literal <think> only) — no-op for providers that separate natively.
  • Optional model_registry.rs reasoning flag: deferred (the splitter is the provider-agnostic safety net).
  • No changes to the external Rust affine_doc_loader / llm_adapter crates.

Verification

  • Local ava can't bootstrap under Node 24 (CI runs Node 22). Verified behavior via standalone tsx: 58 splitter + 13 integration assertions green (streamText/streamObject/text/extractTextResponse/code_artifact), clean tsc --noEmit.
  • Confirmed on the live deployment: GLM 5.2 HTML artifact preview shows no thinking blocks.

OpenSpec change: openspec/changes/fix-requesty-reasoning-leak.

🤖 Generated with Claude Code

zebster-cmd and others added 3 commits July 14, 2026 18:46
Initialize OpenSpec (spec-driven) and gitignore .claude/ (local Claude
Code state). Add the change 'fix-requesty-reasoning-leak' (proposal,
design, specs, tasks) for capability copilot-reasoning-separation:
isolate model reasoning ("thinking") from content and artifact text.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…acts

Add ThinkTagSplitter (stateful, chunk-boundary-tolerant) + stripThinkTags.
Wire it into the native adapter: streamText/streamObject route inline
<think>…</think> onto the reasoning channel; text() excludes reasoning
(emitReasoning:false). extractTextResponse now keeps only text parts and
strips inline <think> from them, so code_artifact HTML is reasoning-free
whether the model separates reasoning natively or emits it inline
(e.g. GLM via Requesty).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Splitter: basic/multiple blocks, split-at-every-offset invariance,
unterminated/partial tags, think-free passthrough. Integration:
streamText/streamObject route inline <think> to the reasoning channel
with clean content, text() excludes reasoning, extractTextResponse drops
reasoning + strips inline tags, and code_artifact HTML is reasoning-free.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@zebster-cmd
zebster-cmd merged commit a42de50 into requesty-provider-spec Jul 15, 2026
53 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant