web: second Firefox tab never connects to /api/event - Cache-Control: no-cache lets Firefox's HTTP cache block concurrent SSE requests
I maintainer di solito rispondono entro 1 giorno
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
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
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/eventURL 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):
- Server: send
Cache-Control: no-store(e.g.no-store, no-transform) for/api/event(and other SSE endpoints) inpackages/opencode/src/server/routes/instance/httpapi/handlers/event.ts. Event streams should never be stored. - 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
opencode serve, open the web UI in Firefox.- Open the same server/project in a second Firefox tab.
- The second tab never receives live events; DevTools > Network shows
/api/eventrequests piling up without status or timings. - 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
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di anomalyco/opencode
-
app: keybinds match the produced character, so Ctrl+F and other letter shortcuts fail on non-Latin layoutsForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertareproduced
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
anomalyco/opencode#55676 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
tui: NumPad End/Home ignored under kitty keyboard protocol (Windows Terminal reports KP_END 57424)Forse già presa @argszero l’ha presa 1 giorno fa. Apertareproduced
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anomalyco/opencode#55533 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
pending close triaging
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
anomalyco/opencode#55392 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
anomalyco/opencode#55383 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
desktop: new-session project chip never reflects sibling directories of the same git repoForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertareproduced
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
anomalyco/opencode#55351 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di anomalyco/opencode
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
QuantumNous/new-api#7839 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
bug p2 triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
getpaseo/paseo#7071 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
test: make the #3408 Claude OAuth token fixture obviously fake so secret scanners stop flagging itAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
code-yeongyu/senpi#3436 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
lingdojo/kana-dojo#32505 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno