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
1.9 KiB
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()incrates/g3-planner/src/llm.rs- Import
classify_errorandErrorTypefromg3_core::error_handling - Wrap agent execution with error classification
- Display user-friendly error messages based on error type
- Import
2. Single-Line Tool Output Display
- Modify
print_tool_header()inPlannerUiWriterto 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
- Change signature to accept
3. Display LLM Text Responses
- Fix
print_agent_response()to prevent overwriting- Use
printlninstead ofprintto avoid overwriting - Review
notify_sse_received()for carriage return issues - Update
print_status_line()to use proper formatting
- Use
4. Consistent Workspace Logs Directory
- Set
G3_WORKSPACE_PATHearly inrun_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