Skip to content

fix: stop libghostty stream logs from corrupting the boo ui viewport#65

Merged
kylecarbs merged 1 commit into
coder:mainfrom
raphaelk-medsimples:fix/ui-stream-log-leak
Jun 15, 2026
Merged

fix: stop libghostty stream logs from corrupting the boo ui viewport#65
kylecarbs merged 1 commit into
coder:mainfrom
raphaelk-medsimples:fix/ui-stream-log-leak

Conversation

@raphaelk-medsimples

Copy link
Copy Markdown
Contributor

What

boo ui renders its live viewport through an in-process libghostty stream parser, and the UI runs in the user's terminal with stderr inherited. libghostty logs unimplemented sequences at info level under the stream scope (e.g. info(stream): OSC 1 (change icon) received and ignored), so those lines paint directly over the rendered pane and corrupt it until a manual C-a l redraw.

The session daemon doesn't have this problem because startDaemon already redirects its stderr to BOO_LOG//dev/null. The in-process UI path has no equivalent guard.

This is very visible with Powerlevel10k, which emits an OSC 1 on every prompt and on preexec — so cat ~/.zshrc (or any command) floods the viewport with received and ignored lines.

Fixes #64.

How

boo installs no std_options, so logging uses Zig defaults. This adds a std_options.logFn that drops info-and-below from the stream scope, leaving every other scope (.ui, .daemon, .window, …) untouched:

pub const std_options: std.Options = .{ .logFn = filteredLog };

fn filteredLog(comptime level, comptime scope, comptime format, args) void {
    if (scope == .stream and @intFromEnum(level) >= @intFromEnum(std.log.Level.info)) return;
    std.log.defaultLog(level, scope, format, args);
}

A more targeted alternative would be to redirect the UI process's stderr the way the daemon does, but that would also hide genuinely useful warn/err output; filtering only info(stream) keeps everything else visible.

Verification

Built v0.5.18 from source (Zig 0.15.2) and drove a session emitting one OSC 1, capturing BOO_LOG:

build info(stream) lines
ReleaseSafe, before 1
ReleaseSafe, after (this PR) 0
  • zig fmt --check build.zig build.zig.zon src test — clean
  • zig build test — passes
  • zig build -Doptimize=ReleaseSafe — compiles

Confirmed the cause is independent of optimize mode (both Debug and ReleaseSafe emit info(stream) without the filter), so this is the right lever rather than a build-flag change.

Notes

Opening as a draft for maintainer direction on the preferred approach (logFn filter vs. UI stderr redirect vs. log_scope_levels). Also — thanks for boo; the libghostty-backed state model and the automation surface are a pleasure to work with.

libghostty's VT stream parser logs unimplemented sequences at info level
under the `stream` scope (e.g. "OSC 1 (change icon) received and ignored").
The session daemon redirects its stderr to BOO_LOG or /dev/null in
startDaemon, so those lines never reach a terminal there. But `boo ui`
renders in-process with stderr still attached to the user's terminal, so
the same logs paint directly over the rendered viewport and corrupt it
until a manual redraw (C-a l).

Powerlevel10k makes this very visible: it emits an OSC 1 on every prompt
and on preexec, so any command (e.g. `cat ~/.zshrc`) floods the pane with
"received and ignored" lines.

Install a std_options.logFn that drops info-and-below from the `stream`
scope while leaving every other scope untouched. Verified at ReleaseSafe
(the release build config) that this takes the emitted info(stream) count
from 1 to 0; the change is zig fmt clean and `zig build test` passes.

@kylecarbs kylecarbs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Will publish a patch shortly.

@kylecarbs kylecarbs marked this pull request as ready for review June 15, 2026 15:47
@kylecarbs kylecarbs merged commit 9decda8 into coder:main Jun 15, 2026
5 checks passed
@kylecarbs kylecarbs mentioned this pull request Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

boo ui: libghostty info(stream) logs (e.g. OSC 1 from Powerlevel10k) leak onto the rendered pane and corrupt it

2 participants