Open Code Review (OCR) — LLM transport
Resolves which provider/protocol/model a run uses, and speaks all three supported wire protocols with retry. Package: internal/llm/.
What flows through it
Technical details
Package: internal/llm/
Depends on: mcp
Depended on by: CLI, LLM loop (Runner), MCP client, Review agent, Scan agent, Session & manifest, Telemetry
What actually happens here
resolver.go's ResolveEndpointWithOptions is the single source of truth for 'which model gets called': it checks the OCR_LLM_PROTOCOL/OCR_LLM_* environment variables first, then config.json's llm.protocol (or the legacy use_anthropic bool) or a named provider preset from providers.go's built-in registry (anthropic, openai, and any custom provider entries). client.go/responses_client.go implement the three protocols (ProtocolAnthropic, ProtocolOpenAIChatCompletions, ProtocolOpenAIResponses); retry_boundary.go/retry_observer.go/retry_report.go add exponential-backoff retry and build the per-run retry report the CLI can print.
How the LLM / model version is chosen
This package is the model-selection mechanism for every other package: env var → config.json → provider preset, normalized to one of three canonical protocol names by NormalizeProtocol/ValidateProtocol. No other package re-implements this resolution.
Deterministic (non-LLM) work in this module
Protocol/endpoint resolution precedence, retry/backoff timing, and request/response marshaling are deterministic; the model's actual reply content is of course not.
Part of the module docs index. Full interactive version, with every module
side by side: architecture.html §7. Cross-cutting mechanisms
this module participates in (retry, compression, manifest, resume, hashing): LLD.