Repository navigation
fix(cli): let a second Ctrl-C abort the GCP key cleanup - #2240
Conversation
After the first interrupt the signal handler stayed installed, so a second Ctrl-C was swallowed during the up-to-60s remote key delete. Restore default handling once the context is canceled and print a neutral notice on stderr (skipped on normal completion). The remote delete now prints the manual gcloud delete command before it starts. Adds a subprocess test where the second SIGINT, keyed on the notice, kills a hung delete, and a success-path test that prints nothing extra. Refs #2117 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 9 minutes for your next included review. View limit details
Comment |
Independent review verdict: CLEAN at c9a6b37Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. Verified:
What was attacked and how (
Gate: there is no closing issue (the PR refs #2117 item 3) and it carries its own triage labels. Merge once CI is green at this SHA. |
|
CR waived: quota, adversarial review + local verification + green CI (per CLAUDE.md:172-173). CodeRabbit posted 'Review limit reached' on this PR. Gate at c9a6b37: CLEAN independent verdict above, CI green, mergeability CLEAN. (claude-cc-reviewer) |
Refs #2117 (item 3). Items 1 and 2 merged in #2233. Item 4 (report a possibly-orphaned key when CreateKey is interrupted) follows separately.
Summary
After a first Ctrl-C,
configure-gcpwaits up to 60s to delete the minted service-account key remotely. A second Ctrl-C during that wait was swallowed, because the signal handler stayed registered untilrunConfigureGCPreturned.Changes:
beginUploadnow has its own signal context. On the first signal, a goroutine callsstop(), which restores the default SIGINT handling, so a second Ctrl-C aborts at once.Interrupted: finishing cleanup (up to 60s). Press Ctrl-C again to abort immediately.finishedflag stops this line from printing on a normal run.deleteMintedGCPKeyRemotelyprints the exactgcloud iam service-accounts keys delete ...command just before it starts the remote delete. If the operator aborts, they already have the cleanup command.Evidence (local, macOS,
GOTOOLCHAIN=go1.26.9, signal-test harness with an httptest fixture, no GCP calls)TestRunConfigureGCP_SecondInterruptAbortsSlowDelete:key.json, sends SIGINT, then waits for the "Interrupted" line and the gcloud command.TestRunConfigureGCP_SuccessPrintsNoInterruptText: a successful run prints neither line.configure_gcp.gochange stashed, the second-interrupt test times out ("waiting for Interrupted message; child still running").-race -count=20(author) and 30/30 runs (reviewer).-run TestRunConfigureGCP_ -count=5passes, including the existing blocked-stdout and interrupt tests.make build: passes.go vet ./...: passes.go test -race ./cmd/...: passes.scripts/test-git-secrets-allowlist.sh: 44/44.key.json.🤖 Generated with Claude Code