← Back to PRs

#6059: fix #6044

by vivganes open 2026-02-01 07:13 View on GitHub →
commands
Fixes #6044 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR fixes an interactive CLI edge case in `models auth add` where cancelling a `@clack/prompts` select (ESC) returns `undefined` and previously flowed into provider/method handling. The command now detects cancellation for both the provider and method selects and exits early with a `Cancelled.` log, preventing downstream errors. It also adds a small Vitest regression test that mocks `@clack/prompts` to verify the command resolves without throwing when the provider select or method select is cancelled. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge and addresses a clear cancellation crash path in an interactive command. - The behavior change is narrow (early returns on `undefined` selections) and covered by a focused regression test. The only nits are test robustness/type-safety improvements; no functional regressions were identified in the modified command logic. - src/commands/models/models-auth.add.test.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs