Skip to content

Fix repeated cancellation message on Ctrl-C during API key prompt#22

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-graceful-shutdown-issue
Draft

Fix repeated cancellation message on Ctrl-C during API key prompt#22
Copilot wants to merge 2 commits intomainfrom
copilot/fix-graceful-shutdown-issue

Conversation

Copy link

Copilot AI commented Nov 29, 2025

Pressing Ctrl-C during the "Enter API Key" prompt triggers the OnCancelKeyPress handler repeatedly while the blocking prompt waits for input, flooding the console with cancellation messages.

Fix: Guard against re-entry in OnCancelKeyPress:

private static void OnCancelKeyPress(object? sender, ConsoleCancelEventArgs e)
{
    e.Cancel = true;

    if (_wasCancelled)
        return;

    _wasCancelled = true;
    _cts?.Cancel();
    AnsiConsole.MarkupLine("[yellow]Cancellation requested. Shutting down gracefully...[/]");
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Ctrl-C at "Enter API Key" hard-locks the graceful shutdown</issue_title>
<issue_description>Image</issue_description>

Comments on the Issue (you are @copilot in this section)

@refringe Thanks for reporting this.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: refringe <127057+refringe@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Ctrl-C hard-lock during API key entry Fix repeated cancellation message on Ctrl-C during API key prompt Nov 29, 2025
Copilot AI requested a review from refringe November 29, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ctrl-C at "Enter API Key" hard-locks the graceful shutdown

2 participants