SDK streaming iterators leave their response bodies open on early exit
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 57/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- node.js, typescript
- Área
- api, backend-api-design
Línea de trabajo
Start with src/sdk/client.ts and src/client/stream.ts, then compare the cleanup in transcribeStream() in src/sdk/speech/index.ts. Check the existing stream tests and add regression coverage for early exit and [DONE], while preserving normal EOF and read-error behavior. Done means SDK-owned response bodies are cancelled when iteration stops early and reader locks are released.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
At main commit 06e47c70b76f419196678367dae62acca4c94076, the streaming implementations of text.chat() and speech.synthesize() create an HTTP response internally and delegate to Client.streamSSE(). If a caller stops consuming after an event, the iterator exits without cancelling that response body. The caller receives only the iterator, so cannot directly cancel the internal response.
Client.streamSSE() also breaks on [DONE] without cleanup. Its underlying parseSSE() only releases the reader lock in finally.
Offline reproduction of the shared parser path
Run from the repository root with Node.js 24.19.0. This imports unchanged source and makes no API request:
node --input-type=module <<'JS'
import { parseSSE } from './src/client/stream.ts';
let cancelled = false;
const body = new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode('data: first\n\n'));
},
cancel() { cancelled = true; },
});
for await (const event of parseSSE(new Response(body))) {
console.log(event.data);
break;
}
console.log({ cancelled, locked: body.locked });
await body.cancel(); // Clean up the deliberately open probe stream.
JS
Actual output:
first
{ cancelled: false, locked: false }
A separate loopback HTTP check of the same parser confirmed that the server continued sending events after the consumer exited; explicitly calling response.body.cancel() then closed the connection. Normal EOF and original read-error propagation passed as controls. These checks used synthetic data and no credentials or paid API calls; they do not establish provider-side generation or billing behavior.
Proposed scope
Would you accept a focused fix to release SDK-owned SSE responses when iteration stops early, including the helper's [DONE] path? I would like to confirm whether you prefer cleanup in Client.streamSSE() or in the shared parser, since a direct parser caller supplies its own Response.
The transcribeStream() wrapper already cancels its body on exit for this reason. Regression coverage could include early break/return, [DONE], normal EOF, read failures and rejecting cleanup, while preserving existing errors and releasing reader locks.
AI assistance was used for source inspection and local reproduction. No fix has been implemented or submitted. Open #276 changes line-ending parsing in the same parser; its current patch does not add response cleanup.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.2k
- Forks
- 187
- Merge medio
- 2 h 19 min
- PR fusionados (30 d)
- 2
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 MiniMax-AI/cli
-
[Bug] 未登录时 mmx help 被认证检查拦截,无法查看公开文档链接Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
MiniMax-AI/cli#259 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] --no-color 未去除请求状态栏的 ANSI 颜色Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
MiniMax-AI/cli#258 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 63/100
MiniMax-AI/cli#278 ·
Los mantenedores suelen responder en 1 día
-
/compact commandAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
MiniMax-AI/cli#275 ·
Los mantenedores suelen responder en 1 día
-
[Security] Six confirmed vulnerabilities remain in latest mainPosiblemente ocupada @rahmaniramin550-ai la tomó hace 7 días. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
MiniMax-AI/cli#273 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de MiniMax-AI/cli
Issues similares
-
Add: CanalPlusActionEurope.nlAbiertocheck:passed streams:add
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
beta technical-medium ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
walletbeat/walletbeat#1625 ·
Los mantenedores suelen responder en 1 día
-
[Good First Issue]: Add unit tests for NetworkVersionInfoPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoGood First Issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
hiero-ledger/hiero-sdk-js#4489 ·
Los mantenedores suelen responder en 1 día
-
[Bug] The clients language filter cannot select the rows the page labels as unknownPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/rocketmq-dashboard#6103 ·
Los mantenedores suelen responder en 4 días
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
payloadcms/payload#18652 ·
Los mantenedores suelen responder en 1 día