QA chat SSE: no cross-chunk buffer silently drops the metadata frame (sources + confidence)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- typescript
- Área
- frontend
Línea de trabajo
Empieza en apps/web/src/hooks/use-qa-chat.ts, especialmente en la lógica de lectura del stream alrededor de las líneas 61, 68, 99-127 y 152. Añade cobertura de regresión con streams simulados para un frame dividido en mitad del JSON, CRLF [DONE], envíos concurrentes y el comportamiento de cancelación. Se considera terminado cuando los metadatos se conservan, los errores de terminación y de parseo se gestionan de forma visible, y los envíos concurrentes o cancelados no corrompen el estado de la conversación.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Origin: deferred bucket (d) from the Tier-3 cr-loop review of PR #167 (merged as 55744ca). Flagged independently by four reviewers. Separate subject from that PR, which only swapped this file's fetch for apiFetch.
apps/web/src/hooks/use-qa-chat.ts consumes the /api/qa SSE stream. Four defects, in severity order.
1. No cross-chunk buffer — frames are silently dropped
:99 does chunk.split('\n') per read, with no carry buffer for a partial frame. A ReadableStream read boundary can fall anywhere, so any SSE event split across two reads is parsed as two invalid halves. Both halves land in the empty catch at :127 and vanish.
The event most likely to be split is the largest one — the metadata frame carrying sources and confidence. So the visible symptom is an answer that renders fine but loses its citations, intermittently, with nothing logged. That is the worst possible shape for a bug: it looks like the model just didn't cite anything.
Fix: keep a buffer across reads, split on \n\n, and retain the trailing partial for the next iteration.
2. [DONE] never matches under CRLF
:100-109 compares against [DONE] exactly. With CRLF line endings the token arrives as [DONE]\r, falls through to JSON.parse, and throws — again into the empty catch. Normalise line endings before comparing.
3. The empty catch is what makes 1 and 2 invisible
:127 swallows every parse failure with no logging. Both defects above would be obvious in a single session with any logging at all. Related: #197 — nothing in apps/web uses the structured logger that exists.
4. Concurrent sends corrupt shared state
:68 assigns a new AbortController over the in-flight one without aborting it, so a second send leaves the first stream running and both write the same state. There is also no abort on unmount. Separately, :61 reads conversationHistory from a stale closure, so rapid sends replay incomplete history to the model — and :152 strands the user's message on abort while the error placeholder gets replayed as assistant history.
Test gaps
No coverage for a frame split across chunk boundaries, no CRLF case, no concurrent-send case. A regression test for #1 needs a mocked stream that deliberately splits a frame mid-JSON — worth writing first, since it fails today.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13
- Forks
- 6
- Merge medio
- 4 h 49 min
- PR fusionados (30 d)
- 3
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin 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 CopilotKit/outpost
-
area: docs area: security roadmap: now
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
CopilotKit/outpost#277 ·
-
area: infrastructure roadmap roadmap: later
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
CopilotKit/outpost#179 ·
-
area: ai roadmap roadmap: now
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
CopilotKit/outpost#145 ·
-
area: integrations priority: low roadmap roadmap: later
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
CopilotKit/outpost#124 · 3 comentarios ·
-
area: integrations priority: low roadmap roadmap: later
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
CopilotKit/outpost#123 · 2 comentarios ·
Todos los issues de CopilotKit/outpost
Issues similares
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
xavxyz/bei-shan-lin-shui#57 ·
Los mantenedores suelen responder en 1 día
-
[BUG] rag: sentence content can cross the reported sentence boundariesPosiblemente ocupada @LJK-ikun la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
platformatic/mcp#361 ·
Los mantenedores suelen responder en 1 día
-
最近文档这个弹窗,左右宽度没有最小宽度限制Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
siyuan-note/siyuan#20799 · 7 comentarios ·
Los mantenedores suelen responder en 1 día