Skip to content

Fix cron installation safety on qr init#46

Merged
baanish merged 2 commits into
masterfrom
cursor/cron-install-safety-93e4
Jul 1, 2026
Merged

Fix cron installation safety on qr init#46
baanish merged 2 commits into
masterfrom
cursor/cron-install-safety-93e4

Conversation

@baanish

@baanish baanish commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

Ensures qr init never overwrites a user's crontab when crontab -l fails unexpectedly.

  • Checks crontab -l exit status explicitly
  • Treats only recognizable "no crontab for user" output as empty
  • Aborts with a clear error on other list failures (no crontab - write)
  • Extracts testable helpers: crontab_contents_from_list_output, merge_cron_entry
  • Preserves duplicate-entry skip behavior

Test plan

  • Unit tests for merge, no-crontab, and failure rejection
  • cargo test
  • cargo fmt --all -- --check
  • cargo clippy --all-targets --locked -- -D warnings

Note: Merge carefully with cursor/init-secret-hardening-93e4 — both touch install_cron in main.rs. Combined cleanly on cursor/public-readiness-93e4.

Open in Web Open in Cursor 

Co-authored-by: Aanish Bhirud <baanish@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@cursor[bot], you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 5685e1a6-cc7d-44d6-85c5-d5fc18404be8

📥 Commits

Reviewing files that changed from the base of the PR and between fcf57af and 87c3b2b.

📒 Files selected for processing (2)
  • src/main.rs
  • src/shell.rs

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot marked this pull request as ready for review July 1, 2026 09:40
Comment thread src/main.rs Outdated
let output = Command::new("crontab")
.arg("-l")
.output()
.context("Failed to run `crontab -l`")?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing crontab binary now aborts qr init instead of degrading gracefully

Previously, if crontab -l could not even be spawned (e.g. cron is not installed on minimal distros, containers, or WSL without cronie), the Err(_) arm printed a "Add this entry manually" hint and let qr init continue. Now that path returns via .context(...)?, so the error propagates through install_cron() (install_cron()? at src/main.rs:356) and aborts the entire qr init with "Failed to run crontab -l: No such file or directory (os error 2)".

The PR's stated intent is to abort on unexpected list failures without wiping the crontab, but a spawn failure (binary missing) is a different case that previously degraded gracefully. Consider detecting the "binary not found" spawn error and retaining the manual-instruction fallback so users without cron can still complete qr init.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The previously reported crontab binary-missing issue is resolved: the spawn-failure arm of crontab -l now falls back to print_manual_cron_hint and returns Ok(()) instead of propagating an error that would abort qr init.

Files Reviewed (1 file)
  • src/main.rs
Previous Review Summary (commit 1353757)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 1353757)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/main.rs 572 Missing crontab binary now aborts qr init instead of degrading gracefully (previously printed a manual-add hint and continued)
Files Reviewed (2 files)
  • src/main.rs - 1 issue
  • src/shell.rs - 0 issues

Fix these issues in Kilo Cloud


Reviewed by glm-5.2-short · Input: 16.8K · Output: 1.8K · Cached: 131.3K

Co-authored-by: Aanish Bhirud <baanish@users.noreply.github.com>
@baanish baanish merged commit 0dd25e4 into master Jul 1, 2026
5 checks passed
baanish added a commit that referenced this pull request Jul 1, 2026
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.

2 participants