-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Parent: #1534
Problem
cert remove uses Console.ReadLine() in a while(true) loop to prompt for confirmation. When called by an AI agent or in any non-interactive context (CI, piped stdin, headless), the command hangs indefinitely waiting for input that will never come.
The --force flag exists to skip the prompt, but:
- The help text doesn't mention that
--forceis required for non-interactive use - There's no TTY detection — the prompt runs regardless of whether stdin is a terminal
Rationale
AI agents and CI pipelines don't have interactive terminals. A CLI that hangs waiting for input is a blocker — the agent can't recover from it, can't detect it's happening, and can't time out gracefully. This is the most common way CLIs break in automated contexts.
Proposed solution
-
Add TTY detection before prompting. If stdin is not a terminal and
--forceis not set, fail immediately with:Error: Confirmation required but running in non-interactive mode. Use --force to skip confirmation.In .NET:
Console.IsInputRedirecteddetects non-TTY stdin. -
Consider a global
--no-inputflag that disables all interactive prompts across all commands. Any command requiring confirmation without--forceshould fail with a clear error. -
Update help text for
cert removeto note that--forceis required for non-interactive use. -
Audit all commands for other
Console.ReadLine()calls that could hang.
Affected code
DevProxy/Commands/CertCommand.cs—PromptConfirmation()method- Any other code using
Console.ReadLine()or similar interactive patterns