Skip to content

Add CLI and config file support for LLM timeout settings#22

Merged
Iron-Ham merged 1 commit intofix/llm-timeout-enforcementfrom
feature/timeout-configuration
Jan 7, 2026
Merged

Add CLI and config file support for LLM timeout settings#22
Iron-Ham merged 1 commit intofix/llm-timeout-enforcementfrom
feature/timeout-configuration

Conversation

@Iron-Ham
Copy link
Owner

@Iron-Ham Iron-Ham commented Jan 7, 2026

Summary

Adds user-configurable timeout and retry settings for LLM requests. Users can now tune these values to better match their system's performance characteristics.

New options:

Setting CLI Flag Config Key Default
Timeout --timeout llmTimeout 30s
Max attempts --max-attempts llmMaxAttempts 3

Precedence: CLI flags override config file settings, which override defaults.

Example usage:

# Single invocation with custom timeout
scg generate --timeout 60 --max-attempts 5

# Persist in config file (~/.config/scg/config.json on Linux, ~/Library/Application Support/scg/config.json on macOS)
{
  "llmTimeout": 60,
  "llmMaxAttempts": 5
}

Changes

  • UserConfiguration.swift: Add llmTimeout: Int? and llmMaxAttempts: Int? fields
  • CommitGenOptions.swift: Add llmTimeout: TimeInterval? and llmMaxAttempts: Int? fields
  • GenerateCommand.swift: Add --timeout and --max-attempts CLI options with resolution logic
  • CommitGenTool.swift: Create FoundationModelsClient with custom configuration from options

Stacking

This PR is stacked on #20 (LLM timeout enforcement). Merge #20 first.

Test plan

  • Build passes with swift build
  • All 49 existing tests pass
  • scg generate --help shows new options
  • Manual test: --timeout 10 uses shorter timeout
  • Manual test: config file llmTimeout is respected

Fixes #18

Users can now configure LLM timeout and retry behavior via:
- CLI flags: --timeout, --max-attempts
- Config file: llmTimeout, llmMaxAttempts

CLI flags override config file settings, which override defaults.
Default timeout remains 30s with 3 retry attempts using exponential
backoff (30s → 60s → 120s).

Fixes #18
@Iron-Ham Iron-Ham merged commit 426e8b5 into fix/llm-timeout-enforcement Jan 7, 2026
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.

1 participant