Skip to content

fix(cli): route slog.Warn/Error to TUI Notice events during chat session#4518

Open
lizhengwu wants to merge 1 commit into
esengine:main-v2from
lizhengwu:fix/tui-slog-notice
Open

fix(cli): route slog.Warn/Error to TUI Notice events during chat session#4518
lizhengwu wants to merge 1 commit into
esengine:main-v2from
lizhengwu:fix/tui-slog-notice

Conversation

@lizhengwu

Copy link
Copy Markdown
Contributor

In reasonix chat TUI mode, when MCP plugin timeouts or background tasks call slog.Warn/Error, the logs write directly to stderr, corrupting Bubble Tea's alt-screen terminal display.

This PR routes Warn-and-above logs through the TUI event channel during the TUI lifecycle, so they render inline in the scrollback instead of writing to stderr.

Before / After

Before: stderr logs interleave at the top of the TUI, breaking the layout.

After: logs appear as warning notices inline in the TUI scrollback:

! msg="plugin: start auxiliary resource client failed" server=everything err="context deadline exceeded"

Scope

  • Only affects reasonix chat TUI mode
  • desktop, serve, run, bot, acp are unaffected
  • MCP timeout semantics and plugin behavior are unchanged

Prevent raw-mode stderr writes from corrupting the TUI display by
replacing the default slog.Logger with one that writes Warn and above
as event.Notice into the TUI event channel. Info/Debug are discarded.
The original logger is restored before plugin cleanup.
@github-actions github-actions Bot added tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant