Files
g3/g3-plan/completed_todo_2025-12-10_10-35-18.md
2025-12-10 11:29:10 +11:00

2.8 KiB

Planner Mode UI Output Fixes

Phase 1: Read and Understand Current Code

  • Read crates/g3-planner/src/llm.rs
  • Read crates/g3-planner/src/planner.rs
  • Read crates/g3-core/src/lib.rs (logs directory function)

Phase 2: Fix Tool Call Display (Single Line Output)

  • Modify PlannerUiWriter::print_tool_header() in crates/g3-planner/src/llm.rs
    • Change implementation to use proper single-line formatting
    • Truncate args at char boundary (use char_indices)
    • Use println! with explicit single line format
    • Add flush after output
    • Fix import for std::io::Write

Phase 3: Fix LLM Text Response Display

  • Modify PlannerUiWriter::print_agent_response() in crates/g3-planner/src/llm.rs
    • Change from println!() to print!() to avoid extra newlines
    • Keep the flush for real-time display
    • Ensure no carriage returns or status line clearing

Phase 4: Fix Logs Directory Location

  • Debug where logs are actually being written
    • Add debug prints to verify G3_WORKSPACE_PATH is set
    • Add debug prints in get_logs_dir() to show what path is returned
    • Build succeeded - compilation verified

Phase 5: Testing Instructions

The code has been successfully modified and compiled. To test:

  1. Test tool call display:

    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)