fix(tui): route warning logs to status bar instead of stderr#2
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>
PR Review: fix(tui): route warning logs to status bar instead of stderrOverviewFixes TUI layout corruption (NVIDIA#2120) caused by Key Design Decisions
Notable Code
let forward_warnings = start_port_forwards(...).await;
if !forward_warnings.is_empty() {
let _ = tx.send(Event::ForwardWarnings(forward_warnings));
}
// CreateResult always gets clean name
let _ = tx.send(Event::CreateResult(Ok(sandbox_name)));
Some(Event::ForwardWarnings(warnings)) => {
app.status_text = format!("port forward issues: {}", warnings.join("; "));
}Potential Concerns
VerdictShip-ready. All original bugs addressed, build clean, manually verified against issue NVIDIA#2120 repro scenario. |
|
fyi, I have vouch request open and I took slightly different route here -> https://github.com/NVIDIA/OpenShell/compare/main...Rushit:OpenShell:fix/2120-tui-log-to-file?expand=1. Apparently, The |
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 NVIDIA#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 NVIDIA#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 NVIDIA#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🤖 Generated with Claude Code