Skip to content

ci: restore the unit suite's timeout headroom — 25 → 45 minutes - #2395

Merged
dolho merged 1 commit into
devfrom
fix/unit-suite-timeout-headroom
Aug 27, 2026
Merged

dolho merged 1 commit into
devfrom
fix/unit-suite-timeout-headroom

Conversation

@dolho

@dolho dolho commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

The cap's own comment reasons from a baseline that no longer exists:

The suite runs ~7-8 min on a normal runner, but GitHub's shared runners vary ~2-2.5x […] 25 gives real headroom for the slow tail

25 was ~3× that baseline when it was chosen. Measured across three consecutive runs of this workflow, same six-shard matrix:

shard duration result
base, seed 67890 13m ✅
head, seed 12345 13m ✅
head, seed 67890 14m ✅
head, seed 99999 14m ✅
base, seed 99999 16m ✅
base, seed 12345 23m ✅

plus repeated The operation was canceled at exactly 25m on both sides. The suite roughly doubled while the cap stood still: 25 is now ~1.8× the baseline, and a 23-minute shard clears it by two minutes. That is not headroom.

Why it matters beyond noise

The matrix runs both sides, so the base shard is plain dev — it reddens a PR that cannot have caused it. That is the #2019 symptom unchanged; its fix added the per-test timeout, which addresses a stalled test and by construction cannot address a slow runner.

Observed on five open PRs today, base and head roughly equally.

Why this doesn't blind the hang detector

--timeout=300 --timeout-method=signal is what turns a stalled test into a named failure. This job cap only ever catches what that cannot: a stall the signal handler can't interrupt — a C call holding the GIL, or a process in uninterruptible I/O.

I reproduced one of the cancelled shards locally to check which of those it was. The process sat in wchan = jbd2_log_wait_commit (an ext4 journal commit) and was still making progress — slow, not hung. So these cases were anonymous cancels at 25m and will be anonymous cancels at 45m; the only thing that changes is that a merely slow runner stops producing one.

What this is not

Buying minutes is not the fix. Making the suite faster — or sharding it with pytest-xdist — is, and that is a separate change. This one stops the bleeding without hiding the trend: the measured durations above are recorded in the comment, so the next reader sees the trajectory rather than just a bigger number.

Both jobs that run the full suite are raised. The 2-minute lint job and the 5-minute diff job are untouched.

🤖 Generated with Claude Code

The cap's own comment reasons from a baseline that no longer exists: "the suite
runs ~7-8 min on a normal runner, but GitHub's shared runners vary ~2-2.5x". 25
was ~3x that baseline when it was chosen.

Measured across three consecutive runs of this workflow, same six-shard matrix:

    13m  13m  14m  14m  16m  23m   (all SUCCESS)

plus repeated `The operation was canceled` at exactly 25m. The suite roughly
doubled while the cap stood still, so 25 is now ~1.8x the baseline and a
23-minute shard clears it by two minutes. That is not headroom.

The cost lands on whoever has a PR open, and lands unfairly: the matrix runs
both sides, so the `base` shard is plain `dev` and reddens a PR that cannot have
caused it. That is the #2019 symptom, unchanged — its fix added the per-test
timeout, which addresses a stalled TEST and by construction cannot address a
slow RUNNER.

45 restores the ~3x the original comment was reasoning about.

It does not weaken hang detection in the way the number suggests.
`--timeout=300 --timeout-method=signal` is what turns a stalled test into a
named failure; this cap only ever catches what that cannot — a stall the signal
handler cannot interrupt, i.e. a C call holding the GIL or a process in
uninterruptible I/O. I reproduced one of the cancelled shards locally and found
exactly that shape: the process sat in `wchan = jbd2_log_wait_commit` (ext4
journal commit) and was still making progress, so it was slow rather than hung.
Those cases were anonymous cancels at 25m and will be anonymous cancels at 45m.
The only thing that changes is that a merely slow runner stops producing one.

The honest alternative is to make the suite faster, or shard it with xdist,
rather than keep buying minutes. That is worth doing and is not this change —
which is why the measured durations are recorded in the comment, so the next
reader sees the trend instead of only the new number.

Both jobs that run the full suite are raised; the 2-minute lint job and the
5-minute diff job are untouched.
@dolho

dolho commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Measured the failure rate — it is ~1 in 3 PRs, not an occasional flake

Sampled the last 12 runs of this workflow, counting only shards that actually executed the suite (excluding superseded-run cancellations, which have short durations and would bias the rate down):

