runIdleWatchdogWindow function

Duration runIdleWatchdogWindow({
  1. required Duration floor,
  2. required Duration? explicitIdle,
})

The run-idle watchdog window for a run streaming a model whose explicit stream-idle patience is explicitIdle (gh-1617 I1): max(floor, explicitIdle) — a warming-up model gets exactly the patience its config declares, and nothing configured keeps the floor byte-for-byte (AC3). Never LOWERED by a tight idle override: the watchdog stays at least as patient as it was by default.

Implementation

Duration runIdleWatchdogWindow({
  required Duration floor,
  required Duration? explicitIdle,
}) {
  final idle = explicitIdle;
  return idle != null && idle > floor ? idle : floor;
}