Skip to content

Respect HERMES_IGNORE_RULES in gateway agent creation - #29930

Open
prantikmedhi wants to merge 1 commit into
NousResearch:mainfrom
prantikmedhi:codex/fix-gateway-ignore-rules
Open

Respect HERMES_IGNORE_RULES in gateway agent creation#29930
prantikmedhi wants to merge 1 commit into
NousResearch:mainfrom
prantikmedhi:codex/fix-gateway-ignore-rules

Conversation

@prantikmedhi

Copy link
Copy Markdown

What changed

This threads HERMES_IGNORE_RULES through the two gateway AIAgent(...) construction paths that were still missing it:

  • the main cached/session agent path in gateway/run.py
  • the /background task path in gateway/run.py

I also added regression coverage for both paths in tests/gateway/test_session_model_override_routing.py.

Why

cli.py already turns HERMES_IGNORE_RULES=1 into skip_context_files=True and skip_memory=True, but gateway sessions were still building fresh agents without those flags. That meant Telegram and other gateway-driven sessions could keep injecting memory and context files even when the env var was set.

Validation

I couldn't get a full working clone of this repo to complete cleanly in this environment, so I wasn't able to run the repo's pytest target here. I did at least verify the edited Python files compile with python3 -m py_compile.

Fixes #29911.

@prantikmedhi

Copy link
Copy Markdown
Author

Took the smallest path I could here. The actual fix is just wiring HERMES_IGNORE_RULES into the two gateway AIAgent(...) constructors that were still bypassing it, plus a couple of regression tests so it does not drift again later. I couldn’t get a full local clone of this repo to finish cleanly in this environment, so I only verified syntax with python3 -m py_compile rather than a full pytest run.

@prantikmedhi
prantikmedhi marked this pull request as ready for review May 21, 2026 17:08
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles labels May 21, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression fix. Current main still omits both flags in the background constructor at gateway/run.py:13408 and the fresh session-agent constructor at gateway/run.py:18292; agent/agent_init.py:1363 confirms that skip_memory=True prevents persistent-memory initialization, while agent/system_prompt.py:446 gates context-file injection on skip_context_files.

The original branch predates substantial movement in gateway/run.py, so salvage should relocate the same two additions into these current constructors and retain the two constructor-capture regressions.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 13, 2026
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/gateway Gateway runner, session dispatch, delivery 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 sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(gateway): HERMES_IGNORE_RULES env var ignored by gateway/run.py (Telegram sessions)

3 participants