Files
g3/g3-plan/completed_todo_2025-12-09_22-43-24.md
Jochen 75aa2d983e Refine planner mode UI and error handling
Improve planner mode user experience with better error reporting,
cleaner tool output, and consistent log file placement.

- Propagate and display classified LLM errors to users with
  appropriate icons and context
- Display tool calls on single lines with truncated arguments
- Show LLM text responses without overwriting via UiWriter
- Ensure all logs write to workspace/logs directory consistently
- Set G3_WORKSPACE_PATH early in planning mode initialization
2025-12-09 22:44:00 +11:00

1.9 KiB

Planner Mode UI and Error Handling Refinements

1. Error Propagation from LLM Calls

  • Add error handling to call_refinement_llm_with_tools() in crates/g3-planner/src/llm.rs
    • Import classify_error and ErrorType from g3_core::error_handling
    • Wrap agent execution with error classification
    • Display user-friendly error messages based on error type

2. Single-Line Tool Output Display

  • Modify print_tool_header() in PlannerUiWriter to accept tool arguments
    • Change signature to accept tool_args: Option<&serde_json::Value>
    • Format output as single line with first 50 chars of args
    • Ensure no trailing newlines
    • Update UiWriter trait and all implementations
    • Update call site in g3-core to pass tool args

3. Display LLM Text Responses

  • Fix print_agent_response() to prevent overwriting
    • Use println instead of print to avoid overwriting
    • Review notify_sse_received() for carriage return issues
    • Update print_status_line() to use proper formatting

4. Consistent Workspace Logs Directory

  • Set G3_WORKSPACE_PATH early in run_planning_mode()
    • Move env var setting before provider initialization
    • Create logs directory and verify it exists
    • Add user notification about logs directory
    • Remove duplicate G3_WORKSPACE_PATH setting in coach_player_loop

Testing

  • Test error display with rate limit scenario
  • Test tool output formatting
  • Test text response visibility
  • Verify logs are written to workspace/logs directory

Summary

All implementations complete and verified:

  • Error handling with classify_error() properly integrated
  • Tool output displays on single line with args preview
  • Text responses use println to avoid overwrites
  • Workspace path set early, logs directory created consistently
  • Code compiles successfully with no errors