refactor(config): dedupe QWEN_CODE_API_TIMEOUT_MS env override logic#3651
Closed
B-A-M-N wants to merge 5 commits into
Closed
refactor(config): dedupe QWEN_CODE_API_TIMEOUT_MS env override logic#3651B-A-M-N wants to merge 5 commits into
B-A-M-N wants to merge 5 commits into
Conversation
Adds support for QWEN_CODE_API_TIMEOUT_MS as an environment override for model generation timeout. Qwen Code already supports timeout configuration via: settings.model.generationConfig.timeout This change introduces an env-based override for users running slow local/OpenAI-compatible backends where editing config is less convenient. Precedence: modelProvider > env var > settings > default (120000ms) Behavior: - Valid positive env values override configured timeout - Invalid values are ignored - Default behavior remains unchanged (applied in buildClient()) Note: The 5-minute timeout reported in QwenLM#1045 originally came from undici's default bodyTimeout, which is now disabled (bodyTimeout:0). The modelConfigResolver default is 120000ms (2 minutes). Includes unit tests covering precedence and validation. Closes QwenLM#1045 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers: large timeout values, whitespace-padded env values, negative env values, and reinforces provider > env > settings precedence. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds support for QWEN_CODE_API_TIMEOUT_MS as an environment override for model generation timeout. Closes QwenLM#13 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Extract duplicated timeout env override block into a shared helper applyTimeoutEnvOverride(), used by both resolveModelConfig() and resolveQwenOAuthConfig(). Preserves precedence: modelProvider > env > settings. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds [Regression] tests guarding against the original OAuth-path bug and verifying the refactor preserves precedence across all auth types. Also adds edge-case coverage for scientific notation, hex values, and empty-string env values. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Author
|
Closing in favor of recreating after #3629 merges to main. The current PR incorrectly includes commits from the feature branch. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
QWEN_CODE_API_TIMEOUT_MSenv override block into a shared helperapplyTimeoutEnvOverride()resolveModelConfig()andresolveQwenOAuthConfig()modelProvider > env > settings > default[Regression]tests guarding against the original OAuth-path bugWhat changed
modelConfigResolver.ts: Replace ~30 lines of duplicated logic with a single helper functionmodelConfigResolver.test.ts: +8 tests ([Regression]× 4,[Additional]× 4)Why a separate PR
The behavior change (PR #3629) and the refactor are intentionally split:
Validation
npx vitest run packages/core/src/models/modelConfigResolver.test.ts # 45 tests pass (37 original + 8 new)Scope / risk
Zero risk. This is a behavior-preserving refactor — no logic changes, only code organization.