Conversation
…derr Mid-session fmt.Fprintf(os.Stderr) writes (event-drop reports, plugin hook warnings, bash-gate hints) paint raw text over the bubbletea alt-screen, garbling/duplicating the footer and visually replacing the agent-name row. PluginManager, BaseOrchestrator (propagated to spawned children in the spawn runner) and the tool package now carry a diagnostic sink; the TUI installs one that renders a warning toast (DiagnosticMsg). stderr remains the fallback for headless/CLI runs. Includes the TUI review fixes the sink feature exposed and depends on: stale-toast expiry-aware clear (clearToastMsg handler), the McpStatusMsg proper 3s clear tick, the global KeyReleaseMsg swallow at the top of updateInternal (esc release no longer cancels prompts), and the orchestrator's dedicated diagMu so reportf stays callable under mu. Ported onto upstream/main's shapes: BaseOrchestrator carries only SetDiagnostics/reportf + diagMu (upstream has no dropped-events machinery), and the child sink installs in the actual spawn runner.
golangci-lint (unused) flags internal/tool/diagnostics.go:35: func diagnosticsSink is unused. reportf already reads diagnosticsFuncs inline under the RLock, so the accessor is dead code. Remove it. Reproduced locally with golangci-lint v2.13.2 (same version as CI's golangci-lint-action@v9); full go test ./... -race -count=1 green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Any mid-session
fmt.Fprintf(os.Stderr)write was painting raw text over bubbletea's alt-screen. Plugin hook warnings like[plugin/onToolCall/...] hook timed outand bash-gate hints garbled and duplicated the footer, and visually replaced the agent-name row with whatever stderr printed last. Confirmed by screenshot + OCR — the burned-in garbage matches the stderr text exactly.The fix
Everything that can fire mid-session now goes through a diagnostic sink instead of stderr:
SetDiagnostics/reportf, and the sink propagates to spawned children in the spawn runnerThe TUI installs one that renders a warning toast via a new
DiagnosticMsg(6s expiry, standard clear tick, truncated to terminal width with the status bar's ellipsis helper). stderr stays the fallback for headless/CLI runs, where there's no alt-screen to paint over.reportfis guarded by its owndiagMuinstead of the orchestrator's main lock, so it stays callable whilemuis held — the naive version deadlocked.TUI fixes this surfaced
clearToastMsgchecksToastExpireTime, so a clear tick scheduled by a previous toast can't kill a newer one early, and stale toasts can't be cleared twice.tea.Tick— the old immediate-clear command ran the moment Bubble Tea processed it, erasing the toast after a single rendered frame even though expiry said 3s.KeyReleaseMsgswallow — nothing consumes key-release events, soupdateInternaldrops them at the top; an esc release can no longer cancel a pending prompt.Ported onto upstream/main's shapes:
BaseOrchestratorcarries onlySetDiagnostics/reportf+diagMu(upstream has no dropped-events machinery), and the child sink installs in the actual spawn runner.Testing
exit 0 — all 18 packages green (15 ok, 3 without test files).