HERMES-GIELIE/static
Nathan Esquenazi 266d9cdbd3 fix(sse): guard gateway reopen on focus so transient blur can't thrash it (#4151)
The #4151 focus hook reopened both global sidebar streams on `focus` with a
bare `startGatewaySSE()`. But `startGatewaySSE()` is NOT idempotent — it begins
with an unconditional `stopGatewaySSE()` (sessions.js:3778), which closes the
live gateway EventSource, cancels its poll fallback (`stopGatewayPollFallback`),
and resets `_gatewayProbeInFlight` / `_gatewaySSEWarningShown`.

So on a transient blur shorter than the 1s debounce — where the blur-close
timer is cleared on the following focus and the stream was never torn down —
the focus handler still dropped and reconnected the gateway on every
window-switch, cancelling its fallback and resetting probe/warning state. That
is the exact thrash the debounce exists to prevent, in the multi-window PWA
scenario this PR targets. (`ensureSessionEventsSSE()` is already idempotent via
`if(_sessionEventsSSE) return`, so the session-events stream was unaffected;
only the gateway churned. greptile P1.)

Guard the reopen on the gateway actually being closed: `if(!_gatewaySSE)
startGatewaySSE()`, mirroring the session-events idempotency. A sustained blur
(timer fires → both streams closed) still reopens the gateway on focus; a
transient blur leaves the still-open gateway untouched. Verified with a
blur/focus/timer harness (transient → no teardown/reconnect; sustained → close
then reopen; CLI-disabled → stays closed) and a new regression guard
`test_focus_reopen_does_not_thrash_the_gateway_stream`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 18:07:12 -07:00
..
vendor fix: vendor math and yaml assets for CSP 2026-05-26 23:49:02 +02:00
apple-touch-icon.png feature: add manifest and icons to enable app install on android 2026-05-02 19:06:39 +02:00
assistant_turn_anchors.js Add assistant turn anchor renderer snapshot adapter 2026-06-14 02:03:45 +08:00
boot.js Merge #4016 (re-arm browser voice mode when speechSynthesis drops, #3983) onto master 2026-06-13 07:37:31 +00:00
commands.js Merge #4112 (skill bundles in WebUI slash commands, #4087) onto master 2026-06-13 23:13:28 +00:00
favicon-32.png fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
favicon-192.png feature: add manifest and icons to enable app install on android 2026-05-02 19:06:39 +02:00
favicon-512.png feature: add manifest and icons to enable app install on android 2026-05-02 19:06:39 +02:00
favicon-512.svg feature: add manifest and icons to enable app install on android 2026-05-02 19:06:39 +02:00
favicon.ico fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
favicon.svg fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
i18n.js i18n(#4006): add auto-follow setting label+desc to the remaining 11 locales (Opus note) 2026-06-13 04:12:11 +00:00
icons.js feat: add transparent stream activity display 2026-06-12 04:45:41 +03:00
index.html fix(reasoning): hide unsupported max effort (#4119) 2026-06-13 14:33:26 -04:00
login.js feat: add passkey sign-in 2026-05-25 00:14:38 +00:00
manifest.json Stage 405: PR #2842 — feat: polish installed PWA startup by @AJV20 2026-05-24 18:28:52 +00:00
messages.js Merge #4112 (skill bundles in WebUI slash commands, #4087) onto master 2026-06-13 23:13:28 +00:00
onboarding.js docs: clarify Anthropic auth choices in onboarding 2026-05-06 06:26:43 +00:00
outline.js fix(outline): keep outline valid on the todos sidebar panel (Opus follow-up) 2026-06-10 23:55:05 +00:00
panels.js fix(#4006): defensive !==false at the 2 remaining settings-hydration sites (Opus note) 2026-06-13 04:27:01 +00:00
pwa-startup.js Stage 405: PR #2842 — feat: polish installed PWA startup by @AJV20 2026-05-24 18:28:52 +00:00
sessions.js fix(sse): guard gateway reopen on focus so transient blur can't thrash it (#4151) 2026-06-13 18:07:12 -07:00
style.css fix(#3920): apply Codex gate findings — observe #msgInner, instance-owned RO cleanup, restore .messages overflow-anchor 2026-06-13 03:32:16 +00:00
sw.js fix: focus the existing chat tab when a notification is clicked instead of opening a new tab 2026-06-13 14:42:41 -07:00
terminal.js Release v0.51.297 — stage-3711 (terminal remote-backend guard #3711) (#3745) 2026-06-06 14:17:17 -07:00
ui.js Keep prompt-attention title badges from breaking title ownership 2026-06-13 15:05:03 -04:00
workspace.js Release v0.51.343 — Release LG (Phase-1 batch: #3883 + #3878 + #3880) (#3891) 2026-06-09 13:03:15 -07:00