Files
Peter Steinberger 2c962c0d67 perf(ui): bring hover-intent prefetch ahead of cooldown timers (#159878)
The pending-work guard dropped new scheduling requests while another
session's cooldown retry could hold a timer for almost 30 seconds. Keep
the earliest pending deadline, preserve the minimum running-cycle delay,
and carry intent through coalescing so it bypasses unbounded idle waits.
Use a 75 ms intent delay to coalesce row sweeps before a click; automatic
warming retains its 250 ms delay and idle callback. Preserve per-key
cooldown, serial history fetches, Web Locks, visibility, presented-pane
readiness, cache ownership, counts, and request budgets.

Controller-boundary regressions fail on base 6652f7eac8 for both intent
and list revisions arriving behind a cooldown. Also cover later requests
not postponing automatic warming, held idle callbacks, pointer sweeps,
and intent coalesced behind an in-flight history request. Document the
intent behavior in the Control UI reference.

Validation: 308 tests across 17 prefetch, chat-history, and session-snapshot
files; UI typecheck; CI oxlint wrapper on touched TypeScript; UI build;
format and diff checks; independent P2 review with no actionable findings.
The broader changed check found TS2532 in the new idle-callback test;
fixed its indexed access and reran the ui-chat type graph, all 31 prefetch
tests, touched-file lint, and review successfully. The other five selected
test type graphs and all preceding changed-file guards passed unchanged.
The prefetch file passed 31 tests in 13.35 s single-worker wall time
(about 0.35 s test time). No remote CI was run.

Live proof: three interleaved before/after rounds per dwell, four targets
per round (12 samples per variant/dwell), separate synthetic Gateways.
Medians from the requested probe, before -> after:
- 150 ms dwell: first completed prefetch send unavailable -> 89.5 ms
  (0/12 -> 2/12 observable samples); click-to-visible 123 -> 205 ms.
- 300 ms dwell: first completed prefetch send 235 -> 88 ms
  (12/12 -> 5/12 observable samples); click-to-visible 111 -> 116.5 ms.

The supplied probe records requests only on response, hiding pending sends.
One additional interleaved round with send-time instrumentation measured
87.5 ms (150 ms dwell) and 85 ms (300 ms dwell) after, including requests
whose responses took seconds. The next supplemental round hit repeated
Gateway authentication timeouts and multi-second SQLite writes; stopped
that probe. Earlier scheduling is proven; end-to-end click improvement
under this host load is not. Stopped the isolated Gateway and removed
its seeded state and temporary browser profiles.
2026-09-27 14:37:14 -07:00
..