Fix CLI quality regressions#103
Merged
Merged
Conversation
If the agent's response races the user's typing (turn ends before the user has pressed Enter), the typing-line buffer was silently dropped, making the v1.13 "type while agent runs, auto-queue" feature appear broken: the user sees `⌨ partial text` appear, agent response prints, and the partial vanishes. Subsequent keystrokes that arrive between stopQueueReader() and the next tui.ReadInput end up split across two prompts, producing confusing "phantom" input. The queue reader now exposes its in-flight line buffer via its stop function. After the agent finishes, repl pushes any partial line onto the queue with a clear "↩ partial input recovered" notice. Users can discard it with the new `/queue clear` command if it was stray input. The fix preserves the existing Enter-to-queue, Enter-cancels-agent, and Ctrl+C-clears behaviour unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Before this change, both `qmax-code -p "..."` and `qmax-code "..."` called `ag.Run` (the Anthropic API agent) unconditionally — silently ignoring `backend=cc` and `backend=codex`. Every CI / scripting / cloud-session invocation bypassed the cc backend and hit the Anthropic API directly (often producing a 401 from a stale keychain key, masking the real issue). The doc claims that the cc backend needs no Anthropic API key were also false for these paths. The fix introduces a single `runOneShot` dispatcher shared by both non-interactive entry points: if `cliAgent` is configured, prompts go through it (claude/codex CLI) with its own streaming output; only when there is no CLI backend do we fall back to `ag.Run`. Regression tests (main_oneshot_test.go) mirror the dispatch contract with a fake CLIAgent and assert (1) CLI takes precedence, (2) API is used as the fallback, (3) CLI errors propagate. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…o Desperado/qua-578-579-580-cli-quality
…' into Desperado/qua-578-579-580-cli-quality
…-580-cli-quality # Conflicts: # internal/session/stdin_queue_unix.go # main.go
✅ QualityMax Pipeline
Powered by QualityMax — AI-Powered Test Automation |
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Included fixes
Tests