Skip to content

feat(model): extend timeout range and raise default - #1512

Merged
zerob13 merged 1 commit into
devfrom
feat/model-timeout-range-default
Apr 22, 2026
Merged

feat(model): extend timeout range and raise default#1512
zerob13 merged 1 commit into
devfrom
feat/model-timeout-range-default

Conversation

@yyhhyyyyyy

@yyhhyyyyyy yyhhyyyyyy commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

feat(model): extend timeout range and raise default

Summary by CodeRabbit

  • Updates
    • Increased default model request timeout from 60 seconds to 10 minutes, allowing more time for requests to complete.
    • Extended the maximum request timeout limit from 10 minutes to 60 minutes, providing greater flexibility for long-running operations.
    • Standardized timeout bounds across the application's model configuration interface and validation.
    • Updated timeout validation messages across all supported languages to reflect new constraints.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR consolidates timeout configuration constants across the application, replacing hardcoded timeout bounds with shared constants. The default model timeout increases from 60000ms to 600000ms, with new minimum (1000ms) and maximum (3600000ms) bounds. Updates span presenter logic, UI validation components, validation utilities, internationalization strings, and associated tests.

Changes

Cohort / File(s) Summary
Shared Model Configuration Defaults
src/shared/modelConfigDefaults.ts
Introduced MODEL_TIMEOUT_MIN_MS (1000) and MODEL_TIMEOUT_MAX_MS (3600000) constants; updated DEFAULT_MODEL_TIMEOUT from 60000 to 600000.
Presenter & Runtime Layer
src/main/presenter/agentRuntimePresenter/index.ts
Replaced session-scoped timeout constants with model-scoped MODEL_TIMEOUT_MIN_MS/MODEL_TIMEOUT_MAX_MS in fallback validation logic; updated imports.
UI Components
src/renderer/src/components/chat/ChatStatusBar.vue, src/renderer/src/components/settings/ModelConfigDialog.vue
Replaced hardcoded timeout bounds (1000/600000) with shared constants; updated validation constraints in input elements and form validation logic.
Validation Utilities
src/shared/utils/generationSettingsValidation.ts
Replaced local TIMEOUT_MIN/TIMEOUT_MAX constants with imported MODEL_TIMEOUT_MIN_MS/MODEL_TIMEOUT_MAX_MS in numeric field validation.
Internationalization
src/renderer/src/i18n/da-DK/settings.json, en-US/settings.json, fa-IR/settings.json, fr-FR/settings.json, he-IL/settings.json, ja-JP/settings.json, ko-KR/settings.json, pt-BR/settings.json, ru-RU/settings.json, zh-CN/settings.json, zh-HK/settings.json, zh-TW/settings.json
Updated timeoutMax validation messages across 12 language files, changing maximum displayed timeout from 600000ms to 3600000ms.
Test Layer
test/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.ts, test/main/presenter/modelConfig.test.ts, test/renderer/components/ChatStatusBar.test.ts
Updated expected default timeout value from 60000 to 600000 in multiple assertions; added DEFAULT_MODEL_TIMEOUT import and assertion in model config test.
New Test Coverage
test/main/shared/generationSettingsValidation.test.ts
Added test suite validating validateGenerationNumericField timeout bounds, verifying null returns at min/max thresholds and specific error codes for out-of-range values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • zerob13

Poem

🐰 Timeouts were scattered, now unified with care,
Constants hop from hard-code into defaults fair,
From sixty to six-hundred, bounds now align,
Validation and messages in perfect design,
One rabbit's refactor makes everything shine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: extending the timeout range (from 600,000ms to 3,600,000ms) and raising the default timeout (from 60,000ms to 600,000ms).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/model-timeout-range-default

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
test/renderer/components/ChatStatusBar.test.ts (1)

8-19: Keep the test fixture type timeout-aware.

Line 1496 now asserts timeout, but TestGenerationSettings still cannot model timeout values through modelConfig, sessionSettings, or deferred session responses. Add timeout?: number so future timeout override/range cases stay type-safe.

