24 posts
Engineering blog
How tuios and the tools around it were built, measured and fixed. Every number comes from a run you can repeat from the repository.
11 min read
A full scrollback cost 232MB per pane, twice: once in the daemon and once in each client
A 112-byte cell made every scrollback line cost the full pane width. Packing cells, then storing lines as text, took a full ring from 232MB to 2.2MB.
15 min read
Agents drive tuios through one-shot commands, so the event bus could not reach them
A hub only reaches whoever is subscribed right now, and agents almost never are. How tuios got a mailbox, ask-agent and an inbox for the person.
14 min read
The pane ran on another machine, and ctrl+D waited for the next keypress
tuios daemons now talk to each other over one ssh link per machine. It shipped in stages, and each stage had a bug that taught me something.
17 min read
A PTY has one size, and two clients had two opinions about it
Two clients on one session each laid the panes out around their own chrome and fought over the shared shells. The fix, and the harness that found the rest.
8 min read
A session switch forgot my column widths
Switching sessions and back reset a widened column in the scrolling layout and split stacked panes apart. The daemon's state carried where the strip was scrolled to and nothing about its columns, and the same gap had two clients on one session drawing different widths.
11 min read
Most of a scroll was spent on blank cells
A ten-character line scrolling off a 207-column screen walked the whole row twice, once to find the text and once to erase it. One int per row cut the short-line scroll from 1,120 ns to 240 ns. Here is how it was measured on a machine that would not sit still, and how I checked it was still right.
10 min read
Nothing failed, so nothing was fixed
A whole-codebase audit of tuios found a flag nothing set, an interface with one implementation behind 140 call sites, and copies of code that had quietly drifted apart. Dead code survives because nothing fails when it is wrong.
13 min read
Session state was saved every 30 seconds and never read back
tuios wrote every session to disk from April and no daemon ever loaded it. Wiring up the read side, and then making reattached panes redraw correctly.
13 min read
The one moment an agent needed you was the one moment tuios could not see
A coding agent blocked on a permission prompt paints it once and goes silent. How tuios learned to tell that silence apart from a finished turn.
10 min read
The underline depended on which code drew it
A focused pane dropped SGR underline, and a dimmed, scrolled back or copy mode pane dropped almost every attribute once it lost focus in window mode. tuios had five ways to draw a pane and only one kept everything. The difference only showed when a pane changed paths, usually as focus moved.
3 min read
The screenshot cell was half measured and half guessed
Pane screenshots came out stretched. Two rounds of font maths got the cell shape wrong. The fix asks the host terminal for its real cell size in pixels.
3 min read
The renderer was drawing a backlog it had caused
A flooded tuios pane kept painting 1.2 s after its source exited. The client's own renderer caused the backlog, and pacing by queued bytes halved the tail.
7 min read
The fuzzer that found nothing, and the two questions that found everything
590,000 fuzz runs against the tuios terminal emulator found nothing. They checked the screen was well formed, not right. Two self-checks found real bugs.
5 min read
A fifth of every frame went to changing nothing
A profile put 19.8% of the tuios client in lipgloss.Wrap, rewrapping pane text already the right width. Skipping it was easy. Proving the skip safe was the work.
6 min read
My differential tests passed and the screen was pink
A style cache keyed by recycled libghostty-vt style IDs painted ls output hot pink, and a differential test suite that compared once, at the end, missed it.
7 min read
The daemon said yes to an option that did not exist
Driving the tuios control socket like a machine found a command that lost its spaces, a dropped parameter, and 88 settings of which six applied live.
7 min read
The bug I closed three times: a speckled sprite in a WebGL terminal
A speckled sprite in the tuios browser terminal. Three wrong closures, a test suite blind by construction, and a browser that salted its own pixel readback.
8 min read
I dragged one divider and five windows moved
Dragging one divider in the tuios tiling layout moved five windows. It was three defects: neighbours found by geometry, a restarting ease, a truncated ratio.
9 min read
The benchmark said 27x faster. It felt worse.
Fixing pane resize lag in TUIOS with Go benchmarks and pprof. Two of four theories were wrong, and the benchmark measured the wrong thing for three rounds.
8 min read
My fuzzer was optimising for my own bug
A flaky TUI fuzz suite came down to a PTY line discipline I never configured, and a shrinker that minimised straight toward the race.
3 min read
My multiplexer lied about what it could do
kitty icat drew nothing when tuios ran in a browser client. The graphics passthrough said yes to file transmission without asking the host.
5 min read
I ported a correct emoji width table and it fixed nothing
Emoji widths were wrong in the tuios browser client. I ported ghostty's per-codepoint width table and nothing changed, because width belongs to clusters.
5 min read
I shipped three fixes for a bug I had not found
A tuios pane went blank on focus changes. I shipped three real fixes for other bugs before I reproduced it. The cause was a width read from the first line.
6 min read
Three terminal bugs in one month turned out to be one bug
Terminals answer queries like OSC 11 and CPR. Three bugs in three codebases were one bug: the reply was dropped, sent to the wrong place, or echoed.