Enforce LLM timeout configuration that was previously dead code#20
Merged
Enforce LLM timeout configuration that was previously dead code#20
Conversation
The Configuration struct defined maxAttempts, requestTimeout, and retryDelay but these values were never used - session.respond() had no timeout wrapper. This caused the tool to hang indefinitely if Apple Intelligence became unresponsive (requiring Mac reboot to fix). Now wraps LLM calls in withTimeout() using task groups that race the operation against a timer. Implements exponential backoff on retries (30s → 60s → 120s by default). Also makes FoundationModelsClient Sendable-conformant and fixes an unrelated test that checked for non-existent prompt text. Fixes #16
This was referenced Jan 7, 2026
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
The
Configurationstruct inFoundationModelsClientdefinedmaxAttempts,requestTimeout, andretryDelaybut these values were never used. Thesession.respond()call had no timeout wrapper, causing the tool to hang indefinitely if Apple Intelligence became unresponsive - this is the likely root cause of #14 where users had to reboot their Mac to recover.Changes:
withTimeout()using Swift'swithThrowingTaskGroupto race the operation against a timerFoundationModelsClientconform toSendablefor Swift 6 strict concurrencyTest plan
swift buildscg generatewith a large diff and verify timeout behaviorFixes #16