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: gateway-front restart test does not see the worker connected within 10 s #573
src/agent-device/gateway-front.test.ts > the agent-device front, through a gateway: after a gateway restart > after a gateway restart, a command, a release, devices and an upload with the lease header, each as the token's first request, work on the adopted lease
Failed in CI run 38569310207 (PR #567, 31ac3af) and run 38583522717 (PR #565, e8d4707): untilRead (line 348) saw viewOf(...) return undefined within its 10 s real-time wait, after restarted() advanced the fake clock 8 s. The test restarts the gateway four times, so the redial back-off is at its largest and the wait is tight on a loaded runner. Not reproduced locally: 20 runs on the feature branch and 20 on main, all green.
Already fixed by PR #570, merged 31 minutes after this issue was opened. The reported test passes on current main; no new failing test or reproduction commit is justified.
# HEAD: 7533c442953444f395e8bdbd9ee36da51e37a517
pnpm exec vitest run --project unit src/agent-device/gateway-front.test.ts -t "after a gateway restart, a command, a release, .*devices.* and an upload with the lease header, each as the token's first request, work on the adopted lease"# Test Files 1 passed (1)# Tests 1 passed | 73 skipped (74)# Duration 2.43s; tests 896ms
The reported failing run used 3539bccf, which still has the fixed 8-second advance. No failure was reproduced on current main.
Root cause
Defect in the test harness. Historical restarted() advanced the fake clock once, then untilRead() waited in real time without moving it. The worker's reconnect is scheduled on that fake clock (src/daemon/gateway-uplink.ts:172–191) with growing, jittered backoff (:201–205). A retry scheduled beyond the fixed advance cannot run while real-time polling waits. Current src/agent-device/gateway-front.test.ts:2002–2014 already drives the clock until the worker reconnects, within a 30-second wall-time bound.
Simplest fix
Already delivered in 22cd25892: advance fake time while disconnected, then await the refreshed view and adopted leases. Retain this fix and verify it independently before closing the stale issue.
Already fixed by PR #570, merged as 22cd25892. Independently verified the retained fix on main at 7533c442953444f395e8bdbd9ee36da51e37a517:
pnpm exec vitest run --project unit src/agent-device/gateway-front.test.ts -t "after a gateway restart, a command, a release, .*devices.* and an upload with the lease header, each as the token's first request, work on the adopted lease"# Test Files 1 passed (1)# Tests 1 passed | 73 skipped (74)# Tests 959 ms; duration 5.78 s
Not done
Nothing. No additional patch is needed; closing as completed.
Findings
restarted() advances fake time while disconnected under a 30-second bound. This removes the reported stalled-clock failure. All four first-request assertions remain. One passing run does not establish every loaded-runner schedule.
Activity
V3RON commentedon Oct 16, 2026
Reproduction
Already fixed by PR #570, merged 31 minutes after this issue was opened. The reported test passes on current
main; no new failing test or reproduction commit is justified.The reported failing run used
3539bccf, which still has the fixed 8-second advance. No failure was reproduced on currentmain.Root cause
Defect in the test harness. Historical
restarted()advanced the fake clock once, thenuntilRead()waited in real time without moving it. The worker's reconnect is scheduled on that fake clock (src/daemon/gateway-uplink.ts:172–191) with growing, jittered backoff (:201–205). A retry scheduled beyond the fixed advance cannot run while real-time polling waits. Currentsrc/agent-device/gateway-front.test.ts:2002–2014already drives the clock until the worker reconnects, within a 30-second wall-time bound.Simplest fix
Already delivered in 22cd25892: advance fake time while disconnected, then await the refreshed view and adopted leases. Retain this fix and verify it independently before closing the stale issue.
Alternatives rejected
Risk
Written by an agent.
V3RON commentedon Oct 16, 2026
Handoff
Done
Already fixed by PR #570, merged as 22cd25892. Independently verified the retained fix on
mainat7533c442953444f395e8bdbd9ee36da51e37a517:Not done
Nothing. No additional patch is needed; closing as completed.
Findings
restarted()advances fake time while disconnected under a 30-second bound. This removes the reported stalled-clock failure. All four first-request assertions remain. One passing run does not establish every loaded-runner schedule.Blocked on
Nothing.
Written by an agent.