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
electron/test/web-integration.test.js → "reconnect: server drop → re-auth → threads:list resync + synthetic threads:changed" fails on the current tree:
production first backoff is still 1s
120000 !== 1000
at electron/test/web-integration.test.js:324
Pre-existing — reproduces on main as of aa4d1ca, both in the full npm run test:electron run and when the file is run alone, so it is not cross-test interference. Found while verifying #194; unrelated to that change.
The test asserts delays[0] === 1000 for the first reconnect backoff and the client schedules 120000 instead. Either wireClient's backoff schedule changed (120s looks like a max/ceiling being used as the first delay) and the test was never updated, or the production-vs-test branch that picks the schedule is no longer taking the production path under the test harness. Worth deciding which is right before touching the assertion — a real 2-minute first reconnect delay would be a user-visible regression in the web client, not a test bug.
changed the title [-]test: web-integration reconnect asserts a 1s first backoff, gets 120000[/-][+]test: web-integration reconnect flake — injected clock fires the 120s invoke timeout immediately[/+]on Aug 18, 2026
The original assertion (delays[0] === 1000, got 120000) was patched to delays.includes(1000) in electron/test/web-integration.test.js. The test still fails, but the error is now:
Timed out after 120000ms: threads:list
at src/wireClient.ts:153
at electron/test/web-integration.test.js:298
The whole test lasts ~110–140ms, so this is not a real 120s wait. The injected setTimeout fires the callback with setTimeout(fn, 0) once allowReconnect is true.
What the test does
First api.threads.list() — allowReconnect is false, so the invoke timeout is a dummy and this call usually succeeds.
Flip allowReconnect = true, close the server-side sockets, wait for threads:changed.
Last api.threads.list() — now the same injected clock schedules INVOKE_TIMEOUT_MS (120000) as setTimeout(fn, 0). That timer races the WebSocket reply and usually wins, rejecting with the 120s message.
Root cause is unchanged: one injected clock is used for both reconnect backoff (MIN_BACKOFF_MS = 1000) and invoke timeout (INVOKE_TIMEOUT_MS = 120000). Making reconnect instant also makes every invoke expire instantly.
So it is a race (timeout vs reply), not a permanent assertion mismatch.
Fix direction
Do not fire every timer at 0ms. Only collapse the reconnect backoff. The invoke timeout must stay a real (or dummy-never-fire) timer, or the test must use a clock that distinguishes the two.
Duplicate of #620, which has the actual mechanism for this exact failure: one injected setTimeout seam in wireClient serves both scheduleReconnect() backoff and invoke()s INVOKE_TIMEOUT_MS, so the test collapsing the backoff also fires the 120 s abort at 0 ms.
Both candidate causes guessed here were wrong - the production first backoff is still 1000 ms and the production branch is being taken. Closing in favour of #620.
Activity
[-]test: web-integration reconnect asserts a 1s first backoff, gets 120000[/-][+]test: web-integration reconnect flake — injected clock fires the 120s invoke timeout immediately[/+]currentbits commentedon Aug 18, 2026
Current failure (updated 2026-08-18)
The original assertion (
delays[0] === 1000, got120000) was patched todelays.includes(1000)inelectron/test/web-integration.test.js. The test still fails, but the error is now:The whole test lasts ~110–140ms, so this is not a real 120s wait. The injected
setTimeoutfires the callback withsetTimeout(fn, 0)onceallowReconnectis true.What the test does
api.threads.list()—allowReconnectis false, so the invoke timeout is a dummy and this call usually succeeds.allowReconnect = true, close the server-side sockets, wait forthreads:changed.api.threads.list()— now the same injected clock schedulesINVOKE_TIMEOUT_MS(120000) assetTimeout(fn, 0). That timer races the WebSocket reply and usually wins, rejecting with the 120s message.Root cause is unchanged: one injected clock is used for both reconnect backoff (
MIN_BACKOFF_MS = 1000) and invoke timeout (INVOKE_TIMEOUT_MS = 120000). Making reconnect instant also makes every invoke expire instantly.Flake, not red-on-every-run
Same SHA family, same test:
32117186703macos test32121422998macos test32121797100macos testSo it is a race (timeout vs reply), not a permanent assertion mismatch.
Fix direction
Do not fire every timer at 0ms. Only collapse the reconnect backoff. The invoke timeout must stay a real (or dummy-never-fire) timer, or the test must use a clock that distinguishes the two.
currentbits commentedon Aug 20, 2026
Duplicate of #620, which has the actual mechanism for this exact failure: one injected
setTimeoutseam inwireClientserves bothscheduleReconnect()backoff andinvoke()sINVOKE_TIMEOUT_MS, so the test collapsing the backoff also fires the 120 s abort at 0 ms.Both candidate causes guessed here were wrong - the production first backoff is still 1000 ms and the production branch is being taken. Closing in favour of #620.