fix(auth): report Ctrl-C at the login paste prompt as a cancellation - #275
AmanVarshney01 wants to merge 2 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. Summary by CodeRabbit
WalkthroughWhen readline raises Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Ctrl-C during the paste prompt is reported as cancellation, while a completed browser callback still finishes login. No actionable merge risk is evident. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
commit: |
On a TTY, `auth login` races the browser's loopback callback against a
readline prompt for a pasted callback URL. readline holds the terminal in
raw mode, so Ctrl-C there never becomes a SIGINT the engine could record.
readline closes the interface and rejects the question with its own
AbortError while the login's paste signal is still live.
The prompt treated every AbortError as "the browser callback won the
race", so login resolved with no tokens and the run settled as
CLI.INTERNAL_ERROR ("Sign-in finished without producing a credential."),
exit 1. A user cancelling sign-in was reported as a CLI bug.
The paste signal's own `aborted` state now decides: aborted means the
login is over and prompting stops, as before. An AbortError with the
signal still live is the user's Ctrl-C and throws CLI.PROMPT_CANCELLED,
the code the engine already settles as a user cancellation (exit 3) for
Ctrl-C at its own raw-mode prompts. The loopback server and the readline
interface are still torn down by the existing finally blocks. The
browser-won path and the wrong-paste re-prompt are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Shorten the two comments in the paste prompt's abort handling, drop the error-conventions paragraph and the parenthetical in the CLI.PROMPT_CANCELLED reference entry, and keep only the two tests that guard the change: Ctrl-C at the prompt cancels, and the browser callback still wins while the prompt waits. The engine already tests that the code exits 3. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
540dbfe to
f0b289e
Compare
Ctrl-C at the
auth loginpaste prompt is handled by readline, which rejects withAbortErrorrather than delivering SIGINT. The old code treated everyAbortErroras a completed browser callback, then returnedCLI.INTERNAL_ERRORwhen no credential existed.The fix distinguishes the login's own abort signal from readline's Ctrl-C. A browser callback still ends the prompt normally; Ctrl-C now returns
CLI.PROMPT_CANCELLED.Verified with a real PTY and an isolated auth file, plus 25 auth-login tests, the full CLI unit suite (1,026 passed), typecheck, and lint. The rebased PR's Ubuntu and Windows tests and real-API e2e job pass.