F-025: fix(app): log Ctrl+C handler install failures#26
F-025: fix(app): log Ctrl+C handler install failures#26Sephyi wants to merge 1 commit intodevelopmentfrom
Conversation
…carding The Ctrl+C handler task used `signal::ctrl_c().await.ok();` which silently swallowed platform-specific signal-registration errors. On Unix, `signal::ctrl_c()` can fail when installing the SIGINT handler (for example, if another library already captured SIGINT non-reentrantly, or if the runtime lacks signal capabilities). Discarding that error meant we would proceed to cancel the token on an unrelated future-ready state, or worse, never react to Ctrl+C at all without any diagnostic. Replace `.ok()` with an explicit match that logs the install failure at `warn!` level (including the error via `%e`) and returns from the task without firing `cancel.cancel()`. This makes the failure mode observable in debug logs and avoids a spurious cancellation when signal registration fails outright. Normal test runs never exercise this branch — signal registration succeeds on all supported platforms during testing. Closes audit entry F-025 from #3.
There was a problem hiding this comment.
Pull request overview
Updates the CLI app’s Ctrl+C handling to avoid silently discarding failures from tokio::signal::ctrl_c(), addressing audit finding F-025.
Changes:
- Replace
.ok()onsignal::ctrl_c().awaitwith explicit error handling and awarn!log on failure.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| signal::ctrl_c().await.ok(); | ||
| if let Err(e) = signal::ctrl_c().await { | ||
| warn!(error = %e, "failed to install Ctrl+C handler"); | ||
| return; |
There was a problem hiding this comment.
On Ctrl+C handler setup failure, the spawned task returns without cancelling. This changes behavior vs the previous .ok() (which would still call cancel.cancel() after an immediate Err), and can leave the app running without any CancellationToken-based shutdown path (streaming tasks may keep going, and Ctrl+C may no longer trigger graceful cancellation). Consider cancelling after logging (to preserve the prior fail-fast behavior) or surfacing this as a fatal startup error instead of silently continuing.
| return; |
Summary
fix(app): log Ctrl+C handler install failures.
Audit context
Closes audit entry F-025 from #3.
Verification
cargo fmt --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-targets