Repository navigation
fix(cursor-approve): allow the checkout axes the shell they were meant to have - #375
Conversation
…hell they never had
The correctness and conformance axes were told to run `git diff` from the
merge base, but their Cursor config had an empty allow list and an empty
deny list. In --print mode that rejects every shell command, so each one
came back `rejected` and the agent reviewed the head tree blind: no diff,
no deletions, no commit log. Axis summaries said so ("Shell/git was
unavailable to me").
The workflow now runs that git itself for a checkout axis and leaves the
output beside the PR context file under pr/.git: the merge-base diff (cut
at 1 MB), its --name-status list, and the PR's commit log. A new
prompt-checkout.md addendum points the agent at them. Every axis is now
denied Shell(*), Write(**) and WebFetch(*) explicitly, so the boundary is
stated instead of falling out of an empty allow list. Allowing Shell(git)
instead would have been a full shell (`git -c alias.x='!sh' x`) for an
agent holding CURSOR_API_KEY over PR code. The precompute passes
--no-ext-diff --no-textconv so a PR's .gitattributes cannot run a driver.
|
Warning Review paused — included plan limit reachedKeep your review moving with free on-demand reviews.
On-demand reviews are free for the next 2 days.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Promotion and pricing detailsOn-demand reviews are free for the next 2 days. After that, they cost $0.25 per reviewed file. Review limit detailsOr wait 9 minutes for your next included review. Limit details: You’ve used the included review currently available. Your 130 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Your free on-demand review promotion remains active until October 9, 2026 at 6:00 PM UTC. 📝 WalkthroughWalkthroughThe workflow now prepares Git context files for checkout axes and denies shell, write, and web-fetch tools for all axes. The checkout prompt and caller documentation describe the saved context and no-shell execution. ChangesCheckout context and tool restrictions
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Checkout axes now read Git output prepared by the workflow, and shell, write, and web-fetch tools are denied for every axis. No concrete defect was found. An end-to-end run is still needed to confirm the agent can read the prepared diff. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
|
@mattmillerai one reason not to hand the diff to the reviewer is that it can blow up context if the diff is large. If I recall cursor review just doesn't do large diff sizes, but sometimes the diff is mechancial or there are other ways to evaluate (e.g. agent may write some python or shell script to detect true diff). Why not just tell the reviewer the range it's reviewing and give it the choice for how to approach? |
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @mattmillerai.
Found 9 finding(s).
| Severity | Count |
|---|---|
| 🟡 Medium | 4 |
| 🟢 Low | 2 |
| ⚪ Nit | 3 |
Panel: 6/6 reviewers contributed findings.
huntcsg
left a comment
There was a problem hiding this comment.
Please see my comment. I'm not sure that you should hand the diff to the agent. Obviously your call. I think it will reduce the number of eligible PRs.
…ng them a diff Review feedback: a precomputed diff pushes the agent toward reading one large file and can blow up its context, where with a shell it can choose (--stat first, read only the hunks that matter, script a check over a mechanical change). The prompt already names the merge-base range. Reverts the precompute and prompt-checkout.md. Instead, a checkout axis (no_shell false) gets an explicit Shell(*) allow rule, which is what was missing: --print rejects any command no allow rule matches. This is the same unsandboxed shell over PR code the cursor-review panel accepts. Two transcript guards make the blind-verdict failure loud: - every axis, not just no_shell ones, fails with no recognizable tool call; - a checkout axis fails if every shell call it made was rejected.
|
@huntcsg Agreed, and reworked: the precomputed diff is gone. The real bug was that |
… axis runs A PR could ship a .cursorignore or .cursorindexingignore that hides its own changed files from the read and search tools of the reviewer judging it. Delete them alongside the PR-authored .cursor/ config.
ELI-5
The correctness, conformance and completeness reviewers are told to read the PR's diff with
git. Every shell command they try gets silently rejected, so they never see the diff and approve by guessing from files on disk. This PR gives them the shell they were always meant to have. The reviewer gets the merge-base range and decides how to review it. If the shell ever breaks again, the job now fails visibly instead of returning a blind verdict.What was wrong
cursor-axis-base.ymlwrites.cursor/cli.jsonwithallow: []. Unlessno_shellis set, it also writesdeny: [].cursor-agent --printhas no one to approve a command, so it rejects any shell call that no allow rule matches. On checkout axes, everygit diffandgit logcame back{"rejected": {..., "reason": ""}}. The agents fell back to Read and Grep and said so in their verdicts ("Shell/git was unavailable to me"). The caller docs promised the completeness axis "keeps a shell forgit", which was never true.Change
no_shellis false (the checkout axes), the config addsShell(*)toallow. Business and design are unchanged: they get no shell, the existing deny list, and the existing check that fails the job if a shell call appears anyway.no_shellaxes.rejected, which is exactly this bug..cursorignoreand.cursorindexingignoreare deleted alongside the PR's.cursor/config, so a PR cannot hide its own changes from the read and search tools of the reviewer judging it.Revised after review
The first version precomputed the diff into
.git/and pointed the agent at it. @huntcsg pointed out that a large diff can blow up the agent's context, and that with a shell the agent can choose its own approach:--statfirst, read only the relevant hunks, or script a check over a mechanical change. The prompt already names the range (git diff <merge_base>...<head>), so this version drops the precompute.Risk
This is the same unsandboxed shell over PR code that the cursor-review panel already accepts (see the
cursor-review.ymlheader). The axis job hascontents: read, a checkout withpersist-credentials: false, andCURSOR_API_KEYin the environment. For completeness, the existing note about the Linear proxy token on a passwordless-sudorunner still applies, and the docs keep it.Testing
python3 -m unittest discover -s .github/cursor-approve/tests -p 'test_*.py': OK. Two tests are new: the allow rule plus the all-rejected guard, and the every-axis tool-call guard.cursor-reviewandworkflow-pinssuites are OK.actionlint: nothing new. Its only warnings are the existingjob.workflow_shaones.cursor-agentlocally to confirm thatShell(*)turnsrejectedinto executed calls. The new guard turns the first real round into the test: either the transcript shows shell calls succeeding, or the axis job fails with "all N shell call(s) were rejected".Provenance
cursor-approveunittest suite: 164 tests OK at the current head, including the.cursorignoreremoval assertion.check_workflow_pins.py,check_agents_md.py --root .and the org-repo-literal lint pass.cursor-agentrun is still unverified (see Testing).Shell(*)allow rule after review..cursorignoreand.cursorindexingignorefiles. This was not in the original scope.🤖 Generated with Claude Code