Repository navigation
Correct why a superseded probe matrix is expensive: slots, not minutes - #11347
Conversation
The comment #11345 landed on runner-pool-probe.yml justified cancelling by "four of them macOS at 10x the minute rate". That rate is real but it is not what this costs. These repositories are public, standard GitHub-hosted runners are free for public repositories, and every label in the probe's matrix is a standard runner, so the account's included-minutes meter reads 0 of 3,000 used and will keep reading zero no matter what this workflow does. The 3,000 included minutes apply to private repositories. The real cost is concurrency. Four of the probe's ten cells are macOS, and GitHub caps macOS at five concurrent jobs ACCOUNT-WIDE across every repository -- the same cap test_macos_slots_per_commit.py already exists to protect, and the reason it records median macOS queue waits of 245 minutes. A superseded matrix was holding four of those five slots for up to ten minutes, and the queue it delays belongs to the whole account rather than to this workflow. So the fix is unchanged and the argument for it is stronger. Only the reason is corrected, here and in the guard's docstring, because this repo already treats a workflow comment that claims something untrue as a defect worth a test: see test_no_workflow_claims_a_main_protection_it_does_not_have, written after 27 files carried a comment asserting a protection they did not have.
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e40231fda
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # than minutes. A superseded matrix was holding four of those five for up to ten minutes, | ||
| # and the queue it delays is the whole account's, not this workflow's. |
There was a problem hiding this comment.
Base the slot-cost claim on actual job duration
For successful probe runs, each macOS cell executes only the single echo below and releases its runner immediately afterward; timeout-minutes: 10 is merely the cutoff for a hung job, not its expected slot occupancy. Presenting ten minutes as the cost of a superseded matrix therefore materially overstates the normal concurrency impact that this comment is intended to document; use the observed probe duration or describe ten minutes explicitly as the failure-case upper bound.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it was the same mistake twice: a plausible number nobody had measured. Fixed with measurements.
A probe cell holds its runner for about five seconds, because the whole job is one echo. Measured over the 16 macOS cells of the last four successful dispatches: median 4s, longest 6s. So ten minutes overstated the normal case by two orders of magnitude, and it is now stated only as what it is, the cutoff for a cell that hangs.
The cost is the queue, not occupancy. Those same 16 cells waited a median of 15 minutes to start and one waited just over 3 hours, and a superseded matrix sits in that account-wide macOS queue ahead of work that matters. The superseded dispatch that prompted this one (run 35479952768) sat there 5 minutes 9 seconds before the newer push cleared it.
Added tests/studio/test_probe_cost_claim_is_measured.py, since this is now the second wrong cost this comment has carried. It reads timeout-minutes out of the workflow and fails if that value appears as a duration in any sentence that does not name it as the timeout, fails if the timeout stops being explained as the hung-cell bound, and fails if the occupancy claim loses either its seconds figure or its provenance.
Sabotage-verified one at a time: restoring the original wording fails the first, removing the timeout explanation fails the second, and dropping either the seconds or the words measured/median from the occupancy sentence fails the third. The third one initially passed its own sabotage by matching the queue figures further down, so it now reads from the sentence that makes the claim. Also wired into workflow-trigger-lint's unfiltered list, as it reads a workflow file. 34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06b900661e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # Cited as the cutoff it is, rather than as an occupancy, is fine. | ||
| if re.search(r"timeout|hang|hung|cutoff", sentence, re.I): | ||
| continue |
There was a problem hiding this comment.
Reject mixed sentences that still equate timeout with occupancy
If the rationale says something like Although the timeout is the cutoff for hangs, a superseded matrix holds its runners for ten minutes, this branch discards the entire sentence merely because it contains timeout or hang, even though it reinstates the exact false occupancy claim this guard is intended to catch. The remaining tests can still pass when the existing measured-seconds wording is retained nearby, so restrict the exemption to durations actually described as the hung-cell cutoff rather than exempting every matching duration in the sentence.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, the sentence was the wrong unit, in both directions: it lets a concession elsewhere excuse the claim, and it lets the excusing words sit far enough away to mean nothing about the number they are excusing.
Now judged per occurrence, on what the occurrence is attached to. A verb of occupancy in the window around the duration (hold, holds, holding, held, occupy..., tie up) condemns it outright, whatever else the sentence concedes. Only then is the cutoff reading considered, and it has to be adjacent to that duration rather than anywhere in the sentence.
Sabotage-verified with your exact example: appending "Although the timeout is the cutoff for a hang, a superseded matrix holds its runners for ten minutes" now fails the guard, where it passed before. Three more: the original "was holding four of those five for up to ten minutes" fails, a bare "costs ten minutes of the pool" with no exempting words fails, and a legitimate "a cell that hangs is cut off at ten minutes" stays green. 34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b75b36a711
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| claim = rationale[holds.start() : holds.start() + 300] | ||
| assert re.search(r"\b(\d+\s*s\b|\d+\s*seconds?\b|five seconds)", claim, re.I), ( |
There was a problem hiding this comment.
Bind the measured duration to the hold claim
If the lead claim is changed from holds it for about five seconds to holds it for about five minutes while the following measurement (median 4s) remains, all four guards still pass: this 300-character slice finds both 4s and measured later even though the duration attached to holds is now wrong. This is fresh evidence beyond the per-occurrence timeout fix; inspect the duration and measurement attached to the hold claim itself so the guard catches the exact occupancy regression it is intended to prevent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed. The unit on that duration is the entire claim, and a window check cannot see it.
The guard now parses the claim instead of searching near it: 'holds ... for ', with the unit required to be seconds. A stale 'median 4s' further along no longer rescues anything, because the value being checked is the one the verb governs. Provenance is read to the end of that same sentence rather than from a fixed slice, so 'measured' or 'median' has to belong to this claim.
Sabotage-verified with your exact case: swapping 'about five seconds' for 'about five minutes' while leaving 'median 4s and longest 6s' in place now fails, where all four guards passed before. Two more: removing the measurement clause from the claim's sentence fails, and replacing the whole claim with 'A cell is cheap to run.' fails rather than passing on the queue figures below.
That is twice now this test passed its own sabotage by matching something adjacent, so both fixes are recorded in the docstring. 34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3888fa9be5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| window = rationale[max(0, match.start() - 90) : match.end() + 40] | ||
| # Attached to a verb of occupancy: that is the false claim, whatever else the | ||
| # sentence concedes elsewhere. | ||
| if re.search(r"\b(hold|holds|holding|held|occup\w*|tie[sd]? up)\b", window, re.I): | ||
| offenders.append(window) |
There was a problem hiding this comment.
Bind occupancy verbs to the duration they govern
Fresh counterexample after the per-occurrence change: an accurate rationale such as A cell holds a runner for five seconds; timeout-minutes is a cutoff at ten minutes if hung is rejected because holds appears anywhere in the 90-character window before ten minutes. The occupancy verb governs the five-second duration, not the timeout, so this proximity check can make CI fail on a truthful rewording; parse the relationship to the matched duration rather than treating every nearby occupancy verb as attached.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, and that is the mirror of the previous one: a sentence was too coarse in one direction, proximity is too coarse in the other. Failing CI on a true comment is the worse of the two.
The occupancy verbs and the durations they govern are now parsed with the same pattern the other test uses, and only a duration a verb actually governs is condemned. Your example stays green: in 'a cell holds a runner for five seconds; timeout-minutes is a cutoff at ten minutes if hung' the verb governs the five, so the ten is judged on its own and passes because it is named as the cutoff where it stands. The clause boundary is respected too, since the pattern will not reach across a semicolon.
Verified both directions rather than just the one you raised. Still caught: the mixed sentence from your earlier note, and the original 'was holding four of those five for up to ten minutes' (the hedges up to, at most and as much as are now part of the pattern, so that phrasing no longer slips past). Now correctly green: your five-seconds-then-cutoff rewording.
| unit = claim.group("unit") | ||
| assert _SECONDS.match(unit), ( | ||
| f"the occupancy claim is {claim.group('value')} {unit}: {claim.group(0)!r}. A " | ||
| f"cell runs one echo and was measured at four, so anything but seconds here is " | ||
| f"the overstatement this guard exists to catch" |
There was a problem hiding this comment.
Validate the numeric occupancy estimate
Fresh evidence beyond the unit-binding fix: changing the claim to holds it for about 600 seconds, because ... measured ... median 4s still passes, since the test checks only that the unit is seconds and that the sentence contains measured or median; it never compares claim.group('value') with the reported measurement. This permits the same orders-of-magnitude overstatement the guard is meant to prevent as long as it is expressed in seconds, so the claimed value should be parsed and checked against the attached measured summary.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct: seconds was necessary and not sufficient, and 600 of them is the original overstatement wearing the right unit.
The claim's value is now read off the claim and compared with the median the same sentence reports. The sentence has to carry a median at all, since saying a figure was measured without giving the measurement leaves nothing to check against, and the two have to agree within 3x either way. That leaves room for honest rounding (the comment says about five against a measured four) without leaving room for an order of magnitude.
Sabotage-verified: 'about 600 seconds' with 'median 4s and longest 6s' still behind it now fails, where it passed before. 'about five minutes' still fails on the unit. Removing the median from the sentence fails. And the accurate wording passes at 5 against 4.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b67634cd2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| three of those holes were found by sabotaging this test, in that order. | ||
| """ | ||
| rationale = _rationale() | ||
| claim = _HOLD_CLAIM.search(rationale) |
There was a problem hiding this comment.
Validate every parsed occupancy claim
When the rationale retains the current measured sentence but later adds a contradictory claim such as A superseded matrix holds its runners for about 600 seconds, all four guards still pass because _HOLD_CLAIM.search validates only the first match; the timeout test also ignores the later claim because its duration is not the configured ten-minute timeout. Iterate over every hold claim so a correct first sentence cannot mask the same unmeasured overstatement elsewhere in the rationale.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, search only validated the first one, and a correct opening sentence was enough to mask anything added after it. Now iterated over every claim.
Fixing that surfaced a false positive I had to fix with it. Requiring each claim to carry its own median rejected a true restatement, and exempting the hung case on the whole sentence would have reopened the mixed-sentence hole from earlier. Both come down to which clause the qualification sits in, so that is what is parsed now: the clause between the last boundary and the verb. 'A cell that hangs holds its runner for ten minutes' is exempt because the hang qualifies the subject of the hold; 'although the timeout is the cutoff for a hang, a superseded matrix holds its runners for ten minutes' is not, because it does not.
The rule is now: the comment has to report a median, at least one claim has to carry that median in its own sentence, and every claim has to agree with it within 3x. Restating a measured figure without repeating the provenance stays legal, since what is being guarded against is an unmeasured number rather than a second mention of a measured one.
Sabotage matrix, nine cases, all behaving:
Must fail, and do: your 600-second later claim, a later claim in minutes, the mixed sentence, the original 'for up to ten minutes', 600 in the main claim, the median removed, and a comment that says only what a hung cell holds.
Must pass, and do: 'a cell that hangs holds its runner for ten minutes before the timeout ends it', and the five-seconds-then-cutoff rewording.
34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ba20532dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| r"(?P<value>\d+|one|two|three|four|five|six|seven|eight|nine|ten)\s*" | ||
| r"(?P<unit>seconds?|s\b|minutes?|mins?\b|hours?|hrs?\b)", |
There was a problem hiding this comment.
Parse spelled-out occupancy values above ten
Fresh counterexample after iterating over every parsed claim: if the rationale retains the current measured sentence but later adds A superseded matrix holds its runners for fifteen minutes, all four guards still pass. _HOLD_CLAIM recognizes digits and number words only through ten, while the timeout test considers only the configured ten-minute duration, so this minute-scale overstatement is never parsed despite test_every_occupancy_claim_is_a_measured_one claiming to validate every occupancy claim. Accept the other supported number words—or fail when an occupancy-duration form cannot be parsed—so spelling the value out cannot bypass the guard.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, and matching against a list of numbers this file happens to know was the wrong design rather than a list that needed extending. A list is a spelling contest the comment wins.
Inverted it: the pattern now recognises the FORM of an occupancy duration, with the value matched as any word, and the number is parsed separately. A duration the parser cannot read is an outright failure with a message saying to use digits or extend the table, so spelling a value out gets louder rather than quieter. The known words go up to ninety as well, which covers the ordinary cases without the list being load-bearing any more.
Sabotage-verified, eight cases.
Must fail, and do: your 'for fifteen minutes', 'for ninety seconds' (parseable, spelled out, still 20x the measurement), 'for umpteen minutes' (unreadable), 'about 600 seconds', and the original 'for up to ten minutes'.
Must pass, and do: 'a cell that hangs holds its runner for fifteen minutes before the timeout ends it', the five-seconds-then-cutoff rewording, and a hedged restatement like 'holds its runner for no more than six seconds' (the hedges no more than, at least, nearly, approximately, over and under are recognised, so an ordinary rewording does not read as an unparseable value).
34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18821511b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| def _about_a_hung_cell(text: str, position: int) -> bool: | ||
| return bool(re.search(r"hang\w*|hung", _clause_before(text, position), re.I)) |
There was a problem hiding this comment.
Require a positive hung-cell qualification
A fresh counterexample to the clause parser is A non-hung cell holds its runner for ten minutes: _about_a_hung_cell treats the raw substring hung as proof that the subject is a hung cell, so both the timeout check and the measured-occupancy check exempt this explicitly non-hung claim. With the existing accurate sentence retained, all four new guards pass despite reinstating the false ten-minute occupancy assertion; detect a positive hanging qualifier rather than any occurrence of hang/hung.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, a substring is not a qualification. 'non-hung' contains 'hung' and was reading as proof of the opposite of what it says.
The exemption now needs a positive hanging qualifier. The word boundary excludes a preceding hyphen, so 'non-hung' no longer matches at all, and an explicit negation anywhere before the word in the same clause disqualifies it, which covers 'is not hung' and 'never hangs' as well.
Sabotage-verified, eight cases.
Must fail, and do: your 'A non-hung cell holds its runner for ten minutes', 'a cell that is not hung holds...', 'a cell that never hangs holds...', the mixed sentence, 'for fifteen minutes', and the original 'for up to ten minutes'.
Must pass, and do: 'a cell that hangs holds its runner for ten minutes before the timeout ends it', and the shorter 'a hung cell holds its runner for ten minutes'.
34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f73aaa3266
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # FORM is recognised here and the number is parsed separately, and a duration that cannot | ||
| # be parsed fails rather than going unseen. | ||
| _HOLD_CLAIM = re.compile( | ||
| r"\b(?:hold\w*|occup\w*|tie[sd]?\s+up)\b[^.;]{0,80}?\bfor\s+" |
There was a problem hiding this comment.
Recognize past-tense occupancy claims
The parser omits the irregular past tense held, so retaining the current measured sentence and adding A superseded matrix held its runners for 600 seconds passes all four guards: this expression does not produce a claim, and the timeout check only examines the configured ten-minute duration. Include held in the occupancy forms so a natural past-tense restatement cannot bypass the test that promises to validate every occupancy claim.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, hold\w* covers holds, holding and holder but not the irregular past. 'held' is now one of the occupancy forms.
Sabotage-verified: 'A superseded matrix held its runners for 600 seconds' now fails on the magnitude, and 'held its runners for ten minutes' fails on both guards, where each passed before.
| clause = _clause_before(text, position) | ||
| hangs = _HANGS.search(clause) | ||
| if not hangs: | ||
| return False | ||
| return not _NEGATED.search(clause[: hangs.start()]) |
There was a problem hiding this comment.
Bind the hanging qualifier to every holder
This treats any positive hang word before the occupancy verb as qualifying the entire subject. For example, with the existing accurate rationale retained, One hanging cell and one working cell each hold a runner for ten minutes passes all four guards even though it explicitly makes the false ten-minute claim about a working cell. Require the hanging qualifier to cover every holder governed by the claim rather than exempting a mixed subject when any one member is hanging.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. A qualifier that covers one member of a subject cannot excuse a claim made about all of them.
The exemption is now refused when the clause carries a second holder: a coordinating conjunction, a distributive (each, both, either), or an explicitly non-hanging one (working, healthy, normal, successful). A genuine qualification is a short phrase like 'a cell that hangs' or 'a hung cell', and neither trips that.
Sabotage-verified: your 'One hanging cell and one working cell each hold a runner for ten minutes' now fails both guards, while 'a cell that hangs holds its runner for ten minutes before the timeout ends it' and 'a hung cell holds its runner for ten minutes' both stay green.
Eight cases run in total across this and the past-tense fix, including the earlier non-hung, fifteen-minutes and original-wording regressions. 34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf2be28902
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # really does is sit in the account-wide macOS queue ahead of work that matters, and the | ||
| # queue is where the time goes: those same 16 cells waited a median of 15 minutes to start, | ||
| # and one waited just over 3 hours. The superseded dispatch that prompted this sat there | ||
| # 5 minutes 9 seconds before the newer push cleared it. |
There was a problem hiding this comment.
Do not count a probe's queue wait as delay it imposed
These 15-minute and 3-hour measurements describe how long the probe itself waited for capacity, not how long it delayed other work: a queued cell occupies no concurrency slot, and once capacity becomes available its marginal delay to a later job is bounded by its measured 4–6-second execution. Presenting the probe's own queue age as the cost of leaving a superseded dispatch queued therefore repeats the same cost-model error in a different metric; measure the start-time impact on jobs behind it or describe the avoided cost as the eventual few seconds of occupancy.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is the important one, and you are right. A queued cell holds no slot, so the probe's own queue age is not delay it imposed on anything. I had replaced an inflated cost with a different inflated cost.
Rewritten to say what is actually true, including that the saving is small: a superseded matrix that is still waiting costs nothing until it is dispatched, and what it then takes from the job behind it is those few measured seconds, four times over. The reason to cancel anyway is that the saving is free, not that it is large.
The 15-minute median and the 3-hour outlier are still there, but now labelled as the probe's OWN waits and offered as evidence that macOS capacity is scarce, with an explicit note that they are not delay it imposed, since that is the conflation this comment has now made twice.
| r"(?P<value>[\w-]+)\s*" | ||
| r"(?P<unit>seconds?|s\b|minutes?|mins?\b|hours?|hrs?\b)", |
There was a problem hiding this comment.
Reject multi-word spelled-out occupancy values
Fresh evidence beyond the prior single-word spelling fix: retaining the current rationale and adding A superseded matrix holds its runners for six hundred seconds still lets all four guards pass. Because value accepts only one token immediately followed by the unit, this claim produces no _HOLD_CLAIM match at all rather than reaching the promised unreadable-value failure, while the existing accurate claim keeps claims nonempty; recognize multi-token numeric forms or fail any otherwise-shaped occupancy duration.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it failed in the quiet direction: a single-token value meant 'six hundred seconds' produced no match at all, so the unreadable-value failure never fired.
The value is now up to three tokens, matched lazily so 'five seconds' is not split into 'five second' plus a stray 's', and summed with hundred and thousand as multipliers. The hedges the, full, entire and whole are recognised too, so a phrasing like 'for the full ten minutes' reads as a duration rather than as an unparseable value.
Sabotage-verified, eight cases.
Must fail, and do: your 'six hundred seconds', 'twenty five minutes', 'one thousand seconds', 'held its runners for 600 seconds', and the mixed subject.
Must pass, and do: the true hung-cell hold, 'holds its runner for no more than six seconds', and 'a hung cell holds its runner for the full ten minutes'.
34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c71dcd1949
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| f"form 'holds it for <duration>'. Without that the timeout is the only occupancy " | ||
| f"figure in the comment, which is the reading this whole guard exists to prevent" | ||
| ) | ||
| measured = _MEASURED.search(rationale) |
There was a problem hiding this comment.
Compare the claim against its attached median
Fresh evidence beyond the earlier same-sentence fix: if an unrelated metric earlier in the rationale says median 500s, while the occupancy sentence says holds ... for 500 seconds ... median 4s, all four guards pass. This global search selects 500 as observed, while grounded only verifies that some median exists in the claim's sentence, so the claim is never compared with its attached 4-second measurement; derive the observed value from the grounded sentence instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, and it was wrong in both directions: a global median could be picked as the yardstick for a claim it has nothing to do with, so a 500-second claim beside its own 'median 4s' measured as consistent, and equally an unrelated 'median 500s' could fail a comment that was entirely true.
The yardstick now comes from a grounded claim, meaning one whose own sentence carries the median, and every claim is compared against that.
Verified against the previous head to show the difference rather than just asserting it. With the claim changed to 'holds it for about 500 seconds' beside its own 'median 4s and longest 6s', and an unrelated 'A queue sample reported median 500s.' earlier in the comment: the previous head passed all four guards, this one fails. And with only the unrelated median added and the claim left correct, this one passes, where the previous head failed it.
| offenders.append(window) | ||
| continue | ||
| # Otherwise it passes only if named, right here, as the cutoff it is. | ||
| if not re.search(r"timeout|hang\w*|hung|cutoff", window, re.I): |
There was a problem hiding this comment.
Bind bare timeout mentions to their own clause
Fresh evidence after adding the per-occurrence occupancy parser: placing A superseded matrix costs ten minutes immediately after the accurate timeout sentence still passes every guard. Since costs is not an occupancy verb, this branch handles the duration and accepts it merely because timeout, hang, or cutoff occurs somewhere in the surrounding 90-character window, allowing the false cost claim to borrow its qualification from the preceding clause; inspect the clause governing this duration instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. That branch was still reading a 90-character window while the occupancy branch beside it had already moved to clauses, so a bare claim could borrow its excuse from the clause in front of it.
It now reads the clause that governs the duration, the same unit the rest of the guard uses.
Sabotage-verified: your 'A superseded matrix costs ten minutes' placed straight after the accurate timeout sentence now fails, where it passed before. 'timeout-minutes is a cutoff at ten minutes if hung' and 'a cell that hangs holds its runner for ten minutes before the timeout ends it' both stay green, and the original 'for up to ten minutes' and the mixed subject still fail.
34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 167c3c049f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| _HOLD_CLAIM = re.compile( | ||
| r"\b(?:hold\w*|held|occup\w*|tie[sd]?\s+up)\b[^.;]{0,80}?\bfor\s+" | ||
| r"(?:about\s+|roughly\s+|around\s+|nearly\s+|almost\s+|approximately\s+|" | ||
| r"up\s+to\s+|at\s+least\s+|at\s+most\s+|no\s+more\s+than\s+|over\s+|under\s+|" | ||
| r"the\s+|full\s+|entire\s+|whole\s+|" | ||
| r"as\s+(?:much|long)\s+as\s+|~\s*)*" | ||
| r"(?P<value>[\w-]+(?:\s+[\w-]+){0,2}?)\s*" | ||
| r"(?P<unit>seconds?|s\b|minutes?|mins?\b|hours?|hrs?\b)", |
There was a problem hiding this comment.
Parse slot-blocking occupancy verbs
Fresh counterexample after adding held: retaining the measured sentence and appending A superseded matrix blocks four runners for 600 seconds still passes all four guards. _HOLD_CLAIM recognizes only hold/held/occupy/tie-up forms, and the timeout guard ignores 600 seconds, so natural slot-cost verbs such as blocks, reserves, or consumes can bypass the test that promises to validate every occupancy claim; recognize these slot-duration forms or fail when they cannot be parsed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. The verb list was as narrow as the number list was, and for the same reason.
blocks, reserves, consumes, keeps, kept, takes, took and uses are now occupancy forms alongside hold, held, occupy and tie up.
Sabotage-verified: 'blocks four runners for 600 seconds', 'reserves four runners for 600 seconds', 'keeps four runners for 600 seconds' and 'consumes four runners for ten minutes' all fail now, where each passed before, while the legitimate phrasings stay green.
| if not re.search( | ||
| r"timeout|hang\w*|hung|cutoff", _clause_before(rationale, match.start()), re.I | ||
| ): |
There was a problem hiding this comment.
Reject negated hang excuses for bare timeout claims
The positive-hang check is applied only to parsed occupancy claims; this fallback accepts any raw hang substring in the duration's clause. Consequently, retaining the current rationale and appending A superseded working matrix that never hangs costs ten minutes passes every guard even though it reinstates the false timeout-as-cost claim. Apply the same positive, non-negated hanging qualification here rather than treating never hangs as an excuse.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it was an inconsistency I introduced: the occupancy side moved to a positive, non-negated qualification and this fallback was left on a raw substring.
Both now go through the same rule, extended to cover timeout and cutoff as well as hanging: the word has to be there and must not be denied earlier in the clause.
Sabotage-verified: your 'A superseded working matrix that never hangs costs ten minutes' now fails, as does the bare 'A superseded matrix costs ten minutes'. 'timeout-minutes is a cutoff at ten minutes if hung' and 'a cell that hangs holds its runner for ten minutes before the timeout ends it' both stay green.
Separately, the red pre-commit.ci on this PR was not this branch: main itself stopped being a fixed point of its own formatting hook, from #11370. Reproduced with the pinned ruff on a clean checkout of main, and fixed in #11371. I have merged main in here so this branch picks it up.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1799d618c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| window = rationale[rationale.index("timeout-minutes") :][:400] | ||
| assert re.search(r"hang|hung|cutoff", window, re.I), ( |
There was a problem hiding this comment.
Reject negation in the timeout-bound explanation
The independent “still explained” guard accepts raw hang/cutoff substrings without checking whether they are negated. Fresh evidence beyond the fixed bare-duration fallback: replacing the current sentence with `timeout-minutes` below is not the cutoff for a cell that HANGS makes all four tests pass, even though the rationale now explicitly denies the invariant this test promises to preserve. Apply the same positive, non-negated qualification used by _names_the_cutoff here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, and fixing it properly took two corrections rather than one, because my first attempt at it still passed your case.
Reading backwards from the word was not enough: 'is not the cutoff for a cell that HANGS' puts the denial after the noun it denies. A negation anywhere in the clause now disqualifies it, in all three guards.
Then the guard was still vacuous, for a reason I only found by sabotaging it: the key itself is 'timeout-minutes', which contains 'timeout', so the clause satisfied the check by naming the thing rather than explaining it. Replacing the sentence with 'below is the bound and nothing else' passed. It now reads only the text after the key.
Sabotage-verified, four cases: your negated explanation fails, 'below is the bound and nothing else' fails, 'a superseded working matrix that never hangs costs ten minutes' fails, and 'a cell that hangs holds its runner for ten minutes before the timeout ends it' stays green. 34 passed with the existing guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0452fc6d0c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| _HOLD_CLAIM = re.compile( | ||
| r"\b(?:hold\w*|held|occup\w*|block\w*|reserv\w*|consum\w*|keep\w*|kept|" | ||
| r"take[sn]?|taking|took|us(?:e|es|ed|ing)|tie[sd]?\s+up|ty(?:e|ing)\s+up)\b" | ||
| r"[^.;]{0,80}?\bfor\s+" |
There was a problem hiding this comment.
Exclude zero-slot statements from occupancy claims
Fresh counterexample after the verb-duration parser change: the truthful wording A queued cell holds no slot for ten minutes matches this pattern, so both occupancy guards reject it as though the cell occupied a runner for ten minutes. This can make CI fail on a rationale that accurately explains that queued cells consume no capacity; account for negated or explicitly zero occupancy before validating the duration.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Both of these are correct, and together they are the argument for stopping. This is the eleventh finding against a matcher that is trying to read English, and the last few have been false positives: rejecting 'A queued cell holds no slot for ten minutes', which is not only true but is the very point the comment now makes.
So I have deleted the prose parser rather than patch it again. No verb list, no clause analysis, no positive-versus-denied qualification, no subject counting. Two mechanical rules instead:
-
The timeout value is never written as a prose duration anywhere in the rationale. No exemptions. Every wrong cost this comment has carried was a prose duration that happened to equal it, and there is no phrasing that gets round a rule with nothing to argue with. The price is that a true sentence like 'a hung cell holds its runner for ten minutes' is refused too, and the docstring says so; the remedy is to write 'until the timeout', which is better prose anyway.
-
In the sentence that reports the median, every figure is in seconds and within 3x of that median.
The file is about a third of the size and the docstring states plainly what it does not do: it cannot catch an arbitrary false statement elsewhere in the comment, and no regular expression can.
| if not (_HANGS.search(clause) or _CUTOFF.search(clause)): | ||
| return False |
There was a problem hiding this comment.
Require timeout mentions to actually describe a bound
Fresh counterexample after making the check clause-local: retaining the current rationale and adding Before timeout a superseded matrix costs ten minutes lets all four guards pass. _names_the_cutoff treats any unnegated occurrence of timeout in the clause as proof that the duration is being identified as a cutoff, although this clause still presents ten minutes as the matrix's cost; validate the relationship between the timeout term and the duration rather than mere co-occurrence.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Also correct, and answered by the same rewrite: co-occurrence of 'timeout' in a clause is no longer an excuse for anything, because there are no excuses left. 'Before timeout a superseded matrix costs ten minutes' now fails on rule 1, like every other phrasing of that claim.
Sabotage matrix re-run against the simplified guard, ten cases.
Must fail, and do: the original 'for up to ten minutes', the mixed sentence, 'a non-hung cell holds its runner for ten minutes', the bare 'costs ten minutes', your 'Before timeout a superseded matrix costs ten minutes', 'about 600 seconds' in the measured sentence, 'about five minutes' in it, removing the median, and the negated explanation of timeout-minutes.
Must pass, and does: your 'A queued cell holds no slot at all', which the previous version rejected.
34 passed with the neighbouring guards.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f72c423a67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| # anyone else: the two were conflated here once already. | ||
| # | ||
| # Superseding does not weaken the measurement. The probe compares labels WITHIN one | ||
| # dispatch -- the ten cells leave the queue in the same second, and that is the only |
There was a problem hiding this comment.
Say cells enter the queue in the same second
When the runner labels have different availability—the exact condition this probe measures—the cells leave the queue when their respective runners become available, potentially minutes or hours apart. Only their enqueue/dispatch times are aligned, so this sentence states the opposite transition and would make the queue-wait comparison described at the top of the workflow impossible; replace “leave” with “enter” or “are queued.”
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it is backwards in a way that matters for what the probe claims to measure. The cells enter together and leave whenever their labels can be served, which is precisely the thing being compared; saying they leave together describes a probe that could not measure anything.
Reworded, and the second half of the point is now stated rather than left implied:
the ten cells ENTER the queue in the same second, which is what makes their waits
comparable, and that is the only comparison it makes ... They leave it at whatever
times their labels can be served, which is the result.
That sentence predates this pull request, from #11345, so thank you for catching it here. 34 passed with the neighbouring guards, and the workflow still parses.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d390707b2f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| spellings = [str(minutes)] | ||
| if minutes in _AS_A_WORD: | ||
| spellings.append(_AS_A_WORD[minutes]) | ||
| written = re.compile(r"(?<![\w-])(?:" + "|".join(spellings) + r")\s+(?:minutes?|mins?)\b", re.I) |
There was a problem hiding this comment.
Reject hyphenated timeout-duration claims
In the final mechanical-rule rewrite, \s+ recognizes ten minutes but not the equally natural adjectival form ten-minute. With the current measured sentence retained, appending a false claim such as A superseded matrix has a ten-minute slot cost passes all four tests, even though it reinstates the timeout-as-cost statement this rule is intended to prohibit; match a hyphen between the timeout value and unit as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, and this is the kind of gap the simplified rule is supposed to be able to close in one line rather than another round of parsing. A hyphen is a separator here, not part of a word, so the separator is now [\s-]+ and the docstring says why.
Sabotage-verified: your 'A superseded matrix has a ten-minute slot cost' now fails, as does the digit form '10-minute slot cost', the plain 'costs ten minutes' still fails, and 'A queued cell holds no slot at all' still passes.
34 passed with the neighbouring guards.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
unslothai#11347) * Correct why a superseded probe matrix is expensive: slots, not minutes The comment unslothai#11345 landed on runner-pool-probe.yml justified cancelling by "four of them macOS at 10x the minute rate". That rate is real but it is not what this costs. These repositories are public, standard GitHub-hosted runners are free for public repositories, and every label in the probe's matrix is a standard runner, so the account's included-minutes meter reads 0 of 3,000 used and will keep reading zero no matter what this workflow does. The 3,000 included minutes apply to private repositories. The real cost is concurrency. Four of the probe's ten cells are macOS, and GitHub caps macOS at five concurrent jobs ACCOUNT-WIDE across every repository -- the same cap test_macos_slots_per_commit.py already exists to protect, and the reason it records median macOS queue waits of 245 minutes. A superseded matrix was holding four of those five slots for up to ten minutes, and the queue it delays belongs to the whole account rather than to this workflow. So the fix is unchanged and the argument for it is stronger. Only the reason is corrected, here and in the guard's docstring, because this repo already treats a workflow comment that claims something untrue as a defect worth a test: see test_no_workflow_claims_a_main_protection_it_does_not_have, written after 27 files carried a comment asserting a protection they did not have. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Give the probe's cost claim a measured number, and guard it * Judge the duration claim per occurrence, not per sentence * Read the occupancy unit off the hold claim itself * Parse what governs a duration, and check the claim against its own measurement * Check every occupancy claim, and let a hung cell say it holds * Recognise the duration's form, then parse it, and fail when it cannot be read * Take the hung-cell exemption on a positive qualifier only * Cover the past tense, and refuse a qualifier that covers one holder of several * Say what cancelling actually saves, and read a number spelled across words * Take the yardstick from the claim's own sentence, and the excuse from its own clause * Read the other slot-taking verbs, and refuse a denied hang as an excuse * Make the third guard demand a positive explanation too * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Replace the prose parser with two mechanical rules * The cells enter the queue together; when they leave is the measurement * A hyphen is a separator, so ten-minute is ten minutes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Follow-up to #11345, which is merged. The fix there is unchanged and correct; this corrects the reason stated in its comment, which is wrong.
What was wrong
The comment that landed on
runner-pool-probe.ymljustified cancelling by "four of them macOS at 10x the minute rate". That multiplier is real, but it is not what this costs.These repositories are public. Standard GitHub-hosted runners are free for public repositories, and every label in the probe's matrix (
ubuntu-*,windows-*,macos-*, including the ARM ones) is a standard runner. The account's included-minutes meter reads0 min used / 3,000 min includedand will keep reading zero no matter what this workflow does -- those 3,000 minutes apply to private repositories. Reading the comment, someone would reasonably go looking for a minutes bill that does not exist, and conclude the fix was unnecessary.What is actually true
The cost is concurrency, which is the scarce resource here by a wide margin.
Four of the probe's ten cells are macOS, and GitHub caps macOS at five concurrent jobs account-wide, across every repository. That is the same cap
tests/studio/test_macos_slots_per_commit.pyalready exists to protect, and its docstring records what the cap does in practice:studio-mac-ui-smokewaiting a median of 245 minutes to execute for 21.So a superseded probe matrix was holding four of the account's five macOS slots for up to ten minutes, and the queue it delays is the whole account's, not this workflow's. That is a stronger argument for cancelling than the one I wrote, not a weaker one.
Why this is worth a pull request rather than a note
This repo already treats a workflow comment that claims something untrue as a defect worth a test.
test_no_workflow_claims_a_main_protection_it_does_not_havewas written after 27 files carried a comment asserting a protection they did not have, and its docstring makes the point that the comment is what people act on. Leaving a wrong cost model in a comment I just added would be the same failure in a smaller way.Corrected in both places the claim appears: the workflow comment and the guard's module docstring.
Verification
No behaviour change -- comments and a docstring only. The guards still pass: