Skip to content

perf(cursor-approve): drop the full-history clone from the checkout axes - #463

Merged
wei-hai merged 3 commits into
mainfrom
wei/axis-checkout-shallow
Oct 29, 2026
Merged

wei-hai merged 3 commits into
mainfrom
wei/axis-checkout-shallow

Conversation

@wei-hai

@wei-hai wei-hai commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

The checkout axes in cursor-axis-base.yml (the Cursor axis job and axis-direct) cloned the caller's whole history with fetch-depth: 0. On a large monorepo caller that took 90–631s per axis, often longer than the review itself, though only the merge base needs history.

Both checkouts are now depth 1, followed by the shared scripts/check-pr-size/fetch-history.sh, the same narrowed fetch #433 gave the panel's diff-size job. It fetches BASE_SHA and commit_sha back to a merge base it can vouch for, or fails the job with an ::error::. The prompt now uses merge-base(BASE_SHA, commit_sha) with no silent fallback, since origin/<base_ref> no longer exists in a narrowed checkout. Head, merge base and diff are the same as before. The one exception is a base branch that has since absorbed commits from the PR head's history (the PR's own commits, or a branch both merged); there the result now matches the compare API the no-checkout axes already use.

flowchart LR
  subgraph Before
    a1[checkout fetch-depth 0] --> b1["merge-base(origin/base, head) or BASE_SHA"]
  end
  subgraph After
    a2[checkout depth 1] --> f2[fetch-history.sh: BASE + head until merge base is vouched] --> b2["merge-base(BASE_SHA, head) or fail"]
  end
Loading

Validation: new test_axis_checkout.py pins depth 1, the fetch step's order and inputs, and the no-fallback merge base. The cursor-approve, cursor-review, workflow-pins and public-repo-hygiene suites pass, and so does fetch-history-test.sh. actionlint and zizmor show no new findings.

Risk: the axis agent's git log/blame now reaches at least 100 commits back from the head and base, and always past the merge base, but no longer the full history. That's the same trade-off #433 made for the panel.

🤖 Generated with Claude Code

Both PR-head checkouts in cursor-axis-base.yml (the Cursor `axis` job and
`axis-direct`) cloned every branch and tag with fetch-depth: 0, which took
1.5-10 minutes per axis on a large monorepo caller, often longer than the
review itself. Only the merge base needs history.

- Check out commit_sha at depth 1, then run the shared
  scripts/check-pr-size/fetch-history.sh (already used by cursor-review's
  diff-size job and pr-size.yml) to fetch BASE_SHA and commit_sha back to a
  merge base it can vouch for, failing the job with an ::error:: otherwise.
- Render prompt resolves merge-base(BASE_SHA, commit_sha) with no fallback,
  instead of merge-base(origin/<base_ref>, commit_sha) falling back to
  BASE_SHA. origin/<base_ref> no longer exists in a narrowed checkout; the
  result is the same commit unless the base branch has since absorbed the
  PR's own commits, and it now matches the compare API the no-checkout axes
  use.
- New test_axis_checkout.py pins depth 1, the fetch step's order and inputs,
  and the no-fallback merge base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wei-hai wei-hai added cursor-review Multi-model cursor review agent-coded Authored by the agent-work loop labels Oct 29, 2026
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

Or wait 44 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 582fae3a-1550-457d-806b-7857ad22b846
Commits

Reviewing files that changed from the base of the PR and between e760909 and 4c42879.

Files selected for processing: 2
  • .github/cursor-approve/prompt-common.md
  • scripts/check-pr-size/fetch-history.sh

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ad229d47-0c54-4c9f-8d15-6c113f9b468b
Commits

Reviewing files that changed from the base of the PR and between e3bc077 and e760909.

Files selected for processing: 4
  • .github/cursor-approve/tests/test_axis_checkout.py
  • .github/workflows/cursor-axis-base.yml
  • docs/callers/cursor-approve.md
  • scripts/check-pr-size/fetch-history.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Both Cursor axis runner jobs now use depth-1 checkouts and fetch history through fetch-history.sh. Prompt rendering computes the merge base from the pull request base and commit SHAs. Tests, caller documentation, and a shared-script comment are updated.

Changes: Cursor axis checkout

Layer / File(s) Summary
Fetch merge-base history
.github/workflows/cursor-axis-base.yml, scripts/check-pr-size/fetch-history.sh, docs/callers/cursor-approve.md, .github/cursor-approve/tests/test_axis_checkout.py
Both runner jobs use depth-1 checkouts and fetch history using the pull request base SHA, head SHA, and GitHub token. The documentation and shared-script comment are updated. Tests check checkout settings, fetch ordering and inputs, and the checkout gate.
Compute merge base for rendering
.github/workflows/cursor-axis-base.yml, .github/cursor-approve/tests/test_axis_checkout.py
Both prompt-rendering steps compute the merge base from BASE_SHA and COMMIT_SHA. They no longer use origin/$BASE_REF or fall back to BASE_SHA. Tests check the merge-base command and the absence of that fallback.

Sequence Diagram(s)

sequenceDiagram
  participant Runner as Cursor or direct runner
  participant Checkout as Checkout step
  participant Fetch as fetch-history.sh
  participant Prompt as Prompt rendering
  Runner->>Checkout: Checkout PR head with fetch-depth 1
  Checkout->>Fetch: Pass base SHA, head SHA, and GitHub token
  Fetch-->>Runner: Fetch merge-base history
  Runner->>Prompt: Pass BASE_SHA and COMMIT_SHA
  Prompt->>Prompt: Compute merge base
Loading

Suggested reviewers: mattmillerai

Priority: Pending latest changes

Merge Risk: Minimal · previous review e7609

No merge-blocking issue is established from the available evidence.

Pre-merge checks: Passed 2
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

…header

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Cursor Review — Consolidated panel

Triggered by @wei-hai.

Found 2 finding(s).

Severity Count
🟢 Low 2

Panel: 6/6 reviewers contributed findings.

Comment thread .github/workflows/cursor-axis-base.yml Resolved
Comment thread .github/workflows/cursor-axis-base.yml Resolved
…ndary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wei-hai
wei-hai merged commit ef94b5d into main Oct 29, 2026
9 checks passed
@wei-hai
wei-hai deleted the wei/axis-checkout-shallow branch October 29, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-coded Authored by the agent-work loop cursor-review Multi-model cursor review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants