fix(gateway): keep max iterations config authoritative - #43407
Closed
Soju06 wants to merge 1 commit into
Closed
Conversation
Soju06
force-pushed
the
fix/gateway-max-iterations-config-authority
branch
from
June 10, 2026 07:52
e2d7dc8 to
75ae622
Compare
Resolve gateway agent max_iterations from config.yaml agent.max_turns before falling back to HERMES_MAX_ITERATIONS, and reload runtime env before resolving the per-turn cap. This prevents stale .env HERMES_MAX_ITERATIONS=90 from reintroducing 90/90 iteration exhaustion when config.yaml sets a higher budget. Origin: local-author Upstream-PR: none Patch-State: local-only
Soju06
force-pushed
the
fix/gateway-max-iterations-config-authority
branch
from
June 10, 2026 07:54
75ae622 to
fd59683
Compare
Contributor
Verification ReviewReviewed by: automated PR review cron Summary: Clean refactor that makes config.yaml the authoritative source for across all three gateway agent-creation paths. The extracted and helpers eliminate the duplicated config-reading logic and ensure stale values cannot override explicit config. Observations:
LGTM. |
Collaborator
|
Closing as already resolved on current The config-authority contract this PR restores is already in place in
So a stale |
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
max_iterationsresolution authoritative toconfig.yamlagent.max_turnswhen it is configured.envbefore resolving the gateway agent budget so staleHERMES_MAX_ITERATIONSvalues cannot win during gateway turns.envregression with a focused gateway testWhy
A stale
HERMES_MAX_ITERATIONS=90entry in.envcan cause gateway sessions to stop withIteration budget exhausted (90/90)even whenconfig.yamlsetsagent.max_turnshigher. Removing the.envline is enough as an immediate local mitigation, but the gateway should preserve the existing config-authority contract so stale regenerated env values do not reintroduce the bug.Test Plan
python -m pytest tests/gateway/test_runtime_env_reload_config_authority.py tests/gateway/test_run_cleanup_progress.py -qpython -m compileall -q gateway/run.pygit diff --check upstream/main..HEAD