anomalyco / anomalyco/opencode
TUI: streaming Markdown list items render with truncated content while raw is intact
@simonklee is already working on this.
Since Aug 16, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Description
While the assistant is streaming a Markdown response, list-item contents get silently truncated in the TUI. The raw message stored in ~/.local/share/opencode/opencode.db (part table) is complete; only the rendered output is broken. Adjacent paragraphs render fine.
- No
Code highlighting failed, falling back to plain textwarning ever prints. The opencode process's fd 2 was verified redirected toteeand the resulting log stayed 0 bytes for the whole session. - No exception in
opencode.logeither. - Related but distinct: #38475 reports the same silent Markdown breakage class for fenced JSON code blocks. This one is list items with a mix of
**bold**and`inline code`.
Raw markdown (from DB, verbatim):
インストール完了です。
## 修正内容
**`runCommand` を exec チャネル(PTY なし)ベースに書き直しました。**
- 以前は **PTY+shell チャネル**で `herdr pane list` を送り、プロンプトの終端を推測していたため、出力が確定せずハングしていました
- 今回は **exec チャネル**(`SSHChannelRequestEvent.ExecRequest`)でコマンドを実行するので、コマンド完了でチャネルが閉じ、出力が確実に確定します
- `runCommandOnConnection`(接続中の監視用)も同じ exec チャネル方式
これで、接続ボタン → herdr 一覧取得 → シート表示(または通常接続)が確実に動くはずです。
## 確認
1. 接続ボタンを押す → スピナー → herdr セッションのシートが出る、または通常接続される
2. 通常接続が復活したか
動作確認して、結果を教えてください。
Rendered in TUI (see screenshot):
- 以前— everything after以前dropped- 今回は exec チャネル (`— truncated at the opening backtick-`— only the opening backtick, rest dropped1. 接続ボタンを— rest dropped2. 通常— rest dropped
The two paragraphs and the H2 headings render fully. The bold+inline-code header line (**\runCommand` を exec ...) renders fully. The これで、接続ボタン → herdr ...` paragraph after the bullet list also renders fully.
Investigation notes
- Marked's lexer parses the same raw text into complete tokens (each list item's inline
text/strong/codespansequence is intact). - Chunked-feed simulation (5 chars/chunk) into
MarkdownRenderablewithstreaming: true— tried with bothMockTreeSitterClientand the real markdownTreeSitterClient. Final rendered frame contains full content in both cases. Not reproducible outside the production binary this way. - Likely path:
CodeRenderableused for list-item text keeps itstextBufferat theinitialStyledTextsnapshot (built at item-construction time from the inline tokens at that moment). Under real streaming timing where the highlight loop is repeatedly preempted before it cansetStyledText, the buffer never advances.
Plugins
None.
OpenCode version
1.18.18
Steps to reproduce
Not reliably reproducible on demand. Happens sporadically while the assistant streams a Markdown response that contains list items mixing **bold** and `inline code`. The example above was captured mid-session in a long-running build task.
Screenshot and/or share link
Operating System
macOS 26.3.1 (Darwin 25.3.0), Apple Silicon.
Terminal
herdr (terminal multiplexer), running inside iTerm 2.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.