# Planner Mode UI Output Fixes ## Phase 1: Read and Understand Current Code - [x] Read crates/g3-planner/src/llm.rs - [x] Read crates/g3-planner/src/planner.rs - [x] Read crates/g3-core/src/lib.rs (logs directory function) ## Phase 2: Fix Tool Call Display (Single Line Output) - [x] Modify `PlannerUiWriter::print_tool_header()` in crates/g3-planner/src/llm.rs - [x] Change implementation to use proper single-line formatting - [x] Truncate args at char boundary (use char_indices) - [x] Use `println!` with explicit single line format - [x] Add flush after output - [x] Fix import for std::io::Write ## Phase 3: Fix LLM Text Response Display - [x] Modify `PlannerUiWriter::print_agent_response()` in crates/g3-planner/src/llm.rs - [x] Change from `println!()` to `print!()` to avoid extra newlines - [x] Keep the flush for real-time display - [x] Ensure no carriage returns or status line clearing ## Phase 4: Fix Logs Directory Location - [x] Debug where logs are actually being written - [x] Add debug prints to verify G3_WORKSPACE_PATH is set - [x] Add debug prints in get_logs_dir() to show what path is returned - [x] Build succeeded - compilation verified ## Phase 5: Testing Instructions The code has been successfully modified and compiled. To test: 1. **Test tool call display:** ```bash cd /tmp g3 --planning --codepath ~/RustroverProjects/g3 ``` - Verify tool calls appear on single lines like: `🔧 [1] read_file {"file_path":"/path/to/file"}` - Verify NO extra blank lines between tool calls 2. **Test LLM text response:** - Verify LLM explanatory text appears as contiguous, readable text - Verify no text is overwritten or mangled 3. **Test logs directory:** - Run: `rm -rf ~/RustroverProjects/g3/logs/*.log ~/RustroverProjects/g3/logs/*.txt` - Run: `cd /tmp && g3 --planning --codepath ~/RustroverProjects/g3` - Check debug output shows: `🔍 DEBUG: Set G3_WORKSPACE_PATH to: ...` - Check: `ls ~/RustroverProjects/g3/logs/` - should contain log files - Check: `ls /tmp/logs/` - should NOT exist or be empty 4. **After testing succeeds:** - Remove debug print statements from: - crates/g3-planner/src/planner.rs (2 debug prints) - crates/g3-core/src/lib.rs (2 debug prints in get_logs_dir) - Rebuild: `cargo build --release` ## Summary of Changes ### Files Modified: 1. **crates/g3-planner/src/llm.rs** - Fixed `print_tool_header()`: Uses char_indices for safe truncation, always shows args - Fixed `print_agent_response()`: Changed to `print!()` instead of `println!()` - Added `use std::io::Write;` import 2. **crates/g3-planner/src/planner.rs** - Added debug prints to verify G3_WORKSPACE_PATH is set (temporary) 3. **crates/g3-core/src/lib.rs** - Added debug prints to get_logs_dir() (temporary)