trim_entries: take ContextBudget instead of recomputing

compact() already computes context_budget() — pass it to trim_entries
so it has access to all budget components without recomputing them.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-07 19:42:06 -04:00
parent df62b7ceaa
commit 776ac527f1
2 changed files with 6 additions and 10 deletions

View file

@ -987,11 +987,12 @@ impl Agent {
self.load_startup_journal();
// Dedup memory, trim to budget
let budget = self.context_budget();
let entries = self.context.entries.clone();
self.context.entries = crate::agent::context::trim_entries(
&self.context,
&entries,
&self.tokenizer,
&budget,
);
let after = self.context.entries.len();