Open Code Review (OCR) — Review agent
Runs ocr review end to end: load diffs, filter, dispatch one goroutine per file, finalize the manifest. Package: internal/agent/.
What flows through it
Technical details
Package: internal/agent/
Depends on: diff, config_rules, llmloop, tool, session, llm
Depended on by: CLI, Scan agent
What actually happens here
Agent.Run (agent.go) parses diffs via internal/diff, builds a read-only DiffMap tool input, filters by rule/size/budget, then dispatchSubtasks fans out to up to MaxConcurrency (default 8) goroutines, each calling executeSubtask (plan phase, then llmloop.Runner.RunPerFile for the main loop). A per-run token budget (MaxTokensBudget) is checked before each new file is scheduled, so an in-flight batch can overrun the cap by at most the concurrency limit, never a whole extra batch.
How the LLM / model version is chosen
Model/provider come from Args.Model/Args.Provider, set once by the CLI layer from the resolved LLM endpoint — every request in a run (plan, main loop, memory compression, re-location, review filter) uses that same value; there is no per-phase override.
Deterministic (non-LLM) work in this module
Diff loading/filtering, concurrency and per-file token-budget gating, manifest coverage registration (registerCoverage/Mark*), resume matching by content fingerprint (SHA-256 of mode+paths+diff text), and all error classification are deterministic; only the plan phase and the main tool-use loop inside each subtask are AI-driven (see llmloop).
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.