shards that actually ran the suite: 48
  succeeded: 29   hit the 25m wall: 3  (6.2%)
  duration  median 13.7m   p90 15.3m   max 25.3m
  P(at least one of 6 shards killed on a PR) = 32%

The per-shard rate is only 6%, but the matrix runs six shards, so a third of all PRs get a spurious red. That is not a hypothetical: I hit it on four open PRs simultaneously today — #2379, #2382, #2386, #2393 — each with exactly one killed shard, and three of those on the base side, i.e. plain dev, which the PR cannot have caused.

The distribution is the useful part: median 13.7m, p90 15.3m — the bulk is tight, and the kills are a far tail at ~1.8× the median, which is exactly the shared-runner variance this workflow's own header documents. So this is not a suite that is creeping up on the cap; it is a suite comfortably under it that loses a coin flip 6% of the time.

At 45m the cap sits at ~3× p90, which absorbs that tail with room. Re-running is the only alternative and it costs ~14 minutes of compute per attempt at the same 6% odds, on a check whose semantic verdict (regression diff) has usually already passed.

One thing worth noting for whoever reviews this: the four PRs above are currently blocked on nothing but this. I re-ran all four shards rather than wait, but that is treating the symptom.

@AndriiPasternak31

Copy link
Copy Markdown
Contributor

Review sweep — /review + /validate-pr (agent-assisted, findings only)

/review: merge-ready. All CI green; the 45-min value is corroborated by this PR's own 21m52s passing shard and current duration history (~14m median, 23m worst observed → restores the original ~3× design margin). Verified in the head file: both full-suite jobs raised, the 2-min lint and 5-min diff jobs untouched, and --timeout=300 --timeout-method=signal intact in both jobs — the #2019 per-test hang detector is genuinely unweakened.

/validate-pr: one required item — add Fixes #2387 to the body. That open P2 describes exactly this defect and mechanism; without the keyword it strands open with its symptom fixed and issue-status-on-merge.yml never promotes it. (The bare #2019 mention is right as context — don't convert it to a closing keyword.)

