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
|
|
@ -875,7 +875,7 @@ fn archive_session(bus: &Bus, session: &AgentSession) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{PercentPolicy, SoftLimitPolicy};
|
||||
use super::{PercentPolicy, SoftLimitPolicy, auto_reset_watermark_tokens};
|
||||
use super::{
|
||||
PermissionAsk, TurnError, TurnOutcome, acp_permits, apply_telemetry, emit_turn_end,
|
||||
error_to_turn, nonzero_or, parse_u64, report_compact, runtime_error_to_turn,
|
||||
|
|
@ -922,6 +922,40 @@ mod tests {
|
|||
assert!(policy(75).should_compact(high));
|
||||
}
|
||||
|
||||
/// The auto-reset watermark is half the window the API reported, and none
|
||||
/// (`0`, off) before one is, instead of half a guessed size.
|
||||
#[test]
|
||||
fn the_auto_reset_watermark_waits_for_a_reported_window() {
|
||||
let bus = Bus::new();
|
||||
assert_eq!(auto_reset_watermark_tokens(&bus), 0);
|
||||
bus.set_api_context_window(1_000_000);
|
||||
assert_eq!(auto_reset_watermark_tokens(&bus), 500_000);
|
||||
}
|
||||
|
||||
/// A turn that reports no window never triggers the proactive compaction,
|
||||
/// however full the context: there is nothing to take a percent of.
|
||||
#[test]
|
||||
fn no_reported_window_means_no_proactive_compaction() {
|
||||
let policy = SoftLimitPolicy {
|
||||
percent: PercentPolicy {
|
||||
percent: 75,
|
||||
default_window: None,
|
||||
checkpoint_prompt: None,
|
||||
},
|
||||
bus: Bus::new(),
|
||||
};
|
||||
let unreported = Usage {
|
||||
context_tokens: 900_000,
|
||||
context_window: None,
|
||||
};
|
||||
assert!(!policy.should_compact(unreported));
|
||||
let reported = Usage {
|
||||
context_window: Some(1_000_000),
|
||||
..unreported
|
||||
};
|
||||
assert!(policy.should_compact(reported));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_turn_that_parsed_nothing_does_not_keep_the_previous_resolved_model() {
|
||||
let resolved = crate::paths::with_harness_dir(|| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue