Skip to content

ci: route only the pull request's own files that main's changes reach - #14992

Closed
teamleaderleo wants to merge 1 commit into
mainfrom
ci-delta-route-own-files
Closed

teamleaderleo wants to merge 1 commit into
mainfrom
ci-delta-route-own-files

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #14987. After "merge main" into a green head, the delta step (#14659) routed diff(H1, merge): everything main gained since the pull request last synced. Main's own runs judge those files. Charging them to the pull request failed #14961 and #14960 on main's cmuxUITests/ edits. #14987 only skipped the delta when it got large.

After a merge of main, the question left for this run is whether the pull request's code works against new main. scripts/ci/delta_since_green.py now routes:

  • the pull request's own files (diff(merge^1, merge)) whose CI areas meet the areas of main's changes since H1. Areas come from detect_ci_change_areas.py, loaded from the checkout. That copy is the base's, because a pull request that edits scripts/ci/ keeps its whole diff. Its areas already include the macOS and CLI package closures.
  • plus the pull request's files that H1's run never saw: the resolution commit, a merge's edits to both sides, and a merge that kept the pull request's side of a file only main edited. Before, that last case skipped the delta.

It never routes a file that only main changed:

  • Empty intersection: nothing routes. The app still compiles (macos=true, all else off) when the pull request has app code.
  • Uncertain areas: if the router can't load or a closure can't be derived, the whole pull request diff routes, as before.

That covers #14987's size rule and its cmuxUITests/ rule, so both are removed.

ci.yml's detect step keeps diffing against merge^1. It limits the changed-file list and the -U0 diffs for cmuxTests/ and app code to the delta's files. The delta step now outputs files and compile_macos instead of base_sha. Its timeout goes from 3 to 5 minutes, because it now classifies main's changes, as the detector used to. A timeout routes the whole diff.

Does it save work in the common case?

Mostly not yet, but it no longer overcounts. Replaying #14961 (green head ff7939d5f7, merge ef8c94c28f) routes 15 of its 15 files. Before this PR, the delta routed 40 files, 25 of them main's. Main's 40 files include scripts/ci/ and .github/actions/ edits, which force every area. After a day of main that is typical, so the intersection keeps nearly the whole pull request diff. The saving shows up when main's changes since H1 stay out of the pull request's areas: web-only against app-only, docs, or a merge of a small slice of main. A follow-up could stop main's CI-policy edits from counting as every area here, since those are judged by main's runs too.

Testing

  • python3 -m unittest tests/test_ci_delta_since_green.py: 34 tests pass. New cases:
    • files in main's area route (intersect)
    • an empty intersection compiles only, or compiles nothing without app code
    • uncertain areas on either side keep the whole diff
    • a 14-file pull request against a one-file main delta that edits a UI test routes only its 12 app files, never main's file
    • the resolution commit routes
    • a kept-ours merge routes that file
    • detector_classifier reads real areas from this repository, and returns None without a router
  • tests/test_ci_change_areas.py gets three detect-step cases, run against the step script:
    • the file list is limited to the delta's files, and a file only main changed never routes
    • the changed-line diffs are limited the same way
    • an empty delta compiles only
  • I also ran the six detect-step tests in that file directly (pytest isn't installed locally); all pass.

Changelog

none

🤖 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

Changes the delta CI step so it routes only the pull request’s own files whose CI areas intersect the areas main changed since the last green head, instead of routing everything main gained. Main’s files are no longer charged to the pull request, fixing the failures caused by main’s cmuxUITests/ edits and removing the size and UI-test skip rules from #14987.

Routing details

  • Routes the pull request’s files in areas main touched, plus files the green run never saw (the resolution commit, merge edits to both sides, and kept-ours files).
  • With an empty intersection the macOS app still compiles when the pull request has app code.
  • If areas can’t be classified, the whole pull request diff routes as before.
  • ci.yml now diffs against the merge base and limits the changed-file list and changed-line diffs to the delta’s files; the delta step outputs files and compile_macos instead of base_sha.

Written for commit 9da3039. Summary will update on new commits.

Review in cubic

The delta since the last green head (#14659) routed diff(H1, merge),
which is everything main gained since the pull request last synced.
Main's own runs judge those files; charging them to the pull request
failed #14961 and #14960 on main's UI test edits, and #14987 only
skipped the delta when it got large.

What a run after "merge main" still has to answer is whether the pull
request's code works against new main. So the delta step now routes
the pull request's own files (diff(merge^1, merge)) whose CI areas,
from detect_ci_change_areas.py and its package closures, meet the areas
of main's changes since H1, plus what H1's run never saw: the
resolution commit, a merge's edits to both sides, and a merge that kept
the pull request's side of a main-only file. A file only main changed
never routes. With nothing to route the app still compiles when the
pull request has app code. Areas the router cannot tell keep the whole
diff. That subsumes #14987's size and cmuxUITests/ rules, so they go.

ci.yml keeps diffing against the merge's base and limits the file list
and the changed-line diffs to the delta's files.

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

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 13 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: 72c3d832-0aea-44a6-92d1-3b86bc088bb5

📥 Commits

Reviewing files that changed from the base of the PR and between 52c8f41 and 9da3039.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • scripts/ci/delta_since_green.py
  • tests/test_ci_change_areas.py
  • tests/test_ci_delta_since_green.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.

@github-actions

Copy link
Copy Markdown
Contributor

CI fast guards failed on 9da3039f94 (https://github.com/manaflow-ai/cmux/actions/runs/36319181295). It does not block the merge; a red guard merged into main breaks it for every open PR.

Run canonical CMUX CI guard profile

workflow-guard-tests / ci: Run canonical CMUX CI guard profile
test_an_app_host_consumer_edit_runs_a_canary_after_the_compile

Fix: the assertion above names what the guard expects; change the tree to match it.
Reproduce in seconds, no build: scripts/ci/guards-local.sh --step 'Run canonical CMUX CI guard profile'

Agents: python3 scripts/ci/guard_attribution.py fix applies the mechanical fixes locally. This comment is updated in place on each push.

@github-actions

Copy link
Copy Markdown
Contributor

CI failure attribution

CI failed on 9da3039f94 (run 36319181585 attempt 1): 1 unknown.

Job Verdict Why
guards / workflow-guard-tests / ci unknown no known signature; failed step: Run canonical CMUX CI guard profile

Not re-run automatically: guards / workflow-guard-tests / ci is not a machine failure.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Closing: replaying #14961 shows the area-intersected delta routes the same 15 files as the plain PR diff (main's scripts/ci and .github/actions edits count as every area), while adding a 90-170 s classification step to every post-merge push. #14987's simpler skip rules already stop main's files from being charged to the PR, so this doesn't earn its complexity.

@teamleaderleo
teamleaderleo deleted the ci-delta-route-own-files branch September 27, 2026 12:32
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