|
| 1 | +# CLI Completion Display Fix |
| 2 | + |
| 3 | +## Problem Statement |
| 4 | + |
| 5 | +The CLI shows `attempt_completion...` but never displays the actual completion result content, causing users to see incomplete output before system shutdown. |
| 6 | + |
| 7 | +## Root Cause |
| 8 | + |
| 9 | +CLILogger receives `completion_result` messages but doesn't properly handle/display them, unlike the VSCode extension which shows completion results correctly. |
| 10 | + |
| 11 | +## Technical Analysis |
| 12 | + |
| 13 | +### Current Flow |
| 14 | + |
| 15 | +1. `attempt_completion` tool calls `cline.say("completion_result", result)` |
| 16 | +2. TaskMessaging emits "message" event with completion result |
| 17 | +3. CLILogger receives message but doesn't display `completion_result` content |
| 18 | +4. System shuts down immediately |
| 19 | + |
| 20 | +### Expected Flow |
| 21 | + |
| 22 | +1. `attempt_completion` tool calls `cline.say("completion_result", result)` |
| 23 | +2. TaskMessaging emits "message" event with completion result |
| 24 | +3. CLILogger properly displays the completion result content |
| 25 | +4. System completes gracefully |
| 26 | + |
| 27 | +## Solution |
| 28 | + |
| 29 | +Fix CLILogger to properly handle `completion_result` messages in the existing shared message handling flow. |
| 30 | + |
| 31 | +### Files to Modify |
| 32 | + |
| 33 | +1. **src/cli/services/streaming/CLILogger.ts** |
| 34 | + |
| 35 | + - Add proper `completion_result` message handling |
| 36 | + - Ensure completion content is displayed to user |
| 37 | + - Use existing message processing pipeline |
| 38 | + |
| 39 | +2. **src/cli/services/streaming/CLIDisplayFormatter.ts** (if needed) |
| 40 | + - Ensure completion results are properly formatted |
| 41 | + - Handle completion message display formatting |
| 42 | + |
| 43 | +### Implementation Details |
| 44 | + |
| 45 | +- Use existing CLILogger message handling infrastructure |
| 46 | +- Ensure `completion_result` messages are displayed prominently |
| 47 | +- Maintain consistency with VSCode extension completion display |
| 48 | +- Don't recreate logic - extend existing shared components |
| 49 | + |
| 50 | +### Success Criteria |
| 51 | + |
| 52 | +- CLI displays actual completion result content instead of just "attempt_completion..." |
| 53 | +- Completion results are clearly visible to users |
| 54 | +- Maintains shared code flow between VSCode ext, CLI, and API |
| 55 | +- No custom message handling logic in batch.ts |
| 56 | + |
| 57 | +### Test Cases |
| 58 | + |
| 59 | +1. Run CLI with MCP task that uses `attempt_completion` |
| 60 | +2. Verify completion result content is displayed |
| 61 | +3. Verify system completes gracefully after showing results |
| 62 | +4. Verify no regression in VSCode extension completion display |
| 63 | + |
| 64 | +## Priority |
| 65 | + |
| 66 | +High - Core functionality broken, affecting user experience |
0 commit comments