coco 0.96: the bugs were at the seam with the terminal featured image

coco 0.96: the bugs were at the seam with the terminal

December 03, 2026 · 8 min read

Nine bugs, and every one of them lived at the seam between coco and the terminal it runs in.

The day after 0.95.0 shipped, I ran the newest version of the tui-design skill over all of coco‘s lib and bin and asked it for a design review. It came back with nine high-severity findings, and each one was reproduced before anything got fixed. 0.96.0 is those nine fixes, shipped as five PRs merged on December 2, plus a sixth for a bug the fixes themselves had and routine dependency bumps.

If you’re new here, coco is the AI-powered git CLI I maintain. It writes commit messages, changelogs and reviews, and it ships coco ui, a full-screen terminal workstation for history, status, branches, conflicts, PRs and more.

Here’s what stood out reading the findings back. None of them were in coco’s own logic. They were all at the edges: raw mode, signals, pipes, color support, who owns the screen. A terminal app has a contract with the terminal, and coco was breaking its half in small ways.

Ctrl+Z was a z

This was the scariest one. Ink, the React renderer coco uses, puts the terminal in raw mode. Raw mode turns off the terminal’s signal keys, so Ctrl+Z stops being “suspend” and arrives as the letter z with a Ctrl flag attached. Nothing filtered the flag. So Ctrl+Z ran whatever z was bound to in the current view, which meant opening the revert hunk, revert file, discard lines or undo confirm. One y at the confirm and your work was gone.

It wasn’t only Z. Ctrl+Y answered a pending yes/no prompt. Ctrl+P picked “Push (normal)”. Ctrl+Q quit. In the workspace list, Ctrl+P pulled the repo under the cursor.

Now Ctrl plus a letter is ignored unless it’s one of four chords that prompts and overlays actually use (Ctrl+D, Ctrl+U, Ctrl+P, Ctrl+N), and a Ctrl chord never answers a confirm. Ctrl+Z raises SIGTSTP itself, so it suspends the way you’d expect. And fg brings back a fully drawn screen. It used to come back empty, because Ink only writes a frame when the output changed, and from Ink’s point of view nothing had.

One keystroke from losing a resolution

In the conflicts view, u keeps the incoming version of a file and U keeps yours. Both checked out one side over the working file and staged it, with no confirm. If you’d spent ten minutes resolving that file by hand with o, a Shift away from the wrong key threw it all out.

Both now ask first and name the file and the side. s, which stages a file as resolved, now looks for leftover <<<<<<< or >>>>>>> lines and tells you which line before it stages anything. A lone ======= doesn’t count, because Markdown uses it to underline headings.

coco ui conflicts view during a merge with src/widget.ts both modified. After pressing U, the Confirm pane asks "Resolve: keep current branch" and shows the full warning wrapped over several lines: "Replaces src/widget.ts with your branch's version and stages it. Edits you made to it are lost." Below it, press y to confirm or n/Esc to cancel.

The same PR fixed a quieter way to lie. When a background refresh hit a git error, say an index.lock held by another process, that section came back empty and replaced the good data. The Stash view said “No stashes”. The status line said “repository context refreshed”. Now a failed section keeps what it had, and a manual refresh tells you which sections failed and to press r to retry.

Handing the terminal over properly

coco hands the terminal to other programs. Your $EDITOR when you edit a commit message, gpg’s pinentry when a commit gets signed. The old handoff left the alt screen and came back by writing the escape codes itself and nudging React. Same problem as fg. Ink saw no change and drew nothing, so you could come back from your editor to a blank screen.

