fix(provider): handle SSE reader cancel rejections (#44944)

This commit is contained in:
Alex 2026-09-02 06:28:47 +02:00 committed by GitHub
parent 82b665075b
commit 69c172e8a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -35,7 +35,7 @@ function wrapSSE(res: Response, ms: number, ctl: AbortController) {
const id = setTimeout(() => {
const err = new Error("SSE read timed out")
ctl.abort(err)
void reader.cancel(err)
reader.cancel(err).catch(() => {})
reject(err)
}, ms)

View file

@ -46,7 +46,7 @@ function wrapSSE(res: Response, ms: number, ctl: AbortController) {
const id = setTimeout(() => {
const err = new ProviderError.ResponseStreamError("SSE read timed out")
ctl.abort(err)
void reader.cancel(err)
reader.cancel(err).catch(() => {})
reject(err)
}, ms)

View file

@ -81,7 +81,7 @@ describe("v2 pty HttpApi", () => {
expect(body.data.title).toBe("v2")
// The canonical surface keeps exited sessions observable with their exit code.
const deadline = Date.now() + 5_000
const deadline = Date.now() + 20_000
let info: { status: string; exitCode?: number } | undefined
while (Date.now() < deadline) {
const found = await request(`/api/pty/${body.data.id}`, tmp.path)