opencode-copilot-chat icon indicating copy to clipboard operation
opencode-copilot-chat copied to clipboard

respect setting chat.agent.thinkingStyle

Open hu3bi opened this issue 5 months ago • 8 comments

Right now with

"chat.agent.thinkingStyle": "fixedScrolling"

It never collapses the thinking sections, no matter the preference.

It is always expended and includes all the reasoning/thinking in the output.

Here is an example, the answer appears later.

Image

Workaround: Use an instruction file that tells the model to not print all the internal thinking to the chat.

hu3bi avatar Jun 12 '26 09:06 hu3bi

What models was that?

There's a config for that: opencodego.stripThinkTags

For now only remove this ... from Minimax M3 as was the only model that i used that didn't sent the think content on the appropriated response field; You can set opencodego.stripThinkTags to "always" and will do that to all models. But if you say what model is also doing this we can just add that o the "auto" (default) config.

Wallacy avatar Jun 13 '26 00:06 Wallacy

@Wallacy

There's a config for that: opencodego.stripThinkTags

For now only remove this ... from Minimax M3 as was the only model that i used that didn't sent the think content on the appropriated response field; You can set opencodego.stripThinkTags to "always" and will do that to all models. But if you say what model is also doing this we can just add that o the "auto" (default) config.

That is not the issue.

"chat.agent.thinkingStyle": "fixedScrolling"

That setting controls how thinking is displayed. It has 3 options, collapsed, collapsedPreview and fixedScrolling.

It makes the most sense if I just explain collapsed.

With collapsed, all the thinking is hidden, but displayed/expanded once the user clicks on the gray lettered text.

So the goal is not to strip them, but make them respect the vscode setting. The setting only controls how thinking passages are rendered to the user.

With collapsedPreview, all thinking passages should appear like normal, but should collapse once the agent moves onto the next thinking passage. The collapsed thinking passage is hidden behind a gray link/text-section that the user can click.

hu3bi avatar Jun 13 '26 11:06 hu3bi

Sadly I don't have copilot any more else I would upload a video.

hu3bi avatar Jun 13 '26 11:06 hu3bi

May be related to https://github.com/microsoft/vscode/issues/318211 where thinking tokens do not surface for BYOK models.

sublimode avatar Jun 14 '26 15:06 sublimode

@sublimode It actually might be. I do not understand https://github.com/microsoft/vscode/issues/318211 well enough.

hu3bi avatar Jun 14 '26 16:06 hu3bi

Thanks for the detailed writeup @hu3bi, and good catch by @sublimode linking microsoft/vscode#318211 that is indeed the root cause here. Let me add some findings from investigating this on our side.

To clarify for anyone landing here: this is not the same problem opencodego.stripThinkTags solves. That setting removes <think> tags from the response text (currently MiniMax M3 only, or "always" for all models). What's being asked here is for reasoning to be surfaced through the proper thinking channel so that VS Code's chat.agent.thinkingStyle setting (collapsed / collapsedPreview / fixedScrolling) actually applies. Those are two different things — strip ≠ surface.

What's happening on our side

When an OpenCode model returns reasoning_content (OpenAI-compatible) or think-tagged content, the extension currently:

  1. Accumulates the reasoning into an internal string (reasoningContent in src/streaming.ts).
  2. Uses it for tool-call follow-up replication (so multi-step tool workflows can replay thinking on subsequent requests).
  3. Falls back to emitting it as a plain LanguageModelTextPart only when the response is otherwise empty (no text, no tool calls).

In other words, reasoning never reaches the VS Code Chat UI as a thinking part — it's either silently stored or rendered as visible plain text. That's why chat.agent.thinkingStyle has no effect: there's nothing for it to style.

Why we can't fix this in the extension right now

I verified against the running VS Code 1.124.2 stable bundle:

Check Result
LanguageModelThinkingPart in stable vscode.d.ts ❌ Not present
LanguageModelTextPart thought field ❌ Not present (only value: string)
Proposed chatProvider.d.ts shipped in VS Code bundle ❌ Not shipped
LanguageModelThinkingPart declared in our local src/vscode.proposed.chatProvider.d.ts ⚠️ Referenced (line 119) but not defined — no class declaration exists anywhere

The stable LanguageModelResponsePart union only covers TextPart | ToolResultPart | ToolCallPart | DataPart. There is no thinking-capable part in the stable API surface for BYOK providers to emit. Any attempt to instantiate a thinking part would fail at compile time (undefined class) or runtime (not a constructor).

