← Back to PRs

#20705: fix(ollama): cover remaining completeSimple gaps and add transcript policy

by BrokenFinger98 open 2026-02-19 07:14 View on GitHub →
agents size: S
## Summary - Register `"ollama"` in the SDK's global API provider registry via `ensureOllamaApiRegistered()` for all `completeSimple()` call sites - Add Ollama API provider registration in TTS text summarization path - Add `"ollama"` case to `transcript-policy.ts` for proper transcript handling ## Changes | File | Change | |------|--------| | `src/agents/ollama-stream.ts` | Add `ensureOllamaApiRegistered()` using `registerApiProvider()` | | `src/tts/tts-core.ts` | Call `ensureOllamaApiRegistered()` before `completeSimple()` when summary model is Ollama | | `src/agents/transcript-policy.ts` | Add `isOllama` flag: enable full sanitization, tool-call ID normalization, tool-use/result pairing repair, synthetic tool results | ## Detail ### 1. TTS summarization (HIGH) `tts-core.ts:summarizeText()` calls `completeSimple()` directly to summarize long text before speech synthesis. If the TTS summary model is configured as an Ollama model, the SDK's API provider registry doesn't know about `"ollama"` and throws "No API provider registered for api: ollama". ### 2. Branch summarization (MEDIUM) The SDK's internal `branch-summarization.js` also uses `completeSimple()`. By adding `ensureOllamaApiRegistered()` to `ollama-stream.ts` (same module), any code path that imports from `ollama-stream` will have the function available. The TTS fix also ensures early registration. ### 3. Transcript policy (LOW) `resolveTranscriptPolicy()` had no branch for `model.api === "ollama"`. All flags defaulted to `false`. Now Ollama models get: - `sanitizeMode: "full"` — full transcript sanitization - `sanitizeToolCallIds: true` — normalize tool-call IDs - `repairToolUseResultPairing: true` — repair mismatched tool-use/result pairs - `allowSyntheticToolResults: true` — allow synthetic tool results ## Test plan - [x] oxlint: 0 warnings, 0 errors - [x] oxfmt: formatting passes - [ ] Manual: TTS with Ollama summary model - [x] Manual: Ollama model with tool calling (transcript policy) — verified with `devstral-small-2:24b` via combined testing with #20665 Closes #20699 Depends on #20665

Most Similar PRs