test(ios): Chief waits count only the time they could run
Reworks the Chief test wait from #28337 so the full kit stays clean under load. Tests only, no product change.
What failed
In #28586's full-kit run 7970c7d9, four Chief waits failed together. None of them failed in 6 full-kit runs at base 96812063:
ChiefOutboxTargetTests.aSendTheMacNeverConfirmedSurvivesTheLinkDroppingHomeRetryTests.failedHomeLoadRetriesTheFeedOnTheExistingLinkMacHomeFeedTests.aFailedOpenIsTriedAgainChiefEngineRecoveryTests.tryAgainSendsTheMessageTheFailedTurnAnswered
The revert of #28337 (#28741, closed) failed the same way with the old wait, in both of its Chief runs.
Why
From the run's own test durations:
- Every main-actor Chief test took about 84ā87 s, all ending together. On base the same tests take about 7 s.
- The Chief tests that aren't on the main actor took 0.33 s, and no test in any other target took over 10 s.
So the main thread in the Chief run was held for more than a minute. eventually measured its 60 s watchdog in wall-clock time. A wait that woke after the hold was already past its deadline, looked once, and gave up before the work it waited on (held just as long) got its turn on the main actor.
Fix
eventuallycounts only the time each nap asked for, so time the main thread is held never uses up a wait. The 60 s watchdog is unchanged.- A 600 s wall-clock backstop (
waitBackstop) still ends a real hang. - From #28586: the wait tests measure no time (the
MacHomeTests.swift:179red at the #28337 merge, step 1b6fc19c), plus a case that cancels a wait while it is suspended. - New red/green case
aHeldMainThreadDoesNotUseUpAWait: it holds the main thread 0.5 s against a 200 ms watchdog, and the flag it waits on is set a few main-actor turns after the hold ends.- Red: the probe branch
ios-ci-3/chief-wait-probeadds only this test on base, with the old wait. - Green: this head.
- Red: the probe branch
Still unknown: what holds the main thread that long. The test logs have no per-test start times.
Evidence
(filled in as runs finish)
Agent session: agent session
š¤ Generated with Claude Code