Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix: reattach the builder's doc comment and tighten the split assertion

sanil-23999221a9fd50
diff --git a/src/openhuman/agent/harness/session/turn_checkpoint.rs b/src/openhuman/agent/harness/session/turn_checkpoint.rs
index 96505b7a59..123cee36f0 100644
--- a/src/openhuman/agent/harness/session/turn_checkpoint.rs
+++ b/src/openhuman/agent/harness/session/turn_checkpoint.rs
@@ -154,6 +154,10 @@ pub(super) fn truncate_chars(text: &str, max: usize) -> String {
format!("{cut}… [truncated]")
}
+#[cfg(test)]
+#[path = "turn_checkpoint_tests.rs"]
+mod tests;
+
/// Build a deterministic checkpoint summary from this turn's tool-call
/// results. Used only as a safety net when the model-written checkpoint
/// call fails or returns empty, so a capped turn can never be left without
@@ -168,10 +172,6 @@ pub(super) fn truncate_chars(text: &str, max: usize) -> String {
/// between the turn's work and the user. The output is quoted as data, under a
/// heading that says so, because none of it has been through a model on this
/// path: it is raw tool output being surfaced verbatim, not an answer.
-#[cfg(test)]
-#[path = "turn_checkpoint_tests.rs"]
-mod tests;
-
pub(super) fn build_deterministic_checkpoint(
results: &[CheckpointToolResult],
max_iterations: usize,
diff --git a/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rs b/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rs
index cb5e376b6b..97d4abb083 100644
--- a/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rs
+++ b/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rs
@@ -508,9 +508,19 @@ fn neither_share_is_ever_the_unbounded_sentinel() {
restore > 0,
"allowance {trim_allowance} left restoration unbounded"
);
+ // The same effective total the function computes — not
+ // `trim_allowance.max(NO_WINDOW_ALLOWANCE)`, which accepted any
+ // over-split below 5_120 (and whose `.min(u64::MAX)` was a no-op).
+ let total = if trim_allowance == 0 {
+ NO_WINDOW_ALLOWANCE
+ } else {
+ trim_allowance
+ };
+ // `1` stays excluded: the function deliberately keeps both shares
+ // positive, which costs one token at that degenerate size.
if trim_allowance > 1 {
assert!(
- toc + restore <= trim_allowance.max(NO_WINDOW_ALLOWANCE.min(u64::MAX)),
+ toc + restore <= total,
"allowance {trim_allowance} split into more than it had: {toc} + {restore}"
);
}