Ink has a proper way to do this, suspendTerminal. It erases its frame, gives up raw mode, runs your callback and redraws from scratch afterwards. Editors and pinentry go through it now. Mouse reporting turns off for the handoff, so a click in nano no longer types [<0;12;5M into your file.

Signals got the same treatment. An outside kill -INT used to drop you back at your shell with the terminal still in raw mode on the alt screen. Now coco restores the terminal and exits 130 (131 for SIGQUIT). There’s one wrinkle. A Ctrl+C you type inside the editor goes to every process in the foreground group, coco included. So while the editor owns the terminal, coco ignores SIGINT instead of quitting under you.

One more. Ink decides whether to run interactively partly from the CI environment variable. Set CI in a real terminal and coco ui rendered a single frame with no alt screen and no redraws. coco already checks for a TTY before it starts the UI, so it now tells Ink not to second-guess that.

The key hints at the bottom of the screen were drawn in the theme’s muted color and dimmed on top of that. Two contrast cuts stacked. On nord the muted color measured 1.69:1 before the dimming. Now keys use the terminal’s normal foreground and only the labels are muted.

Below 100 columns the footer also wasted most of its space. tab: sidebar [main] inspector took about 29 cells, leaving room for one hint. It’s tab → inspector now, and an 80-column history view fits four of the view’s own hints.

coco ui history view at 80 columns in coco 0.95, with the footer row reading "tab: sidebar [main] inspector" and "↑/↓ move" in dim gray that is hard to read against the dark background.
The same coco ui history view at 80 columns in coco 0.96, with a footer reading "tab → inspector", "↑/↓ move", "enter diff", "/ search" and "g? more", keys in bright text and labels in a muted color.

Themes had a quieter version of the same problem. coco’s hex-color themes fell back to default on anything short of truecolor, without saying so. That includes the most common SSH and tmux setup, a 256-color terminal with no COLORTERM set. Hex themes now keep their colors at 256. They only fall back on a 16-color terminal, the status row says so once at startup, and COCO_TRUECOLOR=1 keeps the theme anyway. TERM=dumb and FORCE_COLOR=0 now turn color off, the same as NO_COLOR.

The CLI behaves in a pipe

The last three findings were all about scripts. coco init saves mode: interactive if you pick it. After that, coco changelog > CHANGELOG.md wrote the coco logo and an inquirer prompt into the file, then sat there waiting for an answer nobody could see. --no-interactive couldn’t override it either, because the flag was OR’d with the config.

Interactive mode now needs stdin and stdout to both be a terminal, with CI unset. -i and --no-interactive win over the config. Fixing that turned up a nastier path. Three commands picked their output mode by falling back to the configured mode, and for coco commit, interactive output means “create the commit”. Once the terminal check landed, a redirected coco commit would have committed without ever showing you the message. That fallback is gone, and there’s a test that redirects stdout and checks nothing gets committed. It fails on 0.95.0.

The other two are smaller. coco log | head crashed with a Node stack trace once the log was longer than the pipe buffer, which is why it hid in small test repos. And a typo like coco comit opened the TUI and exited 0, so a script with that typo reported success. Now it prints a suggestion and exits 2.

A terminal running "coco log --limit 3000 | head -3" with coco 0.95. Two commit rows print, then Node dumps an unhandled 'error' event with "Error: write EPIPE" and a stack trace.
A terminal with coco 0.96. "coco log --limit 3000 | head -3" prints the header and two commits and stops cleanly. "coco comit" prints "Unknown command: comit. Did you mean `coco commit`?" and exits with status 2.

yargs has a strictCommands() option that should have caught the typo. It doesn’t here, because coco has a default command that takes over when no subcommand matches, and yargs hands it the unknown word as a plain argument. So the check lives at the top of that default route instead.

Honesty check: the confirm you can’t finish reading

Taking the conflicts screenshot for this post turned up a bug in one of these fixes. The new U confirm warns “Replaces src/widget.ts with your branch’s version and stages it. Edits you made to it are lost.” The Confirm pane cut the warning to one line, so even at 185 columns you saw “Replaces src/widget.ts with your branch’s ver…” and never got to the part about losing your edits. The confirm still blocked the keystroke, but its most important sentence was off screen. The pane now wraps its text, so the screenshot above shows the whole warning. The fix went in before the release. The first version had tests, but they only checked that the warning string was in the panel, not that it fit on screen.

The review had more than nine findings. The rest are medium and low items: help text that still cites issue numbers, keys that mean different things in different views, CLI error messages. The key changes need some decisions about which binding wins, so they’ll come in a later release rather than slipping into a patch.


coco’s tests passed through all of this, more than 8,800 of them. They test what coco does with input it receives. These bugs were in what the terminal sends, what it expects back, and what happens when the other end of a pipe goes away. That’s the other half of the contract, and it only shows up when you run the real thing in a real terminal.

brew install gfargo/tap/coco
# or
npm install -g git-coco

If you run coco ui inside tmux or over SSH, I’d like to know whether your hex theme now comes through, and what echo $TERM $COLORTERM prints for you. That combination decides whether you get the theme or the 16-color fallback.

Griffen Fargo headshot

Griffen Fargo

Published

Share
Keep Reading

Discussion

Have thoughts? Drop them in.

Comments are powered by Disqus. Sign in once, comment anywhere.

Loading comments…