mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
* fix(core): guard Anthropic streams with idle and lifetime watchdogs
The OpenAI wire wraps its stream in an inactivity watchdog plus a
non-resetting lifetime cap, while the Anthropic wire had neither: a
stream that returns 200 and then goes silent — or drip-feeds
low-content thinking_delta frames that keep resetting any idle-only
timer — hangs the CLI until the process is killed. Wire the same
guards into the Anthropic generator so a stalled stream aborts with a
retryable ETIMEDOUT instead of hanging, and the two wires stop
differing on whether a stalled stream is recoverable.
The guard mechanics, error classes, and timeout resolvers move to a
shared stream-guards module used by both wires; the OpenAI pipeline
re-exports the error classes so existing imports keep working. Also
rename six stale popPartialIfPushed comment references in
geminiChat.ts to the real popPendingPartialAssistantTurn method.
Issue #9005 findings 4 and 6.
* fix(core): keep Anthropic fallback probe signal live past the drain abort
The shared stream guard aborts the per-request controller the moment the source stream drains, but the Anthropic empty-stream fallback probe runs after that drain and was reusing the now-aborted signal, so the SDK rejected it with a spurious AbortError instead of surfacing the provider's real error (e.g. a 402 credit-balance response). Pass the caller's signal into the fallback and derive a fresh short-lived child for the probe, aborting it once the probe settles to release the SDK's abort listener.
* chore(vscode-ide-companion): regenerate settings schema artifact
Propagate the streamIdleTimeoutMs description change (OpenAI-compatible and Anthropic models) to the generated settings.schema.json via npm run generate:settings-schema, keeping the CI lockstep check green.
* test(core): pin Anthropic user-abort precedence over the idle watchdog
Anthropic twin of the OpenAI pipeline.test.ts case: a user abort landing while the idle-watchdog timer is pending must surface as a non-retryable AbortError, not the retryable ETIMEDOUT the watchdog would otherwise raise (ETIMEDOUT is retryable, so the retry loop would resume the cancelled turn). Pins the parentSignal argument threaded into withStreamGuards — replacing it with undefined leaves this test red.
* chore(core): finish popPartialIfPushed rename in geminiChat.test.ts comments
The rename sweep to popPendingPartialAssistantTurn missed four comment references in geminiChat.test.ts (lines ~7737, ~10919, ~10980, ~13284). Update them so grep for the new method name reaches every site describing the rollback mechanism.
* docs(users): extend stream guards prose to Anthropic providers
The docblock and regenerated settings schema already declare Anthropic
coverage; settings.md still scoped the guards to OpenAI-compatible
providers and claimed neither guard exists on Anthropic. Update the
heading and scope the remaining gap to the Gemini generator only.
* test(core): pin Anthropic stream-guard env knobs and probe signal linkage
Close the round-2 review gaps on the Anthropic wire:
- Honour QWEN_STREAM_MAX_LIFETIME_MS and the shared default lifetime cap
through the Anthropic wiring (both previously untested; mutation-verified).
- Stub QWEN_STREAM_* envs in the fallback-probe regression so ambient
disable values cannot vacate it.
- Pin the probe's caller-signal linkage (mid-probe cancel surfaces
AbortError) and its post-probe abort cleanup.
* test(core): pin QWEN_STREAM_IDLE_TIMEOUT_MS env resolution on the Anthropic wire
Add the idle-knob twin of the lifetime env test in the watchdog suite:
with no explicit streamIdleTimeoutMs config, the constructor must
resolve the idle window from QWEN_STREAM_IDLE_TIMEOUT_MS. Mirrors the
OpenAI pipeline.test.ts case. Mutant check: replacing the constructor's
resolveStreamIdleTimeoutMs(contentGeneratorConfig) with the direct
config ?? DEFAULT fallback leaves this test red (env 3000 no longer
fires at 3000ms).
* ci: serialize helper test files
* Revert "ci: serialize helper test files"
This reverts commit 7b4e0c9828.