Skip to content

merge-compile-guard: its gh reads skip the gh guard's repeat throttle; a slow GitHub says so; a missing compile names the fleet compile-check - #23824

Merged
teamleaderleo merged 4 commits into
feat-cmux-nextfrom
lane-host/guard-gh-throttle
Oct 21, 2026
Merged

teamleaderleo merged 4 commits into
feat-cmux-nextfrom
lane-host/guard-gh-throttle

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

What

scripts/ci/merge_compile_guard.py (the merge-compile-guard PreToolUse hook):

  1. Its gh reads skip the gh PATH guard's repeat throttle. Every gh call the guard makes sets CMUX_GH_GUARD_DISABLE=1. The cmux-ci client calls are unchanged.
  2. A slow or failing read says so. Each call keeps its 15 s timeout, inside the guard's 100 s budget. The refusal now names the read that timed out or failed, for example could not read #N from GitHub (\gh api repos/...` did not answer within 15 s). Before, it blamed a rate limit every time. CMUX_MERGE_GUARD_GH_TIMEOUT` can only lower the timeout; tests use it.
  3. A missing compile result names the fleet compile-check first. When the head has no checks, its Release compile is queued or running, or routing hasn't created it yet, the refusal leads with cmux-ci compile-check --ref <full head sha> --app on the fleet dev-build workers, as COMMON.md says. The Release compile state follows in parentheses.

Why

Lanes were refused merges of #23611 (head f397fb8) three times with "could not read #23611 from GitHub", while the REST quota was fine. palette-audit measured the cause:

  • The hook runs with the session's CLAUDE_SESSION_ID.
  • The gh on cosmic-gray's PATH is ~/.local/lib/cmux-local-build-guards/gh, which sleeps up to 30 s when the same caller repeats an identical read within 30 s.
  • A lane's gh pr view N followed by the merge made the hook repeat that read, the wrapper slept 11-30 s, and the 15 s timeout ran out.

The guard reads once per merge and never polls, so the anti-polling throttle doesn't apply to it (deputy-2's decision). The wrapper stays as it is for agents. HQ's require-cmux-guards got the same bypass in hq#2830.

Tests

tests/test_merge_compile_guard.py, written first (a187dba, red on the old guard: 2 failures, 1 error):

  • A fake gh sleeps 30 s unless CMUX_GH_GUARD_DISABLE=1. A merge after a green compile must go ahead in under 10 s. On the old guard this reproduced the exact refusal the lanes saw.
  • A fake gh that is really slow, with the timeout lowered to 1 s: the refusal says it "did not answer within 1 s" and doesn't mention a rate limit.
  • No checks, a queued compile and routing not yet done each name cmux-ci compile-check --ref <full head> --app and "fleet dev-build workers" before the Release compile.

On cmux16 at 68a0d52, 47 tests pass under Python 3.13 and under the system /usr/bin/python3 3.9.

Agent session: cosmic-gray

🤖 Generated with Claude Code


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


Summary by cubic

Fixes the merge-compile-guard hook so slow GitHub reads no longer block merges with a misleading rate-limit error, and a missing compile result points to the fleet compile-check.

Changes

  • The guard's gh reads set CMUX_GH_GUARD_DISABLE=1 to skip the PATH guard's 30 s repeat throttle; a lane's own gh pr view N previously made that wrapper sleep and timeout, refusing merges of Files: free space read through a seam; a 0 reading is unknown, not a full disk #23611 despite a fine REST quota.
  • Refusals now name the read that timed out or failed — `gh api repos/...` did not answer within 15 s — instead of always blaming a rate limit.
  • Each read clears the previous failure cause, so a later unreadable read isn't blamed for an earlier one.
  • When a head has no compile result, the refusal leads with cmux-ci compile-check --ref <full sha> --app on the fleet dev-build workers, built from its parts so it reads correctly with multiple Swift files or paths containing " and ".
  • CMUX_MERGE_GUARD_GH_TIMEOUT lowers the per-call timeout; the 100 s budget stays.

