Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e61feb1
feat(api): add throwIfAborted helper and completePrompt options regre…
easonliang28 Aug 19, 2026
e65cc08
feat(api): abort signal support for openai, openai-compatible base, z…
easonLiangWorldedtech Aug 20, 2026
4a31692
test(providers): export APIUserAbortError from openai mock in firewor…
easonLiangWorldedtech Aug 20, 2026
35c95ea
fix(api): normalize abort errors raised during stream iteration
easonLiangWorldedtech Aug 20, 2026
217f120
test(providers): cover the base_resp stream error path through the it…
easonLiangWorldedtech Aug 20, 2026
af320da
test(providers): cover remaining branch partials in base provider and…
easonLiangWorldedtech Aug 21, 2026
a0117fb
feat(api): add shared isRequestAborted and createAbortError helpers t…
easonLiangWorldedtech Aug 21, 2026
36f0b42
Merge branch 'feat/abort-r1-foundation' into feat/abort-r2-openai-family
easonLiangWorldedtech Aug 21, 2026
8632025
Merge remote-tracking branch 'upstream/main' into feat/abort-r2-opena…
easonliang28 Sep 2, 2026
20b1228
test(zai): align GLM-5.3-Flash expectations with abort-signal request…
easonliang28 Sep 2, 2026
8ce2489
refactor(api): dedupe handleOpenAIRequestError and strengthen abort-s…
easonliang28 Sep 2, 2026
cb77e0c
fix(api): reject pre-aborted Kimi requests and forward per-request ti…
easonliang28 Sep 2, 2026
c9311dc
fix(api): forward per-request timeoutMs and harden abort specs
easonliang28 Sep 2, 2026
707ddf7
Merge upstream/main (79cd12f2c) into feat/abort-r2-openai-family
easonliang28 Sep 3, 2026
0703c58
fix(ci): declare vitest as a root devDependency so the mutation gate …
easonliang28 Sep 3, 2026
09a0c80
test(api): strengthen focused tests for the changed-code mutation gate
easonliang28 Sep 3, 2026
805f297
test(api): exclude proven-equivalent Stryker mutants from the changed…
easonliang28 Sep 3, 2026
1e0b137
Merge branch 'main' into feat/abort-r2-openai-family
easonLiangWorldedtech Sep 3, 2026
7b31a5b
Merge upstream/main (0d937c050) into feat/abort-r2-openai-family
easonliang28 Sep 4, 2026
42bcdab
Merge remote-tracking branch 'upstream/main' into feat/abort-r2-opena…
easonliang28 Sep 5, 2026
35b1d10
Merge branch main into feat/abort-r2-openai-family
easonliang28 Sep 6, 2026
bccf293
test(api): cover captureError non-Error re-wrap and resolving-contrac…
easonliang28 Sep 7, 2026
74e406e
test(api): add abort-aware error-handler tests and assert Kimi retry …
easonliang28 Sep 7, 2026
a3be5ec
Merge branch 'main' into feat/abort-r2-openai-family
easonLiangWorldedtech Sep 7, 2026
25b6446
Merge remote-tracking branch 'upstream/main' into feat/abort-r2-opena…
easonliang28 Sep 13, 2026
393b516
fix(api): enforce abort-signal loop defense in openai-family streamin…
easonliang28 Sep 13, 2026
7dc331f
Merge branch 'main' into feat/abort-r2-openai-family
easonLiangWorldedtech Sep 29, 2026
4db5623
chore(deps): regenerate pnpm-lock.yaml after main merge
Sep 29, 2026
4238bd1
fix(deps): bump vitest 4.1.9 -> 4.1.11 (dependency-review advisory)
Sep 30, 2026
34a87d5
test(visual): regenerate electron chat-dark sidebar reference for #1311
Sep 30, 2026
9ece5d9
test(visual): restore original chat-dark sidebar reference
Sep 30, 2026
ac0c847
test(openai): make the timeout-only signal test observe the abort
Sep 30, 2026
c44241b
test(kimi-code): keep the SDK create signature in the spy helper
Sep 30, 2026
c2ad99c
Merge remote-tracking branch 'upstream/main' into feat/abort-r2-opena…
Oct 2, 2026
833f5eb
chore: trigger label reconcile (CI green + CR approved, cron stalled)
Oct 2, 2026
74f5113
Merge commit 'refs/shapes/upstream-main' into feat/abort-r2-openai-fa…
Oct 2, 2026
cbcc610
Merge upstream main (3859e5dd8) into feat/abort-r2-openai-family
Oct 4, 2026
fe2cca9
Re-trigger review at the current head
Oct 4, 2026
dbe734f
Distinguish a request timeout from a user cancellation
Oct 4, 2026
c81a73f
Re-trigger review at head: all required checks green and every review…
Oct 4, 2026
ebf71a1
Cover timeout classification through the provider call path
Oct 4, 2026
49467c8
Keep boolean base_resp status codes reported as errors
Oct 4, 2026
7a2d9da
Match the status_msg fallback between the two paths
Oct 4, 2026
1d087ac
Merge branch 'main' into feat/abort-r2-openai-family
easonLiangWorldedtech Oct 5, 2026
cd52589
test(api): pin the two-argument create() call in the completePrompt a…
Oct 5, 2026
a18aee8
Merge upstream/main into feat/abort-r2-openai-family
Oct 7, 2026
833268c
fix(api): cancel Kimi model discovery with the caller, and pin the fl…
Oct 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"rimraf": "6.0.1",
"tsx": "4.22.4",
"turbo": "2.10.0",
"typescript": "5.9.3"
"typescript": "5.9.3",
"vitest": "4.1.11"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css,md}": [
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,27 @@ import { getApiRequestTimeout } from "../utils/timeout-config"

