Skip to content

fix(transcript): wrap reasoning in <thinking> tags in markdown export#25368

Open
1fanwang wants to merge 1 commit intoanomalyco:devfrom
1fanwang:fix-transcript-thinking-tags
Open

fix(transcript): wrap reasoning in <thinking> tags in markdown export#25368
1fanwang wants to merge 1 commit intoanomalyco:devfrom
1fanwang:fix-transcript-thinking-tags

Conversation

@1fanwang
Copy link
Copy Markdown

@1fanwang 1fanwang commented May 2, 2026

Issue for this PR

Closes #25308

Type of change

  • Bug fix

What does this PR do?

The markdown transcript renders thinking content with a _Thinking:_ open delimiter that has no closing counterpart, so a downstream parser can't tell where reasoning ends and the assistant response begins.

This swaps the wrapper to <thinking>...</thinking> in formatPart's reasoning branch. The shape is well-formed (closing tag present) and matches the native output of reasoning models like DeepSeek, Qwen3, and GLM, so the same parser can handle live model output and exported transcripts.

The live TUI render in cli/cmd/tui/routes/session/index.tsx is intentionally untouched — that's a separate concern (#11439) about UI rendering, not the markdown export artifact.

How did you verify your code works?

From packages/opencode:

bun test test/cli/tui/transcript.test.ts
# 18 pass, 0 fail

The existing formats reasoning when thinking enabled assertion is updated to match the new shape.

Screenshots / recordings

N/A — markdown text format change only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The `_Thinking:_` open delimiter had no closing counterpart, so a
downstream parser couldn't tell where reasoning ends and the assistant
response begins in the exported markdown.

Switch the wrapper to `<thinking>...</thinking>`, which is well-formed
and matches the native output of reasoning models like DeepSeek, Qwen3,
and GLM. Live TUI rendering is intentionally untouched — that's anomalyco#11439.

Closes anomalyco#25308

Signed-off-by: 1fanwang <[email protected]>
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.

[FEATURE]: Markdown export: wrap thinking/reasoning content in <thinking> XML tags

1 participant