Skip to content

Commit f2a4965

Browse files
committed
fix(transcript): wrap reasoning in <thinking> tags in markdown export
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 #11439. Closes #25308 Signed-off-by: 1fanwang <[email protected]>
1 parent 51e310c commit f2a4965

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/opencode/src/cli/cmd/tui/util/transcript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function formatPart(part: Part, options: TranscriptOptions): string {
8888

8989
if (part.type === "reasoning") {
9090
if (options.thinking) {
91-
return `_Thinking:_\n\n${part.text}\n\n`
91+
return `<thinking>\n${part.text}\n</thinking>\n\n`
9292
}
9393
return ""
9494
}

packages/opencode/test/cli/tui/transcript.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe("transcript", () => {
149149
time: { start: 1000 },
150150
}
151151
const result = formatPart(part, options)
152-
expect(result).toBe("_Thinking:_\n\nLet me think...\n\n")
152+
expect(result).toBe("<thinking>\nLet me think...\n</thinking>\n\n")
153153
})
154154

155155
test("skips reasoning when thinking disabled", () => {

0 commit comments

Comments
 (0)