♻️ Proposed test type update
 type TestGenerationSettings = {
   systemPrompt: string
   temperature: number
   contextLength: number
   maxTokens: number
+  timeout?: number
   reasoning?: boolean

Also applies to: 1491-1497

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/renderer/components/ChatStatusBar.test.ts` around lines 8 - 19, The
TestGenerationSettings type used in tests is missing a timeout field used by
later assertions; update the TestGenerationSettings definition (the type named
TestGenerationSettings) to include an optional timeout?: number so that timeout
values passed via modelConfig, sessionSettings or deferred session responses are
type-safe for assertions around timeout (e.g., the assertions introduced around
lines asserting timeout).
test/main/presenter/modelConfig.test.ts (1)

2-2: Move this suite to mirror the source path.

Line 2 targets src/main/presenter/configPresenter/modelConfig.ts, but the suite lives at test/main/presenter/modelConfig.test.ts. Please move it to test/main/presenter/configPresenter/modelConfig.test.ts and update relative imports accordingly. As per coding guidelines, “Vitest test suites should mirror the source structure under test/main/** and test/renderer/**.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/main/presenter/modelConfig.test.ts` at line 2, The test suite file
modelConfig.test.ts is placed in the wrong directory; move the test so its
directory structure mirrors the source module configPresenter/modelConfig.ts
under the test/main tree, and then update the import of ModelConfigHelper in the
moved test to use the correct relative path to the source module (adjust the
import string for ModelConfigHelper accordingly) so the test imports the actual
configPresenter/modelConfig module.
test/main/shared/generationSettingsValidation.test.ts (1)

1-3: Move this test under the mirrored utils path.

This file tests src/shared/utils/generationSettingsValidation.ts, so the mirrored test path should be test/main/shared/utils/generationSettingsValidation.test.ts. As per coding guidelines, Vitest test suites should mirror the source structure under test/main/** and test/renderer/**.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/main/shared/generationSettingsValidation.test.ts` around lines 1 - 3,
The test file generationSettingsValidation.test.ts that exercises
validateGenerationNumericField and imports MODEL_TIMEOUT_MAX_MS and
MODEL_TIMEOUT_MIN_MS needs to be moved so its test path mirrors the source utils
location (place it under the utils test directory), update any relative import
paths inside the moved file so the imports for validateGenerationNumericField
and the MODEL_TIMEOUT_* constants resolve correctly, and run the test suite to
confirm no import failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/main/presenter/modelConfig.test.ts`:
- Line 2: The test suite file modelConfig.test.ts is placed in the wrong
directory; move the test so its directory structure mirrors the source module
configPresenter/modelConfig.ts under the test/main tree, and then update the
import of ModelConfigHelper in the moved test to use the correct relative path
to the source module (adjust the import string for ModelConfigHelper
accordingly) so the test imports the actual configPresenter/modelConfig module.

In `@test/main/shared/generationSettingsValidation.test.ts`:
- Around line 1-3: The test file generationSettingsValidation.test.ts that
exercises validateGenerationNumericField and imports MODEL_TIMEOUT_MAX_MS and
MODEL_TIMEOUT_MIN_MS needs to be moved so its test path mirrors the source utils
location (place it under the utils test directory), update any relative import
paths inside the moved file so the imports for validateGenerationNumericField
and the MODEL_TIMEOUT_* constants resolve correctly, and run the test suite to
confirm no import failures.

In `@test/renderer/components/ChatStatusBar.test.ts`:
- Around line 8-19: The TestGenerationSettings type used in tests is missing a
timeout field used by later assertions; update the TestGenerationSettings
definition (the type named TestGenerationSettings) to include an optional
timeout?: number so that timeout values passed via modelConfig, sessionSettings
or deferred session responses are type-safe for assertions around timeout (e.g.,
the assertions introduced around lines asserting timeout).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 27a7ebe8-dc3d-4443-9d22-1495251d3a30

📥 Commits

Reviewing files that changed from the base of the PR and between ba780ee and 8e98e5c.

📒 Files selected for processing (21)
  • src/main/presenter/agentRuntimePresenter/index.ts
  • src/renderer/src/components/chat/ChatStatusBar.vue
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/shared/modelConfigDefaults.ts
  • src/shared/utils/generationSettingsValidation.ts
  • test/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.ts
  • test/main/presenter/modelConfig.test.ts
  • test/main/shared/generationSettingsValidation.test.ts
  • test/renderer/components/ChatStatusBar.test.ts

@zerob13
zerob13 merged commit 7e85c7c into dev Apr 22, 2026
3 checks passed
@zhangmo8
zhangmo8 deleted the feat/model-timeout-range-default branch April 24, 2026 08:52
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