Sibling gap found during the completeness sweep (pre-existing — not a blocker here, but urgent): .github/workflows/backend-unit-nightly.yml:77 carries the same expired 25-min cap over six sequential full-suite runs — the last 8 nightly runs (2026-08-19 → 08-26, runs 32225399962 → 32940531599) all concluded cancelled at ~07:24, so the cross-PR regression sweep (#715) has been silently dead for over a week (a cancelled scheduled run reddens nothing on any dashboard). It needs a restructure (per-(side,seed) matrix like this workflow, or a ~6× cap) plus the --timeout=300 --timeout-method=signal guard its pytest invocations also lack — proposing that as its own issue rather than a hunk in this PR.

@dolho

dolho commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Fresh data from today (2026-08-26), same six-shard matrix, confirming the trend this PR records — and it is now actively costing merges:

branch shard result
feature/ent155-chat-cancel (#2393) head 12345, head 67890 cancelled 25m
AndriiPasternak31/issue-ent279 head 67890, head 99999 cancelled 25m
feature/ent253-refresh-treatment head 67890 success 23m
feature/2338-journey-catalog base 99999 success 24m

Two independent PRs killed in the same hour, and two more that cleared the cap by 1–2 minutes.

The base row is worth singling out, since it is the argument this PR already makes: a base shard runs plain dev, identical for every PR. A 24-minute base is not attributable to any diff — it reddens whichever PR happens to be open. Median across all shards observed today is ~14m, so the cap is at ~1.7× median, exactly the ratio this PR's comment says has expired.

#2393 is blocked on this. Worth merging ahead of the queue.

@dolho

dolho commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

One more data point, and it is the cleanest one available.

PR #2408 changes six files, all of them CI scripts and templates — no backend code, no tests outside one new unit file. Its base shards, which run plain dev:

shard duration
base, seed 67890 21m18s
base, seed 99999 18m40s
base, seed 12345 13m11s

All passed. But 21m18s is 3m42s from the cap, on a shard whose code is byte-identical to dev and has nothing to do with the PR it belongs to. Same run's head shards: 14m35s / 12m57s / 14m56s. So a 2.5m spread on head and an 8m spread on base, same commit, same hour — the variance is entirely runner-side, exactly as this PR argues.

Separately, #2393's two shards that were cancelled at 25m yesterday passed on a plain re-run at 14m26s and 14m23s, no code change. That is the direct measurement of what the current cap costs: a spurious red plus a full six-shard re-run (~90 runner-minutes) to recover a result the first run would have produced in 26 minutes.

@obasilakis obasilakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving.

I checked the premise rather than the number. The cap's own comment reasons from a 7-8 min baseline that no longer exists, and the six measured durations in the diff (13/13/14/14/16/23) put a real shard two minutes under the old 25m cap. That is not headroom, and the base shard is plain dev — so the resulting red lands on a PR that cannot have caused it.

What I specifically checked before agreeing this does not blind anything:

  • --timeout=300 --timeout-method=signal is what turns a stalled test into a named failure. This job cap only ever catches what that cannot — a stall the signal handler cannot interrupt. Raising it changes which runner speeds produce an anonymous cancel, not which hangs are detected.
  • Both jobs that run the full suite are raised; the 2-minute lint job and the 5-minute diff job are untouched.
  • The measured durations are recorded in the comment, so the next reader sees the trajectory rather than just a bigger number. That is the part that makes this defensible as a stop-the-bleeding change.

One non-blocking note: the honest alternative the body names — make the suite faster, or shard it with pytest-xdist — has no issue number attached. Worth filing, because the worst case being bought here is 6 shards x 45 minutes, and nothing in the tree will remind anyone that the trend is the actual problem.

dolho added a commit that referenced this pull request Aug 27, 2026
…protects (ent#155)

`portalFailedTurn.spec.js` asserted that at least TWO `retryable:` expressions
exist in the component and that they are textually identical — encoding "send()
and retry() cannot disagree" as "there are two copies that match". That is one
shape which satisfies the rule, not the rule.

Collapsing both `deliver()` callers onto a single `settleDelivery` makes the
rule hold BY CONSTRUCTION — one expression, so disagreement is unrepresentable
— and the guard failed on exactly the change that made it unbreakable. This is
the class the ledger already names: a guard pinned to one literal source shape
rejects the next legitimate edit, and the tempting fix is to delete the rule.

So the rule is kept and the shape widened. Both are admissible, each with its
own proof obligation: the shared shape (one expression) must show that every
`deliver()` caller reaches it through the same settle function — with one
expression the textual-agreement check is vacuous, so something has to take
over its job — and the duplicated shape keeps the all-identical assertion.

Verified against two mutants rather than assumed: a `retry()` that marks
failure itself with a divergent rule trips the agreement check, and one that
bypasses `settleDelivery` entirely trips the structural check.

Full frontend suite: 60 files, 1330 tests, green. The two `pytest` legs on this
PR are cancelled at `timeout-minutes: 25` — including the `base` leg, which
carries none of this diff — and are waiting on #2395.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@dolho
dolho merged commit d3405c8 into dev Aug 27, 2026
21 checks passed
webmixgamer added a commit that referenced this pull request Aug 27, 2026
…#2280)

CI's regression diff caught a genuine one: `test_2280_hosted_compose_parity`
failed on all three head seeds and on none of the base seeds.

`docker-compose.hosted.yml` landed on dev in #2280 while this branch was open —
the pull-only twin of prod, with a guard asserting the two never drift except on
build/image. This branch had already added `SUBSCRIPTION_SWEEP_CONCURRENCY` to
dev and prod, so merging dev in produced exactly the drift that guard exists to
catch. My own packaging check during /validate-pr had verified two compose files
because the third did not exist when I ran it.

Adds the var to the hosted compose and generalises my packaging test from "both
composes" to the three STANDALONE deployment targets, with the exclusions named
and justified: `gitea` and the two `override` files are overlays merged onto the
base (`-f base -f overlay`) so they inherit its environment, `sibling` is the
/verify-local harness, and `prod.enterprise` declares no backend environment
block. Requiring the var in an overlay would be requiring it twice.

A hardcoded list of three has the same rot the original two had, so a second
test asserts no UNCLASSIFIED `docker-compose*.yml` exists — a genuinely new
deployment target now fails loudly and must be classified deliberately rather
than silently escaping the first list. Verified it fires by creating a fourth
file.

Also merges origin/dev (clean, no conflicts), which brings #2395 — the unit
suite's 25→45 minute timeout headroom — so the shard that was cancelled twice on
this PR should now be deterministic.

Full local unit suite after the merge: 12637 passed, 1 failed — `test_1920`,
which reproduces on a clean tree (it scans the private submodule; already a
tracked follow-up).

Refs Abilityai/trinity-enterprise#434

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.

3 participants