pub struct Config {Show 49 fields
pub port: u16,
pub worker_token: String,
pub github_webhook_secret: String,
pub bitbucket_webhook_secret: String,
pub gitlab_webhook_secret: String,
pub openrouter_api_key: String,
pub openrouter_model: String,
pub openrouter_model_explore: String,
pub openrouter_base_url: String,
pub openrouter_max_tokens: u32,
pub openrouter_temperature: f32,
pub openrouter_timeout_secs: u64,
pub openrouter_max_retries: u32,
pub max_diff_chars: usize,
pub include_globs: Vec<String>,
pub exclude_globs: Vec<String>,
pub vendored_globs: Vec<String>,
pub file_bundling: bool,
pub self_critique: bool,
pub min_confidence: u8,
pub max_findings: usize,
pub reanchor_findings: bool,
pub agentic: bool,
pub max_turns: usize,
pub max_history_chars: usize,
pub review_on_update: bool,
pub github_token: String,
pub github_api_base: String,
pub bitbucket_email: String,
pub bitbucket_token: String,
pub bitbucket_api_base: String,
pub gitlab_token: String,
pub gitlab_api_base: String,
pub comment_marker: String,
pub user_agent: String,
pub http_referer: String,
pub x_title: String,
pub extra_system_prompt: String,
pub structural_context: bool,
pub structural_max_files: usize,
pub complexity_metrics: bool,
pub complexity_min_cyclomatic: u32,
pub blast_radius: bool,
pub blast_max_symbols: usize,
pub blast_max_refs: usize,
pub ci_status: bool,
pub cve_scan: bool,
pub cve_max_packages: usize,
pub osv_api_base: String,
}Expand description
Resolved runtime configuration.
Fields§
§port: u16§worker_token: String§github_webhook_secret: StringShared secret GitHub signs webhook deliveries with (X-Hub-Signature-256).
bitbucket_webhook_secret: StringShared secret Bitbucket signs webhook deliveries with (X-Hub-Signature).
gitlab_webhook_secret: StringShared token GitLab sends webhook deliveries with (X-Gitlab-Token). Unlike GitHub/Bitbucket this is a plain token compared verbatim, not an HMAC.
openrouter_api_key: StringOpenRouter (or any OpenAI-compatible) API key. Resolved from
OPENROUTER_API_KEY, falling back to LLM_API_KEY — the alias lets
Ollama/vLLM/local OpenAI-compatible servers reuse a generic var name.
openrouter_model: StringSynthesis model: writes the final review findings (quality matters here).
openrouter_model_explore: StringExploration model: drives the agentic tool loop (grep/read_file/list_dir) to gather context. Cheaper — it navigates files, it doesn’t judge.
openrouter_base_url: StringBase URL of the OpenAI-compatible chat-completions API. Resolved from
LLM_BASE_URL, then OPENROUTER_BASE_URL, defaulting to OpenRouter — the
LLM_BASE_URL alias lets Ollama/vLLM/local OpenAI-compatible servers work.
openrouter_max_tokens: u32§openrouter_temperature: f32§openrouter_timeout_secs: u64Whole-request timeout for a single model call. The hand-rolled loop had none, so a stalled provider hung the entire review.
openrouter_max_retries: u32Retries for a transient failure (429 / 5xx) on one call. The hand-rolled loop had none, so a single 429 discarded the whole review.
max_diff_chars: usize§include_globs: Vec<String>Glob patterns of files to INCLUDE in the diff before it’s sent to the LLM.
Empty means include everything (subject to exclude_globs).
exclude_globs: Vec<String>Glob patterns of files to EXCLUDE from the diff (lockfiles, generated, vendored, minified) — drops noise and saves tokens before the LLM call.
vendored_globs: Vec<String>Glob patterns marking vendored third-party source. Diff-hygiene (class D)
findings are suppressed inside these paths — bulk-committing upstream code is
the intent of a vendoring PR, not a defect. Empty means the conventional
defaults (crate::diff::DEFAULT_VENDORED_DIRS).
file_bundling: boolWhen packing a large diff to the size budget, group related changed files (a source + its test, i18n siblings) into one unit so they stay adjacent and pack together instead of being scattered by priority. Fail-open.
self_critique: boolRun a second, skeptical “self-critique” pass that removes false positives and out-of-scope nits from the findings before posting.
min_confidence: u8Drop findings whose model-reported confidence is below this threshold.
max_findings: usizeHard cap on the number of findings posted (after sorting by severity).
reanchor_findings: boolRe-anchor a finding whose line just missed a real diff line: snap it to
the nearest diff line within a small window when that line’s code matches
what the finding references, so a small drift posts inline instead of
folding into the summary. Conservative + fail-open.
agentic: boolUse the agentic reviewer: clone the repo and let the model investigate cross-file context with tools, instead of a single diff-only call.
max_turns: usizeMax tool-loop turns for the agentic reviewer (cost guard).
max_history_chars: usizeChar budget for accumulated tool results in the agent conversation; older results are elided once newer ones fill it (bounds per-turn tokens).
review_on_update: boolRe-review when new commits are pushed to an open PR (GitHub synchronize
/ Bitbucket pullrequest:updated). Off by default so iterating on a PR
doesn’t trigger a fresh (expensive) review per push — opened/reopened/
ready_for_review always review; use the manual POST /review endpoint
to re-review on demand.
github_token: String§github_api_base: String§bitbucket_email: String§bitbucket_token: String§bitbucket_api_base: String§gitlab_token: String§gitlab_api_base: String§comment_marker: StringSignature appended to every comment the bot posts and used as the dedupe key to find/update its own comments. Injected so the library carries no hardcoded bot identity.
user_agent: StringUser-Agent header sent on provider (GitHub) API requests.
http_referer: StringHTTP-Referer header sent to OpenRouter (attribution).
x_title: StringX-Title header sent to OpenRouter (attribution).
extra_system_prompt: StringExtra system-prompt text appended to the built-in prompts. Lets a consumer inject a large conventions block (e.g. via a file baked into its image) without changing the library.
structural_context: boolCompute “structural context” (the enclosing function/symbol of each changed line) and inject it into the review prompt so the model knows each change’s scope. Fully fail-open — never blocks a review.
structural_max_files: usizeMax number of files to fetch + parse for structural context (cost guard).
complexity_metrics: boolSurface deterministic complexity metrics (cyclomatic + cognitive, A–F grade) for the functions a change touches, computed with tree-sitter alongside the structural context. A cheap, LLM-free risk signal. Fully fail-open.
complexity_min_cyclomatic: u32Only report a changed function when its cyclomatic complexity is at least this — keeps the block a high-signal risk flag, not noise for trivial code.
blast_radius: boolCompute a “blast radius” for the agentic reviewer: from the clone, find the
callers and tests of each changed symbol and seed the prompt with them (also
exposes a references tool). Agentic path only — needs the clone. Fail-open.
blast_max_symbols: usizeMax number of changed symbols to expand into a blast radius (cost guard).
blast_max_refs: usizeMax call sites listed per symbol per bucket (callers / tests) (cost guard).
ci_status: boolFetch the head commit’s CI results (GitHub check runs / Bitbucket build statuses) with the PR metadata and surface them in the prompt, so the reviewer can’t assert a broken build that CI already decided.
One extra API call per review. Off is for tokens near their rate limit; with it off the reviewer simply sees no CI block. Fully fail-open either way.
cve_scan: boolScan changed lockfiles for known-vulnerable dependencies via OSV.dev and append advisories to the review summary. Fully fail-open — never blocks a review.
cve_max_packages: usizeMax distinct packages queried against OSV per review (cost/fan-out guard).
osv_api_base: StringBase URL of the OSV.dev API (override for a mirror or a test double).
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_repo_overrides(&self, rc: &RepoConfig) -> Config
pub fn with_repo_overrides(&self, rc: &RepoConfig) -> Config
Return a clone of this config with any fields set in rc overridden.
Only Some(..) fields of the per-repo [RepoConfig] take effect; the rest
keep the env-derived value. rc.instructions is appended to
Config::extra_system_prompt (newline-separated) rather than replacing it,
so a consumer’s baked-in conventions block and the repo’s own instructions
both reach the model.
§Examples
let base = Config::from_env();
let rc = RepoConfig { min_confidence: Some(80), ..Default::default() };
let effective = base.with_repo_overrides(&rc);
assert_eq!(effective.min_confidence, 80);