Skip to content

ci: match the composed producer job name so compile reuse can find a producer - #13676

Merged
teamleaderleo merged 1 commit into
mainfrom
ci/fix-reuse-producer-job-name
Sep 22, 2026
Merged

teamleaderleo merged 1 commit into
mainfrom
ci/fix-reuse-producer-job-name

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

What

Both compile-reuse lookups identify the producing job by exact GitHub job name. They stopped matching anything on 2026-09-21 and have been dead since.

scripts/ci/find_admitted_build.py:66       job["name"] == ADMISSION_JOB
scripts/ci/reuse_app_host_products.py:306  job.get("name") == "macOS compile admission"

#13405 extracted the macOS jobs from ci.yml into the reusable ci-macos.yml, called from the macos job. GitHub reports a reusable workflow's jobs as <caller job> / <job name>, so the producer is now macos / macOS compile admission. Neither constant moved with it.

This matches the final path segment instead, so the lookup survives the job being reached directly or through any caller.

Verified, not inferred

Three CI runs created minutes before this PR:

'macos / macOS compile admission'  labels=blacksmith-6vcpu-macos-15  status=queued
'macos / macOS compile admission'  labels=blacksmith-6vcpu-macos-15  status=in_progress
'macos / macOS compile admission'  labels=blacksmith-6vcpu-macos-15  status=in_progress

Before/after the refactor:

Window Runs with a job named exactly macOS compile admission
Pre-refactor (09-21 10:00–14:00Z) 25 / 30
Post-refactor (09-22 02:29–04:58Z) 2 / 207

The two survivors are stale branches whose merge commit still carried the inline ci.yml.

Consequence: find_admitted_build.py returns None unconditionally, and reuse_app_host_products.py records producer_compile_unsuccessful for every candidate. Both reuse mechanisms are structurally dead, 100% of the time. Sampled macos-compile-admission-metrics-* artifacts agree — every successful admission reports a real ~1,015s compile with classification: "hosted fallback", and the measured reuse hit rate across ~110 successful admissions is zero.

