You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flaky: physical-reclaim e2e quarantined-device retry test sees ready, not quarantined #1719
e2e/physical-reclaim.test.ts, "a daemon restarted with a quarantined physical device in state.db retries it after its quarantineNextRetryAt" failed on main at 6551fc0 (CI run 44289531652, E2E (1/3)): expected 'ready' to be 'quarantined'. It failed again on PR #1713 (run 44299851793, two attempts), whose diff touches neither physical reclaim nor quarantine; #1716, stacked on #1713 with the same code, passed it.
Confirmed. The bug is in the test; the daemon is correct. On bug/1719-repro, e2e/physical-reclaim.test.ts, "a daemon restarted with a quarantined physical device in state.db retries it after its quarantineNextRetryAt" waits until 1 s past quarantineNextRetryAt before its first status read, as a loaded runner does. It now fails every run with the CI error:
pnpm test:e2e e2e/physical-reclaim.test.ts -t "retries it after its quarantineNextRetryAt"
AssertionError: expected 'ready' to be 'quarantined' // Object.is equality
❯ e2e/physical-reclaim.test.ts:317:42
CI run 44289531652, E2E (1/3): same assertion, test took 3333 ms (window: 2500 ms)
Root cause
Defect in the test. e2e/physical-reclaim.test.ts:303 (on main) sets quarantineNextRetryAt = Date.now() + 2_500 before withDaemon, the state.db seed and startDaemon. Line 315 then expects quarantined. On a slow shard that setup takes longer than 2.5 s. The restored timer (src/core/startup-converger.ts:61 → src/core/quarantine-coordinator.ts:165) then fires at once, since the retry is already due, and the device is ready before the first read. That is the right behaviour. The line is a wall-clock deadline, which testing rule 5 keeps out of e2e.
Simplest fix
On bug/1719-repro, delete line 317, the quarantined check. Keep the wait. The "not before it is due" side is still proven by timestampMs >= nextRetryAt on each uninstall (line 325).
fix: 8 passed (8) pnpm test:e2e e2e/physical-reclaim.test.ts
mutation: quarantine-coordinator.ts:165 arms at clock.now(), ignoring the due time
AssertionError: expected 1795532578494 to be greater than or equal to 1795532579397
❯ e2e/physical-reclaim.test.ts:325:56
Alternatives rejected
A wider window (10 s): still a race with runner load, and 7 s slower.
Two seeded devices, one past due and one due in an hour: fully deterministic, but a new fixture for the same claim.
Risk
On a runner whose start takes longer than 2.5 s, a retry that ignores the due time passes too. It never goes red wrongly.
The uninstall timestamps come from the daemon's clock (e2e/fake-driver/fake-driver.ts:778), the same clock that arms the timer.
Activity
V3RON commentedon Nov 24, 2026
Reproduction
Confirmed. The bug is in the test; the daemon is correct. On
bug/1719-repro,e2e/physical-reclaim.test.ts, "a daemon restarted with a quarantined physical device in state.db retries it after its quarantineNextRetryAt" waits until 1 s pastquarantineNextRetryAtbefore its first status read, as a loaded runner does. It now fails every run with the CI error:Root cause
Defect in the test.
e2e/physical-reclaim.test.ts:303(on main) setsquarantineNextRetryAt = Date.now() + 2_500beforewithDaemon, the state.db seed andstartDaemon. Line 315 then expectsquarantined. On a slow shard that setup takes longer than 2.5 s. The restored timer (src/core/startup-converger.ts:61→src/core/quarantine-coordinator.ts:165) then fires at once, since the retry is already due, and the device isreadybefore the first read. That is the right behaviour. The line is a wall-clock deadline, which testing rule 5 keeps out of e2e.Simplest fix
On
bug/1719-repro, delete line 317, thequarantinedcheck. Keep the wait. The "not before it is due" side is still proven bytimestampMs >= nextRetryAton each uninstall (line 325).Alternatives rejected
Risk
e2e/fake-driver/fake-driver.ts:778), the same clock that arms the timer.Fast track
Written by an agent.
V3RON commentedon Nov 24, 2026
Delivery run
Merged: #1827 (#1719)
Parked: none
Waiting: none
Decided: none
Written by an agent.
fix(test): the quarantined-device retry test no longer races its retr…