feat(api): add RequestConfigBuilder + completePrompt signal/timeout tests for all providers#711
Conversation
…nfiguration Body: Implement generic request configuration builder with chainable methods (addAbortSignal, addHeaders, setOption), static factory methods (fromMetadata, mergeAbortSignals), and 40 unit tests.
… and multi-SDK examples
…ls early-abort - Fix README TOC: change #how-mergesignals-works to #how-mergeabortsignals-works to match the actual heading anchor - Simplify mergeAbortSignals: return primarySignal directly when it's already aborted instead of creating a new AbortController
…roviders
Add comprehensive test coverage for the updated completePrompt interface that
now accepts CompletePromptOptions { signal?, timeoutMs? }. Each provider spec
includes signal passthrough, timeout passthrough, and backward compatible tests.
Updated implementations:
- requesty.ts: add options parameter support for signal/timeout
Test patterns by provider type:
- OpenAI Client Pattern: signal + timeout as second argument
- Anthropic SDK Pattern: signal as third argument
- Responses API: signal as second argument
- AI SDK (generateText): signal in options object
- VSCode LM: bridge AbortSignal to CancellationToken
- Bedrock: pass abortSignal to client.send
- Gemini: httpOptions.signal in config
- OpenAI Native: merge signals with RequestConfigBuilder
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (60)
📝 WalkthroughWalkthroughAdds a ChangescompletePrompt options propagation across all providers
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages. 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. Comment |
Summary
This PR builds on top of the abort signal core plumbing (#674) and adds:
completePromptsignal passing and timeout behavior.Changes
src/api/providers/config-builder/src/api/providers/*.tssrc/api/providers/__tests__/Test Plan
Summary by CodeRabbit
New Features
Bug Fixes