Fix: Make Q CLI Prompt Pattern Matching ANSI color-agnostic#18
Conversation
nitin-k
commented
Oct 31, 2025
- Strip ANSI codes before pattern matching to handle color variations
- Update idle and permission prompt patterns to be color-free
- Add debug logging for pattern matching troubleshooting
- Fixes timeout issues caused by color code mismatches in prompts
anilkmr-a2z
left a comment
There was a problem hiding this comment.
Instead of creating a new commit, could we just amend the original commit ? Its unnecessary to have "remove debug statements" in remote history ?
Yep, done. |
anilkmr-a2z
left a comment
There was a problem hiding this comment.
Thanks for updating it based on the comments.
|
@nitin-k mind resolving the conflict ? |
|
Looks like there are plenty of changes happened on the main branch :( |
@nitin-k take your time to investigate. @gutosantos82 maybe able to provide some guidance per the failure. |
Test Failures - Incomplete ANSI-Agnostic ImplementationThe 16 failing tests reveal that extract_last_message_from_script() was not updated to use the new ANSI-agnostic approach. The Issueget_status() correctly strips ANSI codes before pattern matching: But extract_last_message_from_script() searches raw output with ANSI codes: The pattern expects [developer]> but raw output is \x1b[36m[developer]\x1b[35m>\x1b[39m. Fix NeededStrip ANSI codes before pattern matching, then map the clean position back to raw output for extraction (to preserve the original message with any formatting). |
- Strip ANSI codes before pattern matching to handle color variations - Update idle and permission prompt patterns to be color-free - Add debug logging for pattern matching troubleshooting - Fixes timeout issues caused by color code mismatches in prompts
|
@gutosantos82 Thanks for your comment. I fixed the feature and updated some tests accordingly. |
…t stabilization Three bugs fixed in Gemini CLI provider (lessons #16, #17, #18): 1. Ink TUI keeps idle prompt visible during processing — added PROCESSING_SPINNER_PATTERN (Braille dots + "esc to cancel") check in get_status() to avoid premature COMPLETED when MCP tools are still executing. 2. Premature COMPLETED between text output and MCP tool call — replaced sequential wait_for_status + terminal count check with combined _wait_for_supervisor_done() polling in supervisor E2E tests. 3. Ink TUI shows idle prompt before -i prompt is processed — added _uses_prompt_interactive flag so initialize() waits for COMPLETED (not IDLE) when -i is used, preventing lost messages. E2E test improvements across all providers: - Accept both "idle" and "completed" as valid post-initialization states - Add stabilization delay after COMPLETED detection in handoff/assign tests - Add missing get_terminal_status import in test_handoff.py E2E results: 13/14 pass (7/7 Gemini, 6/7 Codex — 1 pre-existing Codex supervisor_assign output extraction failure). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t stabilization Three bugs fixed in Gemini CLI provider (lessons #16, #17, #18): 1. Ink TUI keeps idle prompt visible during processing — added PROCESSING_SPINNER_PATTERN (Braille dots + "esc to cancel") check in get_status() to avoid premature COMPLETED when MCP tools are still executing. 2. Premature COMPLETED between text output and MCP tool call — replaced sequential wait_for_status + terminal count check with combined _wait_for_supervisor_done() polling in supervisor E2E tests. 3. Ink TUI shows idle prompt before -i prompt is processed — added _uses_prompt_interactive flag so initialize() waits for COMPLETED (not IDLE) when -i is used, preventing lost messages. E2E test improvements across all providers: - Accept both "idle" and "completed" as valid post-initialization states - Add stabilization delay after COMPLETED detection in handoff/assign tests - Add missing get_terminal_status import in test_handoff.py E2E results: 13/14 pass (7/7 Gemini, 6/7 Codex — 1 pre-existing Codex supervisor_assign output extraction failure). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>