pub struct ReviewConfig {
pub max_prompt_chars: usize,
pub max_full_content_files: usize,
pub max_chars_per_file: usize,
pub max_diff_chars: usize,
pub max_patch_chars_per_file: usize,
pub max_instructions_chars: usize,
pub instructions_file: Option<String>,
pub min_budget_for_call_graph: usize,
pub max_dep_release_chars: usize,
pub max_dep_packages: usize,
}Expand description
PR review prompt configuration.
Controls prompt token budgets and GitHub API constraints for PR reviews:
max_prompt_chars: 120,000 chars is a conservative budget below common LLM context window limits (e.g., 128k token models), accounting for system prompt and response overhead.max_full_content_files: 10 files caps GitHub Contents API calls per review to limit latency and rate limit usage.max_chars_per_file: 32,000 chars per file gives adequate context for most files without dominating the prompt budget; budget drop logic trims below 120k if needed.max_instructions_chars: 1,500 chars caps repository instructions to prevent prompt bloat.max_diff_chars: 200,000 chars caps the total diff content across all files in the prompt.max_patch_chars_per_file: 25,000 chars caps each individual file patch before dropping it entirely.
Fields§
§max_prompt_chars: usizeMaximum total prompt character budget (default: 120_000).
max_full_content_files: usizeMaximum number of files to fetch full content for (default: 10).
max_chars_per_file: usizeMaximum characters per file’s full content (default: 32_000).
max_diff_chars: usizeMaximum total diff characters across all files in the prompt (default: 200_000).
max_patch_chars_per_file: usizeMaximum characters per individual file patch before the patch is dropped entirely (default: 25_000).
max_instructions_chars: usizeMaximum characters for repository instructions (default: 1_500).
instructions_file: Option<String>Optional path to repository instructions file (overrides default AGENTS.md and .github/instructions/pr-review.md).
min_budget_for_call_graph: usizeMinimum remaining prompt budget to auto-enable call graph (default: 20_000).
The call graph is built only when:
budget_remaining = max_prompt_chars - estimated_size (call_graph excluded)
and budget_remaining > min_budget_for_call_graph.
A value >= max_prompt_chars means call graph is never auto-enabled.
A value > max_prompt_chars / 2 means call graph is only built for
the largest diffs — consider lowering the threshold.
max_dep_release_chars: usizeMaximum characters for dependency release notes (default: 2_000).
max_dep_packages: usizeMaximum number of dependency packages to enrich (default: 3).
Implementations§
Source§impl ReviewConfig
impl ReviewConfig
Sourcepub fn validate_consistency(&self) -> Vec<String>
pub fn validate_consistency(&self) -> Vec<String>
Validate internal consistency of review configuration.
Returns a list of warning strings for any misconfigured values.
The caller should emit these warnings via tracing::warn! or similar.
Trait Implementations§
Source§impl Clone for ReviewConfig
impl Clone for ReviewConfig
Source§fn clone(&self) -> ReviewConfig
fn clone(&self) -> ReviewConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more