import { clearAllMocks } from "../../../test-utils/reset"

// Mock OpenAI and capture constructor calls
const mockOpenAIConstructor = vitest.fn()
// Mock OpenAI and capture constructor calls. The abort error class must stay the
// real one: error-handler classifies it with instanceof, so a stand-in would make
// the timeout assertion pass for the wrong reason.
const { mockOpenAIConstructor, mockCreate } = vitest.hoisted(() => ({
mockOpenAIConstructor: vitest.fn(),
mockCreate: vitest.fn(),
}))

vitest.mock("openai", () => {
// The abort error class must stay the real one: error-handler classifies it with
// instanceof, so a stand-in would make the timeout assertion pass for the wrong reason.
vitest.mock("openai", async (importOriginal) => {
const actual = (await importOriginal()) as { APIUserAbortError: new () => Error }
return {
__esModule: true,
APIUserAbortError: actual.APIUserAbortError,
default: vitest.fn().mockImplementation(function (config) {
mockOpenAIConstructor(config)
return {
chat: {
completions: {
create: vitest.fn(),
create: mockCreate,
},
},
}
Expand Down Expand Up @@ -118,4 +127,32 @@ describe("BaseOpenAiCompatibleProvider Timeout Configuration", () => {
}),
)
})

it("keeps a timeout classified as a timeout while the caller signal is still live", async () => {
vitest.mocked(getApiRequestTimeout).mockReturnValue(600000)
const provider = new TestOpenAiCompatibleProvider("test-api-key")
const controller = new AbortController()

// The SDK reports the abort only after the merged timeout signal has fired, so
// the classification depends on the timeout reason rather than the caller signal.
const openai = await import("openai")
let requestSignal: AbortSignal | undefined
mockCreate.mockImplementation(async (_params: unknown, config: { signal?: AbortSignal }) => {
requestSignal = config.signal
await new Promise((resolve) => setTimeout(resolve, 20))
throw new openai.APIUserAbortError()
})

const error = await provider
.completePrompt("hi", { abortSignal: controller.signal, timeoutMs: 5 })
.catch((caught: unknown) => caught)

expect((error as Error).name).toBe("TimeoutError")
expect((error as Error).message).toBe("TestProvider request timed out")
expect((error as Error).cause).toBeInstanceOf(openai.APIUserAbortError)
// The caller never cancelled: the timeout fired on the merged signal.
expect(controller.signal.aborted).toBe(false)
expect(requestSignal?.aborted).toBe(true)
expect(requestSignal?.reason?.name).toBe("TimeoutError")
})
})
Loading
Loading