File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,15 +5,24 @@ pub struct BudgetConfig {
55 pub auto_multiplier : f64 ,
66 pub auto_min : u32 ,
77 pub auto_max : u32 ,
8+ /// Per-core-fragment ceiling when sizing the auto budget. A core fragment
9+ /// that is a whole-file `Chunk` (e.g. a 2000-line unparsed template touched
10+ /// by one hunk) would otherwise inflate the budget by its entire byte
11+ /// weight, dragging in the whole repo as "context". Capping each core
12+ /// fragment's budget contribution decouples "how big are the files I edited"
13+ /// from "how much of the repo do I pull in". Does not affect whether the
14+ /// changed file is included (it always is) — only the context budget it earns.
15+ pub core_token_cap_per_fragment : u32 ,
816}
917
1018impl Default for BudgetConfig {
1119 fn default ( ) -> Self {
1220 Self {
1321 unlimited : 10_000_000 ,
14- auto_multiplier : 5 .0,
22+ auto_multiplier : 3 .0,
1523 auto_min : 8_000 ,
16- auto_max : 124_000 ,
24+ auto_max : 48_000 ,
25+ core_token_cap_per_fragment : 1_500 ,
1726 }
1827 }
1928}
Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ pub fn select_with_params(
341341 . all_fragments
342342 . iter ( )
343343 . filter ( |f| state. core_ids . contains ( & f. id ) )
344- . map ( |f| f. token_count )
344+ . map ( |f| f. token_count . min ( BUDGET . core_token_cap_per_fragment ) )
345345 . sum ( ) ;
346346 let auto = ( core_tokens as f64 * BUDGET . auto_multiplier ) as u32 ;
347347 auto. clamp ( BUDGET . auto_min , BUDGET . auto_max )
You can’t perform that action at this time.
0 commit comments