fix: honor force_ipv4 in run_agent and legacy cli bootstrap - #37818
Open
LeonSGP43 wants to merge 1 commit into
Open
fix: honor force_ipv4 in run_agent and legacy cli bootstrap#37818LeonSGP43 wants to merge 1 commit into
LeonSGP43 wants to merge 1 commit into
Conversation
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for tracing this to the uncovered bootstraps. The premise is still valid on current main: run_agent.py:125-127 and cli.py:180-182 load their Hermes state without applying the preference, whereas hermes_cli/main.py:572-605 does.
Problems
- The new helper dereferences
config.get(...)afteryaml.safe_load()without confirming that the YAML document is a mapping (hermes_constants.py:470in this PR). A valid scalar-root config can therefore raise during either newly added import-time call. - The helper reads raw user config but bypasses the managed-scope overlay that the canonical bootstrap applies at
hermes_cli/main.py:561-574. That would make these entry points disagree when an administrator pinsnetwork.force_ipv4.
Suggested changes
- Guard non-mapping YAML roots and add a scalar-root regression test.
- Apply the managed-scope overlay before reading
network.force_ipv4, with coverage for an administrator-pinned value.
Automated hermes-sweeper review.
| except Exception: | ||
| return False | ||
|
|
||
| network_cfg = config.get("network", {}) |
Contributor
There was a problem hiding this comment.
yaml.safe_load() may return a scalar or list for valid YAML. Guard config with isinstance(config, dict) before this access; otherwise this import-time helper can raise and prevent run_agent or cli from starting when config.yaml has a non-mapping root.
This was referenced Aug 5, 2026
Open
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
network.force_ipv4fromconfig.yamland applies the existing socket patchrun_agent.pyand legacycli.pybootstrap sohermes-agentandpython cli.pyhonor the same workaround ashermesTesting
pytest -o addopts='' tests/test_ipv4_preference.py -qruff check hermes_constants.py run_agent.py cli.py tests/test_ipv4_preference.pygit diff --checkFixes #37662