From 29fa45e501637374838c5a5ac5ea78e6b7ff7a87 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 1 Nov 2026 06:06:05 +0100 Subject: [PATCH] tempo sim: the busy report stays up until a launch comes on time Co-Authored-By: Claude Sonnet 5.5 --- crates/mind-body/src/tempo/sim.rs | 7 +++++-- crates/mind-body/src/tempo/tests.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/mind-body/src/tempo/sim.rs b/crates/mind-body/src/tempo/sim.rs index e3ac668..e1afa24 100644 --- a/crates/mind-body/src/tempo/sim.rs +++ b/crates/mind-body/src/tempo/sim.rs @@ -235,7 +235,8 @@ fn drive( let mut rng = Rng(seed); let mut busy_rng = Rng(seed ^ 0xB05E_B05E_B05E_B05E); let mut busy_until = vec![W0; scenario.minds]; - let mut stalled = false; + // The heartbeat's report: a beat since the last launch found every Mind busy. + let (mut stalled, mut found_busy) = (false, false); let mut state = Fallback::default(); let mut used = scenario.start_used; let mut resets = W0 + WINDOW_MS; @@ -309,7 +310,8 @@ fn drive( out.last_beat = beat; if now - last_turn >= i64::from(beat) * 1000 { if let Some(mind) = busy_until.iter().position(|&until| until <= now) { - stalled = false; + stalled = found_busy; + found_busy = false; let step = scenario.cost_step.map_or( 1.0, @@ -331,6 +333,7 @@ fn drive( } } else { stalled = true; + found_busy = true; out.stalls += 1; } } diff --git a/crates/mind-body/src/tempo/tests.rs b/crates/mind-body/src/tempo/tests.rs index 5af29e1..6a1f383 100644 --- a/crates/mind-body/src/tempo/tests.rs +++ b/crates/mind-body/src/tempo/tests.rs @@ -870,7 +870,7 @@ fn a_saturated_report_stops_integration_toward_more_spend_only() { assert!(s.integral > integral, "not saturated, it integrates again"); let integral = s.integral; let t = t + 60_000; - control(&T, &mut s, Some(&read(700, t)), t, 900, false, true); + control(&T, &mut s, Some(&read(480, t)), t, 900, false, true); assert!( s.integral < integral, "ahead, saturation does not hold the integral up"