Repository navigation
fix(core): recognize OpenAI SDK APIUserAbortError as an abort #8399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wenshao
merged 17 commits into
QwenLM:main
from
harjothkhara:oss-find/qwen-code-2026-08-02
Aug 12, 2026
Merged
Changes from 3 commits
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 2fad2fd
test(core): pin the abort match against sibling SDK errors
harjothkhara ad700bf
fix(core): suppress the api_error telemetry event on user cancels
harjothkhara 1868550
test(core): pin the cancel gate's truth table and its stream call site
harjothkhara 6fe680f
Merge branch 'main' into oss-find/qwen-code-2026-08-02
wenshao 546e192
test(core): pin the setup and DOMException cancel paths, correct a ra…
harjothkhara a433efd
Merge branch 'main' into oss-find/qwen-code-2026-08-02
wenshao 63237d2
fix(core): keep reporting timed-out side queries, not just user cancels
harjothkhara ebf497e
fix(core): signal internal deadlines as TimeoutError so they stay rep…
harjothkhara ea1cf10
Merge branch 'main' into oss-find/qwen-code-2026-08-02
wenshao ebb9c25
fix(core): share the timeout-abort contract and convert its fifth pro…
harjothkhara 577c499
fix(cli): signal the voice-refine deadline as TimeoutError
harjothkhara fcd299c
Merge remote-tracking branch 'origin/main' into oss-find/qwen-code-20…
harjothkhara 77d2d44
fix(core): signal the goal checkpoint verifier deadline as TimeoutError
harjothkhara 262bfa5
docs(core): design note for the user-cancel vs internal-deadline cont…
harjothkhara 1d8072b
docs(core): record the daemon prompt deadline as an open boundary case
harjothkhara aa6eca2
refactor(core): reduce #8399 to the #8398 fix, split out the invariant
harjothkhara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Critical] The gate keys only on the state of the caller's signal, never on who fired it. Several in-repo callers compose timeout-based abort signals into model requests —
permissions/classifier.ts:170composesAbortSignal.any([input.signal, AbortSignal.timeout(stage1TimeoutMs)]),memory/relevanceSelector.ts:113usesAbortSignal.timeout(30_000), andmemory/forget.ts:193usesAbortSignal.timeout(8_000), all routing throughrunSideQuery→baseLlmClient→req.config.abortSignal. When the timeout fires, Node setssignal.reasonto a DOMException namedTimeoutErrorandAbortSignal.anypropagates it — but this gate checks onlyabortSignal?.aborted(true) andisAbortError(error)(true forAPIUserAbortError, which the SDK throws for any aborted signal). — Failure scenario: provider latency spike → classifier/memory side query blows itsAbortSignal.timeoutbudget → SDK rejects abort-shaped → gate suppresses theapi_errorevent → at 3 AM the incident shows zero api_errors and a clean model-health chart while background LLM work silently fails. Probe-verified: with aTimeoutError-reason signal andAPIUserAbortError,logApiErroris called 0 times; addingsignal.reason.name !== 'TimeoutError'flips the probe to pass with all 8 existing cancel tests still green.Node sets
signal.reasonto a DOMException namedTimeoutErrorforAbortSignal.timeout(), andAbortSignal.anypropagates the firing source's reason; please also add a test pinning the timeout case.中文说明
[Critical] 该门控只依赖调用方 signal 的状态,从不区分是谁触发了它。仓库中多个调用方会向模型请求传入基于超时的 abort signal——
permissions/classifier.ts:170组合AbortSignal.any([input.signal, AbortSignal.timeout(stage1TimeoutMs)]),memory/relevanceSelector.ts:113使用AbortSignal.timeout(30_000),memory/forget.ts:193使用AbortSignal.timeout(8_000),均经runSideQuery→baseLlmClient→req.config.abortSignal传入。超时触发时,Node 会把signal.reason设为名为TimeoutError的 DOMException,AbortSignal.any会传播该 reason——但此门控仅检查abortSignal?.aborted(true)和isAbortError(error)(对APIUserAbortError为 true,SDK 对任何已中止 signal 都会抛出)。——失败场景:provider 延迟尖峰 → classifier/memory 侧查询超出超时预算 → SDK 以中止形态拒绝 → 门控抑制api_error事件 → 凌晨 3 点的故障中 api_error 为零、模型健康图表干净,后台 LLM 任务悄无声息地失败。已用探针验证:TimeoutErrorreason 的 signal 加APIUserAbortError时,logApiError被调用 0 次;增加signal.reason.name !== 'TimeoutError'后探针翻转为通过,全部 8 个已有取消测试保持绿色。— qwen3.7-max via Qwen Code /review (v0.21.9)