Why this is low risk

  • Already fail-open at both call sites. The admitted step is continue-on-error: true; the reuse path records a miss reason and compiles normally.
  • Cannot smuggle in a foreign product. Reuse still revalidates product identity against GitHub's immutable Git objects (reuse_app_host_products.py:291), so a wrongly matched producer is rejected downstream.
  • Invalidates no cached product. Neither edited file is in PRODUCT_CI_INPUTS, and reaches_product() returns False for scripts/ci/* outside that set. No open PR is forced to recompile. (Deliberately not factored into a shared helper in product_input_identity.py — that file hashes itself into every product identity, so touching it would invalidate every cached product repo-wide.)

The test that should have caught this

tests/test_ci_change_areas.py fabricated the bare job name in its admission_job() fixture, so it passed against production code that could never match in reality.

The fixture now uses the composed name, and a new test derives that name from the workflows themselves — the ci.yml job whose uses: targets ci-macos.yml, plus the macos-compile-admission job's name — then asserts both lookups accept it. I confirmed it fails when either fix is reverted:

guard correctly fails on reverted code:
  find_admitted_build does not match 'macos / macOS compile admission'

That is the signal #13405 should have tripped.

Expected saving

Near zero today, by itself. In a push burst the producer arrives last: of 49 sampled runs that republished a fingerprint an earlier same-branch run had already published, zero had a predecessor whose admission concluded success, so there was nothing to reuse even with a working lookup.

What makes it pay is #13644, the macOS admission debounce, which merged today at 14:00Z and collapses those bursts into one surviving run. This PR is the prerequisite: with the debounce collapsing bursts and the lookup repaired, the ~23.7% duplicate-fingerprint pool becomes harvestable. Landing this without that measurement would be pointless; landing the debounce without this leaves the reuse path dead.

Test

test_reuse_app_host_products.py, test_app_host_test_products.py, test_ci_persistent_mac_compile.py, test_ci_workload_profiles.py, test_ci_guard_workflow_structure.py and test_ci_self_hosted_guard.sh all pass. 149 test_ci_change_areas.py cases pass; its shallow-clone cases require HEAD^1 and fail identically on main.

Related

🤖 Generated with Claude Code


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


Summary by cubic

Fixes the macOS compile producer lookup so compile reuse works again after the macOS jobs moved into a reusable workflow.

GitHub reports reusable workflow jobs as <caller job> / <job name>, so the producer is now macos / macOS compile admission; both reuse lookups compared the exact macOS compile admission name and have silently matched nothing since, leaving both reuse paths dead. They now match the final segment of the job name, which works whether the job is reached directly or through any caller.

Both call sites already fail open, so a miss just records a reason and compiles normally, and reuse still revalidates product identity downstream. The test fixture used the bare job name, which masked the regression; it now uses the composed name, and a new test derives it from the workflows themselves so a future move breaks the test instead of reuse.

Written for commit 025883e. Summary will update on new commits.

Review in cubic

…producer

Both compile-reuse lookups identify the producing job by exact GitHub job name:

  scripts/ci/find_admitted_build.py:66      job["name"] == ADMISSION_JOB
  scripts/ci/reuse_app_host_products.py:306 job.get("name") == "macOS compile admission"

On 2026-09-21 #13405 extracted the macOS jobs from `ci.yml` into the reusable
`ci-macos.yml`, called from the `macos` job. GitHub reports a reusable
workflow's jobs as "<caller job> / <job name>", so the producer is now
"macos / macOS compile admission". Neither constant moved with it, so both
comparisons stopped matching anything.

Verified against the live API rather than inferred. Three runs created within
the last few minutes:

  'macos / macOS compile admission'  labels=blacksmith-6vcpu-macos-15
  'macos / macOS compile admission'  labels=blacksmith-6vcpu-macos-15
  'macos / macOS compile admission'  labels=blacksmith-6vcpu-macos-15

and a before/after split across the refactor: 25 of 30 pre-refactor runs
carried a job named exactly "macOS compile admission"; 2 of 207 post-refactor
runs did, both on stale branches whose merge commit still had the inline
`ci.yml`.

Consequence: `find_admitted_build.py` returns `None` unconditionally and
`reuse_app_host_products.py` records `producer_compile_unsuccessful` for every
candidate, so both reuse mechanisms are dead. Sampled
`macos-compile-admission-metrics-*` artifacts agree: every successful admission
reports a real ~1,015s compile and `classification: "hosted fallback"`, with a
measured reuse hit rate of zero.

Match the final path segment instead, so the lookup survives the job being
reached directly or through any caller.

This is fail-open in both call sites already (the `admitted` step is
`continue-on-error`, and the reuse path records a miss reason and compiles), and
reuse still revalidates product identity against GitHub's immutable Git objects,
so a wrongly matched producer cannot smuggle in a foreign product.

Neither edited file is in `PRODUCT_CI_INPUTS`, and `reaches_product()` returns
False for `scripts/ci/*` outside that set, so no cached product is invalidated
and no open pull request is forced to recompile.

`tests/test_ci_change_areas.py` fabricated the bare job name, so it passed
against production code that could never match. The fixture now uses the
composed name, and a new test derives that name from the workflows themselves --
the `ci.yml` job whose `uses:` targets `ci-macos.yml`, plus the
`macos-compile-admission` job's `name` -- and asserts both lookups accept it.
Reverting either fix makes that test fail, which is the signal #13405 should
have tripped.

Tests: test_reuse_app_host_products.py, test_app_host_test_products.py,
test_ci_persistent_mac_compile.py, test_ci_workload_profiles.py,
test_ci_guard_workflow_structure.py, test_ci_self_hosted_guard.sh pass, and
149 test_ci_change_areas.py cases pass (its shallow-clone cases need HEAD^1 and
fail identically on main).

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

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 537a590d-8cbe-4f30-82b5-9b4196dfaf59

📥 Commits

Reviewing files that changed from the base of the PR and between 6b2ba6d and 025883e.

📒 Files selected for processing (3)
  • scripts/ci/find_admitted_build.py
  • scripts/ci/reuse_app_host_products.py
  • tests/test_ci_change_areas.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant