Skip to content

refactor(config): dedupe QWEN_CODE_API_TIMEOUT_MS env override logic#3653

Merged
wenshao merged 1 commit into
QwenLM:mainfrom
B-A-M-N:refactor/dedupe-timeout-env-override
Apr 27, 2026
Merged

refactor(config): dedupe QWEN_CODE_API_TIMEOUT_MS env override logic#3653
wenshao merged 1 commit into
QwenLM:mainfrom
B-A-M-N:refactor/dedupe-timeout-env-override

Conversation

@B-A-M-N

@B-A-M-N B-A-M-N commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extracted duplicated `QWEN_CODE_API_TIMEOUT_MS` env override block into a shared helper `applyTimeoutEnvOverride()`
  • Used by both `resolveModelConfig()` and `resolveQwenOAuthConfig()`
  • Preserves precedence: `modelProvider > env > settings > default`
  • Adds `[Regression]` tests guarding against the original OAuth-path bug
  • Adds `[Additional]` edge-case tests (scientific notation, hex values, empty strings, all auth types)

What changed

  • `modelConfigResolver.ts`: Replace ~30 lines of duplicated logic with a single helper function
  • `modelConfigResolver.test.ts`: +8 tests (`[Regression]` × 4, `[Additional]` × 4)

Why a separate PR

The behavior change (PR #3629) and the refactor are intentionally split:

Validation

```bash
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.

Extract duplicated timeout env override block into a shared helper
applyTimeoutEnvOverride(), used by both resolveModelConfig() and
resolveQwenOAuthConfig(). Preserves precedence:
modelProvider > env > settings > default.

Adds [Regression] and [Additional] tests guarding against the
original OAuth-path bug and covering edge cases.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@wenshao wenshao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found. LGTM! ✅ — gpt-5.5 via Qwen Code /review

@wenshao wenshao merged commit ccb9857 into QwenLM:main Apr 27, 2026
13 checks passed
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
…wenLM#3653)

Extract duplicated timeout env override block into a shared helper
applyTimeoutEnvOverride(), used by both resolveModelConfig() and
resolveQwenOAuthConfig(). Preserves precedence:
modelProvider > env > settings > default.

Adds [Regression] and [Additional] tests guarding against the
original OAuth-path bug and covering edge cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants