merge_freeze (main): read lists one bounded page per gh call, not --paginate

Merged
TE
8d ago
+75-15

Ports #26647 (feat-cmux-next) to main.

The gh quota shim refuses gh api --paginate, because it can't charge a call that makes any number of requests. On main, scripts/ci/merge_freeze.py still reads its lists that way, so the freeze read in gh-merge-green exits 2 ("freeze state unknown"), and every agent-session merge into main is refused even when no freeze is open. gh_items now asks for per_page=100&page=N with one call per page, stops at a short page, and raises past 30 pages, so a list cut short never reads as "no freeze". Main's gh() (with its fallback token) and the rate-limit retry are unchanged.

Changelog

none

Observed / Not run

  • python3 scripts/ci/merge_freeze.py check --repo manaflow-ai/cmux --pr 27221 --base main --files <changed> under the agents' gh shim: main's code fails with gh-quota: refused ... --paginate (status 2), and this head exits 0.
  • tests/test_merge_freeze.py passes 32/32: the port of #26647's pager tests, plus main's API-call expectations updated to the paged endpoints. tests/test_gh_merge_green.py and tests/test_ci_quota_hold_gate.py pass.
  • Not changed: gh-merge-green's own --paginate reads. Each one already falls back to GraphQL when refused.

🤖 Generated with Claude Code

Agent session: agent session


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Replaces gh api --paginate with bounded per-page calls in scripts/ci/merge_freeze.py, so agent-session merges into main no longer fail when no freeze is open.

The gh quota shim refuses --paginate because one invocation makes an unknown number of requests it can't charge, so the freeze read exited 2 ("freeze state unknown") and blocked every merge into main from an agent session.

Bug Fixes

  • gh_items now makes one bounded call per page (per_page=100&page=N), stops at a short page, and raises past 30 pages so a truncated list never reads as "no freeze".
  • Tests updated to cover the per-page calls and the fail-closed page cap.

Summary by CodeRabbit

  • Chores
    • Updated merge-freeze checks to retrieve GitHub results page by page, stopping when all results have been collected. The checks support up to 30 pages and report an error if GitHub returns unexpected data or the page limit is exceeded. This improves handling of larger result sets while keeping failures visible when results cannot be safely processed.