Quotes in code getting stripped in model output #3569

Open
opened 2026-02-16 17:40:41 -05:00 by yindo · 10 comments
Owner

Originally created by @jdanbrown on GitHub (Dec 15, 2025).

Originally assigned to: @kommander on GitHub.

Description

This one is bizzare: I asked openrouter/anthropic/claude-sonnet-4.5 to generate some vscode keybindings.json stuff for me, and the json in its response had no quotes. I asked it to fix it, and it gave me json with no quotes again. Then I used mitmproxy to snoop on the wire traffic, and the model responses actually include the quotes, but opencode is somehow failing to show them in its code blocks in the model output.

Here's mitmproxy on the left showing the model response with quotes, and opencode on the right showing the model response without quotes:

  • mitmproxy on the left: ...\"key\": \"ctrl+m\"...
  • opencode on the right: key: ctrl+m
Image

OpenCode version

1.0.159

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 15.5

Terminal

VS Code terminal

Originally created by @jdanbrown on GitHub (Dec 15, 2025). Originally assigned to: @kommander on GitHub. ### Description This one is bizzare: I asked openrouter/anthropic/claude-sonnet-4.5 to generate some vscode keybindings.json stuff for me, and the json in its response had no quotes. I asked it to fix it, and it gave me json with no quotes again. Then I used `mitmproxy` to snoop on the wire traffic, and the model responses actually include the quotes, but opencode is somehow failing to show them in its code blocks in the model output. Here's mitmproxy on the left showing the model response _with_ quotes, and opencode on the right showing the model response _without_ quotes: - mitmproxy on the left: `...\"key\": \"ctrl+m\"...` - opencode on the right: `key: ctrl+m` <img width="1888" height="1305" alt="Image" src="https://github.com/user-attachments/assets/1d8b52f4-3d96-4056-9f10-b68391a0e8be" /> ### OpenCode version 1.0.159 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System macOS 15.5 ### Terminal VS Code terminal
yindo added the opentuibug labels 2026-02-16 17:40:41 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 15, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #5584: LLM Output cut off / stops midway in UI but appears fine in transcript - Relates to content not displaying correctly in the UI while appearing fine in logs/transcripts
  • #5561: TextNodeRenderable only accepts strings, TextNodeRenderable instances, or StyledText instances - Related rendering error in opentui that causes crashes when displaying certain content
  • #5206: [object Object] error output when running opencode over SSH - Related output rendering issues with escape sequences and garbled text
  • #5288: Application crashes when LLM outputs Zalgo text - Related to issues with special characters and content causing rendering problems

The core issue appears to be related to how model output content is being rendered/escaped in the TUI display layer. Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 15, 2025): This issue might be a duplicate of existing issues. Please check: - #5584: LLM Output cut off / stops midway in UI but appears fine in transcript - Relates to content not displaying correctly in the UI while appearing fine in logs/transcripts - #5561: TextNodeRenderable only accepts strings, TextNodeRenderable instances, or StyledText instances - Related rendering error in opentui that causes crashes when displaying certain content - #5206: `[object Object]` error output when running opencode over SSH - Related output rendering issues with escape sequences and garbled text - #5288: Application crashes when LLM outputs Zalgo text - Related to issues with special characters and content causing rendering problems The core issue appears to be related to how model output content is being rendered/escaped in the TUI display layer. Feel free to ignore if none of these address your specific case.
Author
Owner

@jdanbrown commented on GitHub (Dec 15, 2025):

Looks like the [ and ] chars are getting stripped too, but interestingly only in some parts of the output but not others:

Image
@jdanbrown commented on GitHub (Dec 15, 2025): Looks like the `[` and `]` chars are getting stripped too, but interestingly only in some parts of the output but not others: <img width="925" height="1369" alt="Image" src="https://github.com/user-attachments/assets/687bcafb-0b4a-4aca-a4aa-662c04b59668" />
Author
Owner

@justfortheloveof commented on GitHub (Dec 15, 2025):

The square brackets not being rendered is due to markdown? Try toggling the code conceal options (defaults to leader h)

@justfortheloveof commented on GitHub (Dec 15, 2025): The square brackets not being rendered is due to markdown? Try toggling the code conceal options (defaults to leader h)
Author
Owner

@ariane-emory commented on GitHub (Dec 15, 2025):

@jdanbrown Try opening the command_list and selecting 'Toggle code concealment`, that'll usually unhide the quotation marks in e.g, JSON output.

@ariane-emory commented on GitHub (Dec 15, 2025): @jdanbrown Try opening the `command_list` and selecting 'Toggle code concealment`, that'll usually unhide the quotation marks in e.g, JSON output.
Author
Owner

@jdanbrown commented on GitHub (Dec 15, 2025):

Oh yep, Toggle code concealment does reveal the missing chars.

Please tell me this is a bug? As a user, I definitely don't want stuff like quotes to be hidden in json provided to me by a model (e.g. it breaks copy/paste, because I asked the model for json, not yaml). It makes sense to me to conceal special characters for markdown formatting, but not for ~anything else, right?

Default:
Image

Toggle code concealment → off:
Image

Default:
Image

Toggle code concealment → off:
Image

@jdanbrown commented on GitHub (Dec 15, 2025): Oh yep, `Toggle code concealment` does reveal the missing chars. Please tell me this is a bug? As a user, I definitely don't want stuff like quotes to be hidden in json provided to me by a model (e.g. it breaks copy/paste, because I asked the model for json, not yaml). It makes sense to me to conceal special characters for markdown formatting, but not for ~anything else, right? Default: <img width="914" height="610" alt="Image" src="https://github.com/user-attachments/assets/cf817a51-13ad-4893-969f-0113e3e538c0" /> Toggle code concealment → off: <img width="917" height="664" alt="Image" src="https://github.com/user-attachments/assets/03dc7b17-b23f-4117-a141-271322ee508e" /> Default: <img width="921" height="695" alt="Image" src="https://github.com/user-attachments/assets/c3b455f4-e34a-4836-9b5c-54b5fefe5c01" /> Toggle code concealment → off: <img width="922" height="693" alt="Image" src="https://github.com/user-attachments/assets/5917fffc-96fe-46ca-a5db-a1456622bf45" />
Author
Owner

@rekram1-node commented on GitHub (Dec 15, 2025):

The quotes one is definitely a bug I think? it's missing a parser for .json or something

@rekram1-node commented on GitHub (Dec 15, 2025): The quotes one is definitely a bug I think? it's missing a parser for .json or something
Author
Owner

@jdanbrown commented on GitHub (Dec 15, 2025):

And I assume the [ ] one is a bug too?

[edit] Oh or is that a confusion with [foo](bar) markdown syntax for hyperlinks? Is [foo] without a trailing (bar) valid markdown syntax on its own and opencode is parsing it incorrectly, or is the model emitting invalid markdown because it should escape those brackets when it isn't trying to show a [foo](bar) link?

@jdanbrown commented on GitHub (Dec 15, 2025): And I assume the `[` `]` one is a bug too? [edit] Oh or is that a confusion with `[foo](bar)` markdown syntax for hyperlinks? Is `[foo]` without a trailing `(bar)` valid markdown syntax on its own and opencode is parsing it incorrectly, or is the model emitting invalid markdown because it should escape those brackets when it isn't trying to show a `[foo](bar)` link?
Author
Owner

@kommander commented on GitHub (Dec 16, 2025):

The [ ] is a bug in the markdown parsing, it thinks its a link apparently. We just use the official tree-sitter markdown parser here. As for the quotes in inline json: the parser works as expected. Currently conceal is boolean, so either all concealed or nothing concealed. It does not distinguish between outer and inner/injected blocks.

@kommander commented on GitHub (Dec 16, 2025): The `[ ]` is a bug in the markdown parsing, it thinks its a link apparently. We just use the official tree-sitter markdown parser here. As for the quotes in inline json: the parser works as expected. Currently conceal is boolean, so either all concealed or nothing concealed. It does not distinguish between outer and inner/injected blocks.
Author
Owner

@maurits150 commented on GitHub (Jan 1, 2026):

Can confirm.

concealed:

Image

unconcealed:

Image

So it's not a model issue.

@maurits150 commented on GitHub (Jan 1, 2026): Can confirm. **concealed:** <img width="1589" height="383" alt="Image" src="https://github.com/user-attachments/assets/07d60a21-9d12-44fe-81d5-e9bff42f8ac5" /> **unconcealed**: <img width="408" height="301" alt="Image" src="https://github.com/user-attachments/assets/f3ebfb32-d8df-4bcc-a7b6-412de7bfb258" /> So it's not a model issue.
Author
Owner

@cgkantidis commented on GitHub (Feb 15, 2026):

how is this still an issue?
It's been 3 months.

@cgkantidis commented on GitHub (Feb 15, 2026): how is this still an issue? It's been 3 months.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3569