fix(tui): route warning logs to status bar instead of stderr#2210
Merged
Conversation
tracing::warn/info/debug calls in the TUI crate write to stderr via the global tracing subscriber. In ratatui's alternate-screen/raw-mode, stderr writes corrupt the terminal layout. Error-state sandboxes amplify this as background gRPC polls fail every 2s tick. Replace all 25 tracing calls with app.status_text assignments for direct-access sites, and Vec<String> accumulation for the spawned start_port_forwards task. Add ForwardWarnings event variant to decouple forward warning delivery from the sandbox name in CreateResult, preventing downstream gRPC lookup failures. Closes NVIDIA#2120 Signed-off-by: Ian Miller <milleryan2003@gmail.com>
New event type for non-fatal port-forward warnings during sandbox creation. Keeps warning delivery separate from the sandbox name in CreateResult to avoid corrupting downstream gRPC lookups. Signed-off-by: Ian Miller <milleryan2003@gmail.com>
Compile-time guard against reintroducing stderr-writing tracing calls in the TUI crate. 14 other crates retain the dependency. Signed-off-by: Ian Miller <milleryan2003@gmail.com>
Contributor
Author
|
I have read the DCO document and I hereby sign the DCO. |
Contributor
Author
|
recheck |
Collaborator
|
/ok to test 97862a8 |
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.
Summary
tracing::warn!/info!/debug!()calls inopenshell-tuiwithapp.status_textassignments to prevent stderr writes from corrupting ratatui's alternate-screen layoutForwardWarningsevent variant to decouple port-forward warning delivery from sandbox name inCreateResult, preventing downstream gRPC lookup failures inhandle_exec_commandtracingdependency from the TUI crate as a compile-time guard against reintroduction (14 other crates retain it)Related Issue
Closes #2120
Changes
crates/openshell-tui/src/lib.rstracing::*!()calls →app.status_textassignmentsstart_port_forwards()→Vec<String>accumulation returned to callertracing::debug!()calls inrefresh_draft_chunks()silently dropped (not user-actionable)start_port_forwards()return type changed from()toVec<String>Event::ForwardWarnings, not embedded in sandbox namecrates/openshell-tui/src/event.rsForwardWarnings(Vec<String>)variant toEventenumcrates/openshell-tui/Cargo.tomltracing = { workspace = true }Before / After
Before (stderr spam corrupting TUI layout)
After — error-state sandbox with gateway down (errors in title bar, clean layout)
After — reproduced issue #2120 scenario (error-phase sandbox, gateway stopped mid-session)
Manual Verification
Prerequisites
brew services start openshellor equivalent)openshell sandbox create --name test-errorwill create one that enters Error phase)Test 1: Error-state sandbox (issue #2120 repro)
Test 2: Gateway down mid-session
Test 3: Compile-time guard
Testing
cargo build -p openshell-tui— compiles cleancargo clippy -p openshell-tui— no warningsgrep -rn 'tracing::' crates/openshell-tui/src/— zero resultsmise run pre-commit— passesopenshell term→ error sandbox → clean layout, no stderr corruption