fix(cli): preserve build cancellation through npx - #3231
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe CLI now uses shared utilities to request build cancellation, handle repeated SIGINT signals, abort log streaming, and report cancellation outcomes. Native tests cover success, failure, duplicate-signal, and forced-exit paths. ChangesBuild cancellation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change preserves build cancellation through npx and reports whether cancellation was accepted without introducing an evidenced merge-blocking risk; it is merge-ready after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant CLI as Build request CLI
participant Handler as Cancellation signal handler
participant API as Cancellation request
participant Logs as Log streaming
CLI->>Handler: Receive SIGINT
Handler->>API: Send cancellation request
API->>API: POST application ID
Handler->>Logs: Abort after request completes
Suggested reviewers: 🚥 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 4 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
|



Summary
Root cause
When invoked through npx, one Ctrl+C can reach the CLI twice: once through the foreground process group and once through the npx wrapper. The first signal started the asynchronous cancellation request; the immediate second signal saw cancellation as already requested and called process.exit(1), terminating the process before the POST reached Capgo.
Test plan
The full CLI gate was run with an isolated test home and canonical temporary directory so local credentials and the macOS /var symlink could not leak into existing tests.
Screenshots
Not applicable; this changes terminal cancellation behavior and adds explicit success/failure messages.
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
Tests