You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TUI crash: "State composite separation did not converge" on a composite state diagram #61467
A fenced mermaid state diagram that the composite layout cannot place throws State composite separation did not converge from packages/merman/src/state/drawing.ts. The error is a plain Error, so the Markdown code block renderer rethrows it and the TUI exits with the crash screen. One message containing the diagram below is enough; reopening the session crashes again immediately.
Stack trace ends in renderCustomNode / createTopLevelCustomRenderer, through gl and tD into pr.
Plugins
None required.
OpenCode version
2.2.5
Steps to reproduce
Send a message containing this fence:
stateDiagram-v2
direction LR
state "left" as left {
done --> [*]
}
state "right" as right {
[*] --> pending
failed --> [*]
}
Loading
Reopen the session.
The TUI crashes with State composite separation did not converge instead of rendering the diagram. The failure does not depend on terminal width; it reproduces from 80 to 300 columns. The same content drawn as TB lays out correctly.
Thanks for the clear report and the minimal diagram, I was able to reproduce this.
I had a simulated model reply with your stateDiagram-v2 fence (direction LR, composites left and right). On 2.2.5, the TUI switches to the "OpenCode crashed" screen with State composite separation did not converge as soon as the message renders. The recording and screenshots below show it, and the script below reproduces it.
It still happens on the latest dev (826381e), run from source. The error is thrown in the state diagram layout (packages/merman/src/state/drawing.ts). The Mermaid Markdown renderer only handles syntax and canvas-size errors, so this one takes down the whole TUI instead of falling back to the plain code block.
Related: #61468 is an open PR that appears to target this exact error. #48573 and #60341 are other Mermaid rendering crashes with different causes.
recording.mp4
Reproduction script (drive.ts)
import{Effect,Stream}from"effect"import{Llm,OpenCodeDriver}from"opencode-drive"constdiagram=["Here is the diagram:","","```mermaid","stateDiagram-v2"," direction LR",' state "left" as left {'," done --> [*]"," }",' state "right" as right {'," [*] --> pending"," failed --> [*]"," }","```","",].join("\n")exportdefaultOpenCodeDriver.use({
...(process.env.OC_DEV ? {opencode: {dev: process.env.OC_DEV}} : {}),tui: {recording: true,viewport: {cols: 120,rows: 40}},},({ ui, llm })=>Effect.gen(function*(){yield*ui.screenshot("home")// Every simulated model request (including the title request on 2.2.5) answers with the diagramyield*llm.serve(()=>Stream.make(Llm.text(diagram)))yield*ui.submit("Draw a state diagram")yield*Effect.sleep("6 seconds")yield*ui.screenshot("after")constframe=yield*ui.capture()yield*Effect.log(JSON.stringify(frame).slice(0,4000))}),)
Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.
Activity
opencodejr commentedon Nov 3, 2026
Thanks for the clear report and the minimal diagram, I was able to reproduce this.
I had a simulated model reply with your
stateDiagram-v2fence (direction LR, compositesleftandright). On 2.2.5, the TUI switches to the "OpenCode crashed" screen withState composite separation did not convergeas soon as the message renders. The recording and screenshots below show it, and the script below reproduces it.It still happens on the latest
dev(826381e), run from source. The error is thrown in the state diagram layout (packages/merman/src/state/drawing.ts). The Mermaid Markdown renderer only handles syntax and canvas-size errors, so this one takes down the whole TUI instead of falling back to the plain code block.Related: #61468 is an open PR that appears to target this exact error. #48573 and #60341 are other Mermaid rendering crashes with different causes.
recording.mp4
Reproduction script (drive.ts)
Run it with opencode-drive:
opencode-drive run ./drive.ts. It drivesopencodefrom yourPATH; setOC_DEVto the path of an OpenCode checkout to run that from source instead.