[PR #11566] fix(tui): remove outer backtick wrapper in session transcript tool formatting #13841

Closed
opened 2026-02-16 18:18:40 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11566

State: closed
Merged: Yes


What does this PR do?

Fixes #11513

Session transcripts wrapped entire tool invocations in an outer triple-backtick code block, while also using inner triple-backtick blocks for input/output/error content. This created invalid nested markdown that broke rendering — particularly when tool output itself contained triple backticks (e.g. from PTY tools).

Before:

```
Tool: pty_spawn

**Input:**
```json
{ "command": "echo", "args": ["hello"] }
```
**Output:**
```
<pty_spawned>
...
</pty_spawned>
```
```

After:

**Tool: pty_spawn**

**Input:**
```json
{ "command": "echo", "args": ["hello"] }

Output:

<pty_spawned>
...
</pty_spawned>

Changes:
- Remove the outer triple-backtick wrapper from tool invocations in `formatPart()`
- Use bold markdown (`**Tool: name**`) for the tool header instead
- Each input/output/error section now has its own independent code block
- Add test case for tool output containing triple backticks

### How did you verify your code works?

- All existing transcript tests pass (updated assertions for new format)
- Added new test: `formats tool output containing triple backticks without breaking markdown`
- Full test suite: 836 pass (5 pre-existing failures in unrelated `retry.test.ts` / `llm.test.ts`)
- Typecheck passes

🤖 Generated with Claude Code (issue-hunter-pro)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11566 **State:** closed **Merged:** Yes --- ### What does this PR do? Fixes #11513 Session transcripts wrapped entire tool invocations in an outer triple-backtick code block, while also using inner triple-backtick blocks for input/output/error content. This created invalid nested markdown that broke rendering — particularly when tool output itself contained triple backticks (e.g. from PTY tools). **Before:** ```` ``` Tool: pty_spawn **Input:** ```json { "command": "echo", "args": ["hello"] } ``` **Output:** ``` <pty_spawned> ... </pty_spawned> ``` ``` ```` **After:** ``` **Tool: pty_spawn** **Input:** ```json { "command": "echo", "args": ["hello"] } ``` **Output:** ``` <pty_spawned> ... </pty_spawned> ``` ``` Changes: - Remove the outer triple-backtick wrapper from tool invocations in `formatPart()` - Use bold markdown (`**Tool: name**`) for the tool header instead - Each input/output/error section now has its own independent code block - Add test case for tool output containing triple backticks ### How did you verify your code works? - All existing transcript tests pass (updated assertions for new format) - Added new test: `formats tool output containing triple backticks without breaking markdown` - Full test suite: 836 pass (5 pre-existing failures in unrelated `retry.test.ts` / `llm.test.ts`) - Typecheck passes 🤖 Generated with Claude Code (issue-hunter-pro)
yindo added the pull-request label 2026-02-16 18:18:40 -05:00
yindo closed this issue 2026-02-16 18:18:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13841