Watch
0
0
Fork
You've already forked hyperhive
0

hive-agent: no hard-coded context window sizes, the window is what the API reports

This commit is contained in:
damocles 2026-11-15 20:11:26 +01:00 • committed by mara
commit 1bfee54414

View file

@ -444,13 +444,12 @@ fn compact(bus: &Bus, wake_prompt: Option<String>) -> Response {
message: "compact refused: no completed turn yet — nothing to compact".to_owned(),
};
};
let model = bus.model();
let window = bus.effective_context_window(&model);
if window == 0 {
let Some(window) = bus.api_context_window() else {
return Response::Err {
message: "compact refused: effective context window is unknown (0)".to_owned(),
message: "compact refused: the context window is unknown until a turn reports it"
.to_owned(),
};
}
};
// Token counts stay well under 2^53 in practice, so the f64 conversion is exact.
// The ratio is only compared against a fixed threshold, so a last-place rounding error cannot change the outcome.
#[allow(clippy::cast_precision_loss)]