fix(graph): make turn-cap and template checks consistent across validation modes

This commit is contained in:
Dark-Alex-17 committed 2026-09-11 10:56:28 -06:00
1 parent b4c01e0f28
commit 32f4adb71f
4 files changed
+98 -9

No files matched your search

+7 -1
View File
@@ -262,7 +262,7 @@ async fn run_with_retries(
/// Whether `turn` (0-based) is the final turn the node's cap allows. A cap of 0 means no cap.
pub(crate) fn is_last_turn(turn: u32, max_iterations: u32) -> bool {
max_iterations > 0 && turn + 1 == max_iterations
max_iterations > 0 && turn == max_iterations - 1
}
async fn run_chat_loop(
@@ -768,6 +768,12 @@ mod tests {
assert!(!is_last_turn(u32::MAX, 0));
}
#[test]
fn is_last_turn_at_u32_max_does_not_overflow() {
assert!(is_last_turn(u32::MAX - 1, u32::MAX));
assert!(!is_last_turn(u32::MAX, u32::MAX));
}
/// The turn-top abort check runs before any client is created, so an
/// already-aborted graph never issues a model call and the node fails
/// with the abort reason rather than a connection error.