feat(git-shim): alert on sustained ScopeCheckError audit events (#493) - #529
Conversation
agentflare git doctor now reads git.jsonl and flags scope-check crashes that hit 3+ of the last 10 commit/push invocations as a violation (nonzero exit, same as existing dirty/stale thresholds) -- an isolated crash (e.g. mid-upgrade binary swap) stays silent, since blocking on every one-off would just retrain agents to ignore doctor output. Agentflare-Agent: claude-code Agentflare-Branch: task/493-git-shim-alert-on-sustained-scopechecker Agentflare-Item: 493
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 6 minutes Limit details: You’ve used all 1 included review currently available under your plan. You completed 70 included PR reviews in the past 7 days; at that activity level, included reviews refill at 1 review per hour. 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
Summary
Closes #493. The git shim fails OPEN when
agentflare git scope-checkcrashes mid-run (PR #513 / item #472): the git op passes through with a stderr warning, and each crash is audited asDisposition::ScopeCheckErrorin~/.agentflare/audit/git.jsonl. A persistently crashing binary therefore disables scope enforcement silently while every git op still succeeds.This adds detection in
agentflare git doctor(the periodic-check option from the ask's open questions):doctor::sustained_scope_check_failure(events, window, threshold)scans the most recentwindowcommit/push audit events (the only subcommands that invoke scope-check) and flags the run when>= thresholdof them areScopeCheckError— sustained breakage, not a one-off.doctor::append_scope_check_violationreadsgit.jsonland appends a violation to the doctor report (silent-skip on missing/unreadable log, honorsAGENTFLARE_HOME_OVERRIDE).doctor_cmdinsrc/cli/git.rswires it in; a hit renders in text/json/markdown output and exits nonzero, matching the existing dirty/stale violation thresholds.Design decisions (resolved open questions)
agentflare git doctor, not a daemon-side watcher — zero new infrastructure, surfaces where agents already look, and a one-off crash deliberately stays silent (blocking on every isolated crash would just train agents to ignore doctor output).SCOPE_CHECK_HEALTH_THRESHOLD/SCOPE_CHECK_HEALTH_WINDOW, exported consts). A mid-upgrade binary swap is one crash; 3 in 10 means enforcement is effectively off.Test plan
doctor.rs: no events healthy; single isolated crash does not alert; crashes at/above threshold within window alert (asserts "effectively OFF" message); crashes outside window ignored; non-scope-checked subcommands (status/fetch) don't dilute the window.cargo test -p flare-git-core: 187 passed.cargo build --bin agentflare: clean.cargo clippy --workspace --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic: clean.cargo fmt --check: clean.