You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(api): abort signal for vscode-lm, gemini, mistral (SDK-specific quirks) #618
VS Code uses its own cancellation model (CancellationToken / CancellationTokenSource) with the disposable pattern. This provider must bridge between the two:
Create a CancellationTokenSource, wire metadata.abortSignal to call source.cancel() on abort
Always call source.dispose() in a finally block (see vscode#205966 for the leak this prevents)
abortSignal goes inside the config object — this IS correct per the @google/genai SDK
Fix: Keep GenerateContentParameters type instead of casting to any. Use config: { ...config, abortSignal: metadata?.abortSignal } as GenerateContentConfig
Note: per the SDK docs, abortSignal is client-only — Google still charges for server-side compute after abort. Worth a code comment.
mistral.ts — acknowledged gap
The Mistral non-streaming SDK (chat.complete()) may not support a signal option
Verify this claim against the actual SDK types/source before accepting it — if incorrect, wire the signal
If confirmed, add a // TODO with a link to the SDK docs and leave completePrompt as-is
Tests
vscode-lm.ts: test that CancellationTokenSource.cancel() is called when abort signal fires, and that dispose() is called in both success and error paths
gemini.ts: test signal is forwarded inside config for both streaming and non-streaming paths
mistral.ts: test streaming path forwards signal; non-streaming path can have a skip-test with explanation
Acceptance criteria
vscode-lm.ts properly bridges CancellationToken ↔ AbortSignal with disposal
gemini.ts keeps GenerateContentParameters type (no any cast)
Activity