fix(gateway): refresh cached agent max_iterations after per-turn config reload - #32544
Closed
Zyrixtrex wants to merge 1 commit into
Closed
fix(gateway): refresh cached agent max_iterations after per-turn config reload#32544Zyrixtrex wants to merge 1 commit into
Zyrixtrex wants to merge 1 commit into
Conversation
Collaborator
2 tasks
Collaborator
|
Closing as already resolved on current This PR's specific fix — refreshing a reused cached agent's self._init_cached_agent_for_turn(agent, _interrupt_depth)
# Refresh agent max_iterations from current config
# (cached agent may have been created with old config)
agent.max_iterations = max_iterationswhere |
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.
Summary
This fixes a gateway stale-state bug where
agent.max_turnschanges were not applied reliably on the next turn.In the cached-agent path, the gateway could continue using an outdated
max_iterationsvalue even after the per-turn config/env reload completed.Fixes #
Changes
HERMES_MAX_ITERATIONSafter_reload_runtime_env_preserving_config_authority()max_iterationswhen reusing a cachedAIAgentFiles
gateway/run.pytests/gateway/test_agent_cache.pyValidation
Ran locally: