Repository navigation
Say when a failing pull_request job is testing a stale merge ref - #11386
Conversation
A pull_request run does not test the branch head. It tests refs/pull/N/merge, a merge of the branch into the base as the base stood when the run was created. GitHub does not rebuild that ref because the base later moved, and a re-run replays the same merge commit, so a fix that lands on main after a run starts stays invisible to that run until someone pushes to the branch. That cost real time today. #11372 gave three test files encoding = "utf-8" and merged at 14:35 UTC. Runs created at 13:39, 14:26 and 14:29 on #11375, #11357 and #11373 all went on failing tests/test_source_read_encoding.py on exactly those three lines, and all three were first read as defects in branches that had never touched the files. Adds .github/actions/merge-ref-age, which asks the compare endpoint how far the base branch has moved since this run's merge ref was built and prints a notice if the answer is not zero. It is wired into the two studio-backend-ci.yml jobs that run pytest, gated on failure(), so a green job never pays for it and it stays quiet when the base has not moved. It is advisory and cannot fail a job. A stale merge ref does not make a failure untrue: the merge really does fail. Deciding otherwise for the reader would be worse than the confusion it is fixing, so the script never exits non-zero and never emits ::error::. tests/studio/test_merge_ref_age_is_reported.py keeps both properties: every job in that workflow running pytest carries the step under failure(), and the action's script cannot fail the job it sits in. Each assertion was checked by reverting it individually against a green baseline. The repo's own test_workflow_guards_run_unfiltered caught the new guard missing from the unfiltered job, so it is registered in workflow-trigger-lint.yml too.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…lothai#11386) A pull_request run does not test the branch head. It tests refs/pull/N/merge, a merge of the branch into the base as the base stood when the run was created. GitHub does not rebuild that ref because the base later moved, and a re-run replays the same merge commit, so a fix that lands on main after a run starts stays invisible to that run until someone pushes to the branch. That cost real time today. unslothai#11372 gave three test files encoding = "utf-8" and merged at 14:35 UTC. Runs created at 13:39, 14:26 and 14:29 on unslothai#11375, unslothai#11357 and unslothai#11373 all went on failing tests/test_source_read_encoding.py on exactly those three lines, and all three were first read as defects in branches that had never touched the files. Adds .github/actions/merge-ref-age, which asks the compare endpoint how far the base branch has moved since this run's merge ref was built and prints a notice if the answer is not zero. It is wired into the two studio-backend-ci.yml jobs that run pytest, gated on failure(), so a green job never pays for it and it stays quiet when the base has not moved. It is advisory and cannot fail a job. A stale merge ref does not make a failure untrue: the merge really does fail. Deciding otherwise for the reader would be worse than the confusion it is fixing, so the script never exits non-zero and never emits ::error::. tests/studio/test_merge_ref_age_is_reported.py keeps both properties: every job in that workflow running pytest carries the step under failure(), and the action's script cannot fail the job it sits in. Each assertion was checked by reverting it individually against a green baseline. The repo's own test_workflow_guards_run_unfiltered caught the new guard missing from the unfiltered job, so it is registered in workflow-trigger-lint.yml too.
Three open PRs are red today for a failure that was fixed hours ago, and nothing in CI says so.
What happens
A
pull_requestrun does not test the branch head. It testsrefs/pull/N/merge, a merge of the branch into the base as the base stood when the run was created. GitHub does not rebuild that ref because the base later moved, and re-running the workflow replays the same merge commit, so a fix that lands on main after a run starts is invisible to that run until someone pushes to the branch.#11372 gave three test files
encoding = "utf-8"and merged at 14:35 UTC as 7cc58b4. These runs were created before that:tests/test_source_read_encoding.pyon the three lines #11372 fixedNone of those branches touches those files. The trap is that the jobs started at 16:06 UTC, well after the fix, so the timestamps on the job page read as if the fix should have been included.
What this adds
.github/actions/merge-ref-ageasks the compare endpoint how far the base branch has moved since this run's merge ref was built, and prints a notice if the answer is not zero:It is wired into the two
studio-backend-ci.ymljobs that run pytest, gated onfailure(). A green job never runs it, and it stays silent when the base has not moved, so it adds nothing to the common case where a failure is simply real.It asks the API rather than the clone because these checkouts are shallow and deepening them enough to hold both commits costs more than the answer is worth.
It cannot fail a job
That is the property worth stating. It runs exactly when a job is already failing, so a bug in it would land as a second, misleading error on top of the real one. The script never exits non-zero and never emits
::error::. A stale merge ref does not make a failure untrue, the merge really does fail, and deciding otherwise on the reader's behalf would be worse than the confusion this is fixing.Guard
tests/studio/test_merge_ref_age_is_reported.pykeeps both properties: every job in that workflow that runs pytest carries the step underfailure(), and the action's script cannot fail the job it sits in. It deliberately does not check the wording of the notice, since prose guards have to parse English to be right.Each assertion was checked by reverting it individually against a green baseline and confirming it failed its own case and only its own:
repo-cpu-testsfails the per-job check, naming that jobfailure()from theiffails the gating checkexit 1fails the cannot-fail check::errorfails the advisory checkThe repo's own
test_workflow_guards_run_unfilteredthen caught the new guard missing from the unfiltered job, so it is registered inworkflow-trigger-lint.ymlas well.