Written for commit 5ee321e. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 2 commits October 21, 2026 15:59
…rottle, a slow GitHub says so, a missing compile names the fleet compile-check (red)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; a slow GitHub says so; a missing compile names the fleet compile-check first

The hook shares the session's CLAUDE_SESSION_ID, so after a lane's own
gh pr view N the PATH guard (cmux-local-build-guards/gh) held the hook's
identical read up to 30 s and merges of #23611 were refused as unreadable
(measured by palette-audit). The guard reads once per merge and never polls:
its gh calls set CMUX_GH_GUARD_DISABLE=1. Each call stays bounded (15 s, under
a 100 s budget); a refusal now names the read that timed out or failed
instead of blaming a rate limit. With no compile result on the head the
refusal leads with cmux-ci compile-check on the fleet dev-build workers
(COMMON.md), not with waiting on the Mac Release compile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teamleaderleo teamleaderleo added the risk:low Risk tier (docs/ci/risk-tiers.md) label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 5ee321e: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr23824 -f ref=lane-host/guard-gh-throttle -f platform=macos -f backend_mode=local

@github-actions github-actions Bot added risk:normal Risk tier (docs/ci/risk-tiers.md) and removed risk:low Risk tier (docs/ci/risk-tiers.md) labels Oct 21, 2026
@blacksmith-sh

blacksmith-sh Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)/
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)
View Logs

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

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

cmux-next guards / cmux-next localization debt ratchet is red on 16 of 16 fresh feat-cmux-next PR heads in the last 2:00:00, so it is most likely a base red, not this PR's. The base-reds lane has it; a base merge picks up the fix once it lands.

teamleaderleo and others added 2 commits October 21, 2026 16:19
…e with several Swift files; a refusal names its own read's cause (red)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arts; each read clears the last cause

Review of #23824: splitting the refusal on ' and ' cut inside '(A.swift and
more)' for any PR with two Swift files. A cause left by an earlier read (a
fleet read for the previous target) no longer names a later unreadable PR.

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

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-6x4j9 created for this PR by the cmux coordinator.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

cmux-next guards / nightly-guards / workflow-guard-tests / release-notary is red on 12 of 15 fresh feat-cmux-next PR heads in the last 2:00:00, so it is most likely a base red, not this PR's. The base-reds lane has it; a base merge picks up the fix once it lands.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by lane-host on cosmic-gray · session

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (independent subagent reviewer): SHIP at 5ee321e

@teamleaderleo
teamleaderleo merged commit 5570969 into feat-cmux-next Oct 21, 2026
@teamleaderleo
teamleaderleo deleted the lane-host/guard-gh-throttle branch October 21, 2026 23:34
@github-actions

Copy link
Copy Markdown
Contributor

The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/39694348750 at 7f75f49 failed: cmux-next fast tier.
Those jobs last passed at 3cd9d4f. This pull request is one of 2 merged since: #23824, #23805.
If the failure is in your change, fix forward on feat-cmux-next. Pull requests run only the tiers their paths reach (docs/ci/cmux-next-tiers.md); label a batch PR full-ci to run them all before merging.

@github-actions

Copy link
Copy Markdown
Contributor

The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/39694828930 at 5a17c63 failed: cmux-next fast tier.
Those jobs last passed at 3cd9d4f. This pull request is one of 4 merged since: #23824, #23805, #23790, #23547.
If the failure is in your change, fix forward on feat-cmux-next. Pull requests run only the tiers their paths reach (docs/ci/cmux-next-tiers.md); label a batch PR full-ci to run them all before merging.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

base-red-watch: cmux-next / cmux-next fast tier went red on feat-cmux-next in https://github.com/manaflow-ai/cmux/actions/runs/39694914716 (first red at 7f75f49, last green at 3cd9d4f). Suspect: #23824 (commit 5570969). If it is yours, fix forward on feat-cmux-next.

@github-actions

Copy link
Copy Markdown
Contributor

Shipped in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant