web: second Firefox tab never connects to /api/event - Cache-Control: no-cache lets Firefox's HTTP cache block concurrent SSE requests
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
Línea de trabajo
El encabezado Cache-Control de /api/event se define en packages/opencode/src/server/routes/instance/httpapi/handlers/event.ts, y el cliente web abre ese stream con window.fetch. Empieza leyendo los encabezados de respuesta del handler y luego busca dónde la UI web lanza el fetch del event-stream. Está terminado cuando la respuesta del stream es no-store (o el fetch del cliente usa cache: "no-store") y una segunda pestaña de Firefox se conecta a /api/event sin quedarse bloqueada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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)
- Lenguaje dominante
- TypeScript
- Estrellas
- 213k
- Forks
- 28.4k
- Merge medio
- 8 h 51 min
- PR fusionados (30 d)
- 289
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de anomalyco/opencode
-
reproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
anomalyco/opencode#55351 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
anomalyco/opencode#55285 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
opencode on clean macos zsh .export path not working because it append and it fails because no ~/.zshrc filePosiblemente ocupada @fihaaade la tomó hace 1 día. Abiertoreproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
anomalyco/opencode#55068 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
mcp: allowing an MCP tool by its documented name hides it; the bare name must be allowed tooAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
anomalyco/opencode#54919 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
triaging
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
anomalyco/opencode#54887 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de anomalyco/opencode
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
homarr-labs/homarr#7191 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
AvaProtocol/ava-sdk-js#276 ·
Los mantenedores suelen responder en 1 día
-
useFragment does not require `variables` when the fragment's variables type has required fieldsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
apollographql/apollo-client#13493 ·
Los mantenedores suelen responder en 1 día