hive-agent: tests for the unknown-window paths, and the two vale errors
This commit is contained in:
parent
1bfee54414
commit
c45615a555
1 changed files with 65 additions and 3 deletions
|
|
@ -981,6 +981,34 @@ mod tests {
|
|||
assert!(low.take_compact().is_none(), "a refusal queues nothing");
|
||||
}
|
||||
|
||||
/// Without a window to divide by, the tool refuses and says why; once a turn
|
||||
/// reports one, the same usage is judged against it.
|
||||
#[test]
|
||||
fn compact_is_refused_while_the_context_window_is_unknown() {
|
||||
let (_dir, todos, _) = stores();
|
||||
let wake = Notify::new();
|
||||
let bus = Bus::new();
|
||||
let usage: hive_claude::TokenUsage = serde_json::from_value(serde_json::json!({
|
||||
"input_tokens": 50,
|
||||
"output_tokens": 0,
|
||||
"cache_read_input_tokens": 0,
|
||||
"cache_creation_input_tokens": 0,
|
||||
}))
|
||||
.expect("a usage block");
|
||||
bus.record_turn_usage(usage, usage);
|
||||
|
||||
let resp = dispatch(compact_req(None), &todos, &wake, None, &bus);
|
||||
assert!(
|
||||
matches!(&resp, Response::Err { message } if message.contains("window is unknown")),
|
||||
"{resp:?}"
|
||||
);
|
||||
assert!(bus.take_compact().is_none(), "a refusal queues nothing");
|
||||
|
||||
bus.set_api_context_window(100);
|
||||
let resp = dispatch(compact_req(None), &todos, &wake, None, &bus);
|
||||
assert!(matches!(resp, Response::Ok), "{resp:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_compact_floor_is_forty_percent_of_the_window() {
|
||||
let (_dir, todos, _) = stores();
|
||||
|
|
|
|||
Loading…
Reference in a new issue