fix(core): Minor fixes for generalist profile. (#26357)

This commit is contained in:
joshualitt
2026-05-05 12:32:13 -07:00
committed by GitHub
parent f5c0977e96
commit 0803007c8f
7 changed files with 37 additions and 14 deletions
+17 -9
View File
@@ -141,15 +141,23 @@ export class ContextManager {
}
if (agedOutNodes.size > 0) {
this.env.tokenCalculator.garbageCollectCache(
new Set(this.buffer.nodes.map((n) => n.id)),
);
this.eventBus.emitConsolidationNeeded({
nodes: this.buffer.nodes,
targetDeficit:
currentTokens - this.sidecar.config.budget.retainedTokens,
targetNodeIds: agedOutNodes,
});
const targetDeficit =
currentTokens - this.sidecar.config.budget.retainedTokens;
// Respect coalescing threshold for background work
const threshold =
this.sidecar.config.budget.coalescingThresholdTokens || 0;
if (targetDeficit >= threshold) {
this.env.tokenCalculator.garbageCollectCache(
new Set(this.buffer.nodes.map((n) => n.id)),
);
this.eventBus.emitConsolidationNeeded({
nodes: this.buffer.nodes,
targetDeficit,
targetNodeIds: agedOutNodes,
});
}
}
}
}