Skip to content

Commit 69c172e

Browse files
fix(provider): handle SSE reader cancel rejections (#44944)
1 parent 82b6650 commit 69c172e

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎packages/core/src/aisdk.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function wrapSSE(res: Response, ms: number, ctl: AbortController) {
3535
const id = setTimeout(() => {
3636
const err = new Error("SSE read timed out")
3737
ctl.abort(err)
38-
void reader.cancel(err)
38+
reader.cancel(err).catch(() => {})
3939
reject(err)
4040
}, ms)
4141

‎packages/opencode/src/provider/provider.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function wrapSSE(res: Response, ms: number, ctl: AbortController) {
4646
const id = setTimeout(() => {
4747
const err = new ProviderError.ResponseStreamError("SSE read timed out")
4848
ctl.abort(err)
49-
void reader.cancel(err)
49+
reader.cancel(err).catch(() => {})
5050
reject(err)
5151
}, ms)
5252

‎packages/opencode/test/server/httpapi-v2-pty.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe("v2 pty HttpApi", () => {
8181
expect(body.data.title).toBe("v2")
8282

8383
// The canonical surface keeps exited sessions observable with their exit code.
84-
const deadline = Date.now() + 5_000
84+
const deadline = Date.now() + 20_000
8585
let info: { status: string; exitCode?: number } | undefined
8686
while (Date.now() < deadline) {
8787
const found = await request(`/api/pty/${body.data.id}`, tmp.path)

0 commit comments

Comments
 (0)