fix(buzz-acp): clamp idle_timeout to max_turn_duration instead of hard-erroring - #4261
Open
rsnodgrass wants to merge 1 commit into
Open
fix(buzz-acp): clamp idle_timeout to max_turn_duration instead of hard-erroring#4261rsnodgrass wants to merge 1 commit into
rsnodgrass wants to merge 1 commit into
Conversation
…d-erroring A config with idle_timeout >= max_turn_duration was rejected outright (ConfigError), taking the agent process offline. Under a restart-on-failure supervisor (Docker restart: always, systemd, k8s) that becomes a crash-loop the instant a rolling image tightens the invariant while an existing, previously-valid config sets a low max_turn_duration and leaves idle_timeout at its 900s default — which is exactly what happened to a fleet of agents on a pull_policy: always image. idle_timeout only matters if it fires before the absolute wall-clock cap; when it is >= max_turn_duration the cap fires first and idle_timeout is a dead letter (harmless). So clamp idle_timeout down to the lesser of the requested value and max_turn_duration and warn, rather than failing the whole config. Config-handling should degrade gracefully here, not take the agent down. Test updated to assert clamping (idle 900 + max 300 -> idle 300, no error). Co-Authored-By: SageOx <ox@sageox.ai> Signed-off-by: Ryan Snodgrass <rsnodgrass@gmail.com>
rsnodgrass
force-pushed
the
fix/clamp-idle-timeout-to-max-turn
branch
from
August 2, 2026 05:40
ba0f5f9 to
a06acb1
Compare
Author
|
@dcoapp recheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Config::from_argsrejects any config whereidle_timeout >= max_turn_durationwith a hardConfigError:A
ConfigErrortakes the agent process offline. Under a restart-on-failure supervisor (Dockerrestart: always, systemd, k8s), that becomes a crash-loop — and it can be triggered with no config change the moment a rolling image (pull_policy: always) tightens this invariant while an existing, previously-valid config sets a lowmax_turn_durationand leavesidle_timeoutat its 900s default.That's exactly what bit a fleet of agents:
max_turn_duration=300(a deliberate safety cap) had been valid for days; a routine image pull added theidle < maxcheck; every agent then rejected its config and crash-looped (exit 1), silently — until someone read a container log.Fix
idle_timeoutonly matters if it fires before the absolute wall-clock cap. Whenidle_timeout >= max_turn_durationthe cap fires first andidle_timeoutis a dead letter — harmless. So instead of failing the whole config, clampidle_timeoutdown to the lesser of the requested value andmax_turn_duration, and warn:A dead-letter
idle_timeoutis harmless; a hard config error takes the agent down. Config validation should degrade gracefully in this case rather than turning a benign, previously-valid setting into an outage.Test
The existing
idle_timeout_must_be_less_than_max_turn_durationtest (which only asserted a precondition) is replaced withidle_timeout_clamped_to_max_turn_duration, exercising the realConfig::from_argspath:idle=900 + max=300→idle_timeout_secs == 300, no error.Co-Authored-By: SageOx ox@sageox.ai