Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6f00ee9
fix(core): recognize OpenAI SDK APIUserAbortError as an abort
harjothkhara Aug 2, 2026
2fad2fd
test(core): pin the abort match against sibling SDK errors
harjothkhara Aug 3, 2026
ad700bf
fix(core): suppress the api_error telemetry event on user cancels
harjothkhara Aug 3, 2026
1868550
test(core): pin the cancel gate's truth table and its stream call site
harjothkhara Aug 4, 2026
6fe680f
Merge branch 'main' into oss-find/qwen-code-2026-08-02
wenshao Aug 4, 2026
546e192
test(core): pin the setup and DOMException cancel paths, correct a ra…
harjothkhara Aug 4, 2026
a433efd
Merge branch 'main' into oss-find/qwen-code-2026-08-02
wenshao Aug 5, 2026
63237d2
fix(core): keep reporting timed-out side queries, not just user cancels
harjothkhara Aug 6, 2026
ebf497e
fix(core): signal internal deadlines as TimeoutError so they stay rep…
harjothkhara Aug 6, 2026
ea1cf10
Merge branch 'main' into oss-find/qwen-code-2026-08-02
wenshao Aug 7, 2026
ebb9c25
fix(core): share the timeout-abort contract and convert its fifth pro…
harjothkhara Aug 7, 2026
577c499
fix(cli): signal the voice-refine deadline as TimeoutError
harjothkhara Aug 8, 2026
fcd299c
Merge remote-tracking branch 'origin/main' into oss-find/qwen-code-20…
harjothkhara Aug 8, 2026
77d2d44
fix(core): signal the goal checkpoint verifier deadline as TimeoutError
harjothkhara Aug 8, 2026
262bfa5
docs(core): design note for the user-cancel vs internal-deadline cont…
harjothkhara Aug 8, 2026
1d8072b
docs(core): record the daemon prompt deadline as an open boundary case
harjothkhara Aug 9, 2026
aa6eca2
refactor(core): reduce #8399 to the #8398 fix, split out the invariant
harjothkhara Aug 9, 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
11 changes: 11 additions & 0 deletions packages/core/src/utils/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { describe, it, expect } from 'vitest';
import { APIUserAbortError } from 'openai';
import { getErrorMessage, isAbortError, isNodeError } from './errors.js';

describe('getErrorMessage cause unwrapping', () => {
Expand Down Expand Up @@ -231,6 +232,16 @@ describe('isAbortError', () => {

expect(isAbortError(networkError)).toBe(false);
});

it('should return true for the OpenAI SDK APIUserAbortError (user cancel)', () => {
// The OpenAI SDK is the request path for auth_type=openai; a user cancel
// surfaces as APIUserAbortError. It does not set `.name` (stays 'Error')
// and has no ABORT_ERR code, so the checks above miss it.
const error = new APIUserAbortError({ message: 'Request was aborted.' });

expect(error.name).toBe('Error');
expect(isAbortError(error)).toBe(true);
});
});

describe('isNodeError', () => {
Expand Down
14 changes: 14 additions & 0 deletions packages/core/src/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ export function isAbortError(error: unknown): boolean {
return true;
}

// The OpenAI SDK is the request path for auth_type=openai (the most common
// provider here); a user cancel surfaces as its APIUserAbortError. That class
// does not set `.name` (it stays 'Error') and carries no ABORT_ERR code, so
// the checks above miss it — leaving user cancels logged as api_errors and
// classified 'unknown' rather than 'abort'. Key off the class name, which the
// build preserves (esbuild `keepNames: true`), to avoid importing the SDK
// into this provider-agnostic util.
if (
error instanceof Error &&
error.constructor?.name === 'APIUserAbortError'
) {
return true;
}

return false;
}

Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/utils/retryErrorClassification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { APIUserAbortError } from 'openai';
import { describe, expect, it } from 'vitest';
import { AuthType } from '../core/contentGenerator.js';
import {
Expand All @@ -23,6 +24,17 @@ describe('classifyRetryError', () => {
});
});

it('classifies the OpenAI SDK APIUserAbortError as an abort, not unknown', () => {
// A user cancel on the auth_type=openai path surfaces as APIUserAbortError.
// It must be treated as an abort so retries stop and it is not logged as an
// api_error — otherwise it falls through to the 'unknown' classification.
expect(
classifyRetryError(
new APIUserAbortError({ message: 'Request was aborted.' }),
),
).toMatchObject({ kind: 'abort' });
});

it('classifies HTTP 503 as retryable rate limiting to match stream retry semantics', () => {
expect(
classifyRetryError({ status: 503, message: 'Provider overloaded' }),
Expand Down
Loading