Repository navigation
chore: [vent] cursor-agent crashes (exits non-zero, zero assistant output) immediately… - #693
Conversation
…ded then removed the diagnostic probe test), so only the real fix remains. ## Status **Root cause, found by live reproduction** (not guesswork): I ran the *actual* production dispatch path — `agentflare_jobs::sandbox::wrap()` building the real `bwrap` argv, the real `cursor-agent` binary, the real review-only prompt text — in this sandbox. `cursor-agent` printed its `system`/`init` message, echoed the prompt, then died non-zero with **zero assistant turns**, stderr: `ActionRequiredError: You've hit your usage limit ... set a Spend Limit to continue`. That's an exact match for the vent's symptom. This means problem #1 isn't actually "review-only prompt shape breaks cursor-agent" — it's a plain account/model usage-limit lockout that happens to have hit on review-only-routed items. I traced the escalation path end-to-end (`HeadlessOutcome::Failed` → workflow `last_error` → `"Workflow failed due to step dependency failure: ..."` → `classify_and_cooldown` → `auth_runner::is_rate_limited` → per-agent cooldown → `dispatch_failure_ceiling`'s consecutive-failure cap in `dashboard/orphan_reconcile.rs`) and confirmed all of it is already wired up in this codebase (problem #2's infrastructure already exists, likely from later items #164/#173/#506). The one real gap: `is_rate_limited`'s pattern list didn't cover cursor-agent's own wording standalone (only "usage limit" happened to match by luck), and there was no test locking in the specific "step dependency failure" wrapper (a different message shape than the one existing test covers). **Changes:** - `src/auth_runner.rs`: added `"spend limit"` to `RATE_LIMIT_PATTERNS`, plus a test with the exact reproduced cursor-agent error text. - `src/cli/work.rs`: added a regression test proving `classify_and_cooldown` correctly cools down `cursor` when the real usage-limit error arrives wrapped in the `"Workflow failed due to step dependency failure: ..."` message (previously only the `"One or more steps failed: ..."` wrapper had coverage). **Verified:** `cargo fmt --check` clean; `cargo clippy --workspace --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic` (CI's exact flags) clean; 9/9 `auth_runner` tests, 80/80 `cli::work` tests, 7/7 `agentflare-jobs::sandbox` tests pass. **Concern:** I did not find or fix a code defect causing the *silent infinite loop* itself — that machinery looks correctly implemented already. If items are still observed looping past the cap in production, the gap is likely somewhere I didn't trace (e.g., a dispatch path that bypasses `agentflare_jobs::Queue`), and would need a fresh incident log to pin down. Agentflare-Branch: task/240-vent-cursor-agent-crashes-exits-non-zero Agentflare-Item: 240
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. 📝 WalkthroughWalkthroughThe rate-limit classifier now recognizes Cursor-agent messages containing “spend limit”. Tests verify direct classification and the standard 30-minute workflow cooldown. ChangesCursor-agent rate-limit detection
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change adds coverage for Cursor-agent spend-limit failures and preserves cooldown handling, with no identified merge-blocking risk. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Tracking this PR for automated review ( |
Good — the
agentflare-jobs/src/sandbox.rsedit net-zero'd out (I added then removed the diagnostic probe test), so only the real fix remains.Status
Root cause, found by live reproduction (not guesswork): I ran the actual production dispatch path —
agentflare_jobs::sandbox::wrap()building the realbwrapargv, the realcursor-agentbinary, the real review-only prompt text — in this sandbox.cursor-agentprinted itssystem/initmessage, echoed the prompt, then died non-zero with zero assistant turns, stderr:ActionRequiredError: You've hit your usage limit ... set a Spend Limit to continue. That's an exact match for the vent's symptom.This means problem #1 isn't actually "review-only prompt shape breaks cursor-agent" — it's a plain account/model usage-limit lockout that happens to have hit on review-only-routed items. I traced the escalation path end-to-end (
HeadlessOutcome::Failed→ workflowlast_error→"Workflow failed due to step dependency failure: ..."→classify_and_cooldown→auth_runner::is_rate_limited→ per-agent cooldown →dispatch_failure_ceiling's consecutive-failure cap indashboard/orphan_reconcile.rs) and confirmed all of it is already wired up in this codebase (problem #2's infrastructure already exists, likely from later items #164/#173/#506). The one real gap:is_rate_limited's pattern list didn't cover cursor-agent's own wording standalone (only "usage limit" happened to match by luck), and there was no test locking in the specific "step dependency failure" wrapper (a different message shape than the one existing test covers).Changes:
src/auth_runner.rs: added"spend limit"toRATE_LIMIT_PATTERNS, plus a test with the exact reproduced cursor-agent error text.src/cli/work.rs: added a regression test provingclassify_and_cooldowncorrectly cools downcursorwhen the real usage-limit error arrives wrapped in the"Workflow failed due to step dependency failure: ..."message (previously only the"One or more steps failed: ..."wrapper had coverage).Verified:
cargo fmt --checkclean;cargo clippy --workspace --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic(CI's exact flags) clean; 9/9auth_runnertests, 80/80cli::worktests, 7/7agentflare-jobs::sandboxtests pass.Concern: I did not find or fix a code defect causing the silent infinite loop itself — that machinery looks correctly implemented already. If items are still observed looping past the cap in production, the gap is likely somewhere I didn't trace (e.g., a dispatch path that bypasses
agentflare_jobs::Queue), and would need a fresh incident log to pin down.Opened by
claude-codeon flared:51bb8de6c33b for item #240 via agentflare.Summary by CodeRabbit