Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

web: second Firefox tab never connects to /api/event - Cache-Control: no-cache lets Firefox's HTTP cache block concurrent SSE requests

Aperta Adatta ai principianti
#55,369 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@zonemeen ci sta già lavorando.

Dal 14/10/2026.

  • #55386 di @zonemeen — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend, frontend

Direzione di ricerca

L'intestazione Cache-Control per /api/event viene impostata in packages/opencode/src/server/routes/instance/httpapi/handlers/event.ts, e il client web apre quel flusso con window.fetch. Inizia leggendo le intestazioni di risposta dell'handler, poi trova il punto in cui la UI web invia il fetch dell'event-stream. Il lavoro è completo quando la risposta dello stream è no-store (oppure il fetch del client usa cache: "no-store") e una seconda scheda di Firefox si connette a /api/event senza bloccarsi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

reproduced
Description

In Firefox (also Firefox-based browsers such as Zen), the web UI's live event stream hangs as soon as the same opencode server is open in a second tab. The banner/loading state never clears until the other tab is closed.

GET /api/event is answered with Cache-Control: no-cache, no-transform. no-cache still allows storing, so Firefox writes the response into its HTTP cache. A concurrent request for the same URL then waits for that cache entry to finish being written - which never happens for an endless SSE stream. The second tab's /api/event requests are queued inside the browser forever:

  • DevTools shows them with no status, 0 B and "No timings for request" - they are never sent.
  • The server never sees them (nothing in the opencode log, no connection attempt).
  • The web client aborts each attempt after its 2 s connect deadline and retries, so the queue just grows.
  • Other requests to the same host at the same moment (e.g. /api/session/active) succeed instantly over the same HTTP/2 connection, so this is not a connection or stream limit - only the repeated /api/event URL is blocked.
  • Closing the other tab makes the stream connect immediately.

Server responses confirmed from opencode serve v2.0.23:

HTTP/1.1 200 OK
cache-control: no-cache, no-transform
x-accel-buffering: no
content-type: text/event-stream
Transfer-Encoding: chunked
Suggested fix

Either (or both):

  1. Server: send Cache-Control: no-store (e.g. no-store, no-transform) for /api/event (and other SSE endpoints) in packages/opencode/src/server/routes/instance/httpapi/handlers/event.ts. Event streams should never be stored.
  2. Client: issue the event-stream fetch with cache: "no-store", which bypasses the HTTP cache entirely.

We worked around it by wrapping window.fetch in the web UI and re-issuing /api/event as new Request(request, { headers, cache: "no-store" }).

Steps to reproduce
  1. opencode serve, open the web UI in Firefox.
  2. Open the same server/project in a second Firefox tab.
  3. The second tab never receives live events; DevTools > Network shows /api/event requests piling up without status or timings.
  4. Close the first tab - the second connects immediately.
Related

#48771, #53498, #51857 describe stalled/never-connecting event streams with other causes; this is a further, browser-side cause with the same symptom.

OpenCode version

2.0.23

Operating System

macOS (Firefox 157 / Zen)

Lingua principale
TypeScript
Stelle
213k
Fork
28.4k
Merge medio
8h 32m
PR unite (30g)
253

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode

Tutte le issue di anomalyco/opencode

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.