SDK streaming iterators leave their response bodies open on early exit
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 57/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 2.2k
- フォーク
- 187
- 平均マージ
- 2時間 19分
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MiniMax-AI/cli のほかの issue
-
[Bug] 未登录时 mmx help 被认证检查拦截,无法查看公开文档链接再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
MiniMax-AI/cli#259 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] --no-color 未去除请求状态栏的 ANSI 颜色再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
MiniMax-AI/cli#258 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 63/100
MiniMax-AI/cli#278 ·
メンテナーはふだん 1 日以内に返信
-
/compact commandオープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
MiniMax-AI/cli#275 ·
メンテナーはふだん 1 日以内に返信
-
[Security] Six confirmed vulnerabilities remain in latest main対応中かも @rahmaniramin550-ai が 7 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
MiniMax-AI/cli#273 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
check:passed streams:add
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
beta technical-medium ui
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
walletbeat/walletbeat#1625 ·
メンテナーはふだん 1 日以内に返信
-
[Good First Issue]: Add unit tests for NetworkVersionInfo対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンGood First Issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
hiero-ledger/hiero-sdk-js#4489 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] The clients language filter cannot select the rows the page labels as unknown対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/rocketmq-dashboard#6103 ·
メンテナーはふだん 4 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
payloadcms/payload#18652 ·
メンテナーはふだん 1 日以内に返信