#20705: fix(ollama): cover remaining completeSimple gaps and add transcript policy
agents
size: S
Cluster:
Model Input and Streaming Fixes
## 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
#20665: fix(ollama): register API provider for completeSimple/compaction
by BrokenFinger98 · 2026-02-19
77.8%
#5783: fix(ollama): add streamToolCalls fallback for tool calling
by deepmehta11 · 2026-01-31
71.1%
#16098: fix: omit tools param for models without tool support, surface erro...
by claw-sylphx · 2026-02-14
68.9%
#23776: feat(ollama): auto-register Ollama provider with placeholder key an...
by jayy-77 · 2026-02-22
67.0%
#5115: fix: guard against undefined model.name in Ollama discovery (#5062)
by TheWildHustle · 2026-01-31
66.8%
#7278: feat(ollama): optimize local LLM support with auto-discovery and ti...
by alltomatos · 2026-02-02
66.4%
#19612: feat(onboarding): add Ollama to onboarding provider list
by ParthSareen · 2026-02-18
65.9%
#21977: Preserve provider API for discovered Ollama models
by graysurf · 2026-02-20
65.9%
#4782: fix: Auto-discover Ollama models without requiring explicit API key
by spiceoogway · 2026-01-30
65.2%
#18587: fix(ollama): improve timeout handling and cooldown logic for local ...
by manthis · 2026-02-16
64.7%