This is exactly the gap microsoft/vscode#318211 is tracking — assigned to @lramos15, @vijayupadya, @vritant24, labeled bug + model-byok. Until that lands in stable VS Code, there's no extension-side code we can write that will make chat.agent.thinkingStyle work for OpenCode BYOK models.

Workarounds in the meantime

  • To hide reasoning entirely: set "opencodego.stripThinkTags": "always" — this removes think content from the visible output (for all models). Not a real fix for thinkingStyle, but useful if expanded reasoning is just noise.
  • To keep reasoning but trim verbosity: use a custom instruction file that asks the model to print less internal thinking, as @hu3bi mentioned above.

What happens next

I've documented this as a tracked blocker in docs/issues/24-20260615-thinking-style-setting-not-respected.md (full investigation + verification commands). Once VS Code ships a concrete thinking part API for BYOK providers, the fix on our side is straightforward:

  1. In src/streaming.ts, emit reasoning through progress.report(new vscode.LanguageModelThinkingPart(...)) instead of only accumulating it.
  2. Adjust flushReasoningFallback to route through the thinking channel rather than LanguageModelTextPart.
  3. Keep the existing onReasoningContent callback intact (still needed for tool-call replication).

I'll keep this issue open and post an update here as soon as the upstream API is available. Thanks again for the report and the cross-link, it saved us a lot of guessing. 👍

ltmoerdani avatar Jun 15 '26 16:06 ltmoerdani

So I owe an apology here.

When @hu3bi opened this, I spent a full afternoon verifying against the VS Code 1.124.2 stable bundle and concluded it was blocked on microsoft/vscode#318211. Wrote it up in detail, even pointed at the exact lines in vscode.d.ts where the API was missing. Felt thorough. Felt right.

It wasn't. The API we needed, LanguageModelThinkingPart, shipped as a proposal about three weeks before I ran that investigation. I was checking the stable bundle and the local .d.ts, but I never checked whether the runtime constructor was actually there. It was.

The real problem sat in our streaming.ts the whole time. The extractor was doing its job, pulling reasoning_content out of every SSE chunk, but then just stuffing it into a private string and never reporting it to the UI. So there was nothing for chat.agent.thinkingStyle to style. The setting worked fine; we just never gave it anything to work with.

@sublimode, your link to microsoft/vscode#318211 is what sent me back to re-read the API surface. Not because it confirmed the blocker, but because the issue itself references the thinking part proposal. That was the thread I needed to pull.

@hu3bi, your breakdown of the three thinkingStyle modes saved me from shipping a half-fix. I'd been thinking about this as "show reasoning or hide it." Your description of collapsedPreview auto-collapsing between passages made me realize the chunking matters, not just the content.

One thing I didn't expect: @Vizards already solved this in deepseek-v4-for-copilot. I was still half-convinced this needed an upstream fix until I read their stream.ts and saw progress.report(new vscode.LanguageModelThinkingPart(text)) working in a shipping extension. That's when it clicked that we'd been the bottleneck, not VS Code.

What's in v0.3.7 (shipped, in review on the Marketplace):

Reasoning now streams per-chunk through LanguageModelThinkingPart, across all four transports: OpenAI chat-completions, Anthropic messages, OpenAI responses, and Google Gemini. Both the streaming path and the non-stream fallback. Tool-call replication and opencodego.stripThinkTags are untouched, they compose with the new surfacing. And there's a runtime guard, so if someone's somehow running a VS Code older than 1.102, it falls back to the old accumulate-and-flush behavior instead of crashing.

Tested with DeepSeek and Kimi so far. Thinking blocks show up collapsible, same look as native Copilot models. If you're running a different model family, Qwen or MiniMax or GLM, I'd genuinely like to know whether reasoning renders the same way on your end or if there's a transport quirk I missed.

ltmoerdani avatar Jul 09 '26 00:07 ltmoerdani

If you're running a different model family, Qwen or MiniMax or GLM, I'd genuinely like to know whether reasoning renders the same way on your end or if there's a transport quirk I missed.

It is hard to verify. Why?

  • Copilot extension,
  • VSCODE and
  • githubCopilot (subscription) apis

are seeing so many changes that I often do not know what is the new normal or expected behavior.

Sometimes they just change behavior without an update of the extension or vscode by changing the backend apis.

hu3bi avatar Jul 09 '26 06:07 hu3bi