Skip to content

fix: honor force_ipv4 in run_agent and legacy cli bootstrap - #37818

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:leon/fix-37662-force-ipv4-bootstrap
Open

fix: honor force_ipv4 in run_agent and legacy cli bootstrap#37818
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:leon/fix-37662-force-ipv4-bootstrap

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • add a small helper that reads network.force_ipv4 from config.yaml and applies the existing socket patch
  • call that helper during run_agent.py and legacy cli.py bootstrap so hermes-agent and python cli.py honor the same workaround as hermes
  • extend the IPv4 regression tests to cover config loading plus both uncovered entry points

Testing

  • pytest -o addopts='' tests/test_ipv4_preference.py -q
  • ruff check hermes_constants.py run_agent.py cli.py tests/test_ipv4_preference.py
  • git diff --check

Fixes #37662

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists labels Jun 3, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(...) after yaml.safe_load() without confirming that the YAML document is a mapping (hermes_constants.py:470 in 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 pins network.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.

Comment thread hermes_constants.py
except Exception:
return False

network_cfg = config.get("network", {})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

httpx/OpenAI SDK hangs on IPv6 when connecting to provider endpoints (e.g. opencode.ai) — suggest happy-eyeballs fix

3 participants