Repository navigation
Description
Description
Environment
- OpenCode v2.1.4 (npm
latest), macOS, Node v24.22.0 - Docs page: https://opencode.ai/v2/docs/build/plugins/cli → "Dialogs and toasts"
The documented order does nothing
The custom JSX dialog example shows:
context.ui.dialog.set({ size: "large", centered: true })
context.ui.dialog.show(() => (<box>…</box>), onClose)i.e. set() before show(). On 2.1.4 that ordering is silently ignored: the dialog stays
on the default 60-column preset regardless of size, with no warning.
How it was measured: a throwaway probe plugin auto-opened custom dialogs from setup()
(no input driving) while the TUI ran in a script pty at stty cols 140 rows 40; the raw
transcripts were replayed through a terminal emulator (pyte) and the rendered frames measured
exactly:
set() timing |
rendered dialog (140-col pty) |
|---|---|
before show() — the documented order |
ignored — always the default 60 cols |
synchronously right after show() returns |
✅ medium → 60 @ left 40, large → 88 @ left 26, xlarge → 116 @ left 12 (all exactly centered) |
80 ms after show() |
ignored — 60 cols |
| inside the render thunk | ✅ applied (116 @ left 12) |
no set() at all |
60 cols @ left 40 — centered by default |
So set() only takes effect while a dialog is already active/mounting: immediately after
show() returns, or inside the render thunk. Following the docs order cost us a full
debugging cycle before resorting to probing the binary's behavior.
Three adjacent facts the docs don't state
- Size presets are fixed column widths — medium 60 / large 88 / xlarge 116 — not
fractions of the terminal. Authors must pick the largest preset that fits
(ctx.renderer.width) or small terminals overflow (e.g. xlarge on an 80-col terminal). show()dialogs are horizontally centered by default, even withoutset({ centered }).- The host gives the dialog box only a width, never a height (binary inspection; the
host's own dialogs bound their scrollboxes explicitly, e.g.maxHeight: 20). Custom content
that needs scrolling must carry its own terminal-derived height bound — worth one sentence
next to theshow()example.
Suggested fix: flip the example to show(...) then set(...) — or make set() before
show() queue its options for the next dialog — and document the preset widths, the default
centering, and the missing height bound.
Plugins
No response
OpenCode version
2.1.4
Steps to reproduce
No response
Screenshot
No response
Operating System
macOS 27.0.1
Terminal
iTerm2
Activity
opencode-agent commentedon Oct 24, 2026
Thanks for the detailed report. I was able to reproduce this on 2.1.4, and it still happens on the latest
dev(13a615b90).I used a local CLI plugin that opens two dialogs from
setup()in a 140-column terminal:dialog.set({ size: "xlarge", centered: true })thendialog.show(...): the dialog stays at the default medium width (60 columns) and isn't vertically centered.show(...)thenset(...): the dialog is 116 columns (xlarge) and centered.The cause is that
show()resets the dialog's size to medium and turns centering off. Anything set beforeshow()is overwritten, which doesn't match the example in the plugin docs.Until this is addressed, calling
set()right aftershow()works as a workaround. The recording and screenshots below show both orders, and the script below reproduces it.Related: #56145 (closed), about where
setSize/setCenteredare called in the plugin dialog API.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.rebelliard commentedon Oct 25, 2026
Opened #58930. It fixes the docs example to call
set()aftershow(), sinceshow()resets size and centering. It also clarifies theDialog.setJSDoc. No runtime change.