fix: reject minvmd run --timeout without --detach - #857
Conversation
`minvmd run --timeout N` without `--detach` parsed successfully and was silently ignored: run() only forwards timeout_secs to run_detach() inside the detach branch, so run_foreground() never received it. The help text already scopes the flag to --detach, so accepting it in foreground mode is a footgun. Make the CLI argument an Option<u64> so an explicit --timeout is distinguishable from the default, and bail early in run() with an actionable error when it is given without --detach. Unit tests pin the rejection and the unchanged libkrun-required path. Refs: #829
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
Fixes #829
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABJPktmA
Defect
minvmd run --timeout Nwithout--detachparsed successfully and was silently ignored.run()forwardstimeout_secstorun_detach()only inside theif detachbranch (crates/minvmd/src/cmd/run.rs);run_foreground()never receives it, so the flag is a no-op in foreground mode. The help text already scopes--timeoutto--detach(crates/minvmd/src/main.rs), so accepting-and-ignoring it is a footgun.Change
Reject the combination rather than implement a new foreground-timeout semantic (which would require deciding what a deadline means for the whole supervisor lifecycle — out of scope for a small fix, and the help text already documents the flag as detach-only).
main.rs: the CLI--timeoutargument becomesOption<u64>(droppingdefault_value_t) so an explicit--timeoutis distinguishable from an omitted one.run.rs:run()now takesOption<u64>and bails early with`--timeout` only applies with `--detach`when a timeout is given without--detach; otherwise it resolves the default (DEFAULT_DETACH_TIMEOUT_SECS) and the detach path is unchanged.All existing
run --detach --timeout Nintegration call sites are unaffected — the guard only fires when--detachis absent. History for this subcommand lives entirely in this repo (informed by PR #351 / issue #330).Verification
cargo fmt --all --check --manifest-path target/Cargo.toml— clean (after applyingcargo fmt).cargo clippy --workspace --manifest-path target/Cargo.toml -- -D warnings— finished, no warnings.cargo build --workspace --manifest-path target/Cargo.toml— finished.cargo test --workspace --manifest-path target/Cargo.toml— exit 0, no failures; newrun_rejects_timeout_without_detachand existingrun_bails_without_libkrunboth pass (2 passed; 0 failed).