Skip to content

fix(gateway): preserve max_turns after env reload (salvage #19183) - #21240

Merged
teknium1 merged 1 commit into
mainfrom
salvage/pr-19183
May 7, 2026
Merged

fix(gateway): preserve max_turns after env reload (salvage #19183)#21240
teknium1 merged 1 commit into
mainfrom
salvage/pr-19183

Conversation

@teknium1

@teknium1 teknium1 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Closes #19183 via salvage. Fixes #19158.

Summary

Gateway re-reads ~/.hermes/.env every turn to pick up rotated API keys. HERMES_MAX_ITERATIONS bridged from agent.max_turns at startup would silently revert to a stale value from .env on every subsequent turn.

Add _reload_runtime_env_preserving_config_authority() that reloads .env then re-applies agent.max_turns from config.yaml into HERMES_MAX_ITERATIONS, keeping config.yaml authoritative.

Validation

scripts/run_tests.sh tests/gateway/test_runtime_env_reload_config_authority.py → 2 passed.

Original author: @altmazza0-star.

@teknium1
teknium1 merged commit 8308d18 into main May 7, 2026
6 of 11 checks passed
@teknium1
teknium1 deleted the salvage/pr-19183 branch May 7, 2026 12:49
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway max_turns can be overridden by stale HERMES_MAX_ITERATIONS from .env

3 participants