fix(gateway): fix discrepancies in gateway status#11167
Closed
snreynolds wants to merge 1 commit into
Closed
Conversation
Linux2010
added a commit
to Linux2010/hermes-agent
that referenced
this pull request
Apr 17, 2026
## What broke
Meta-only messages (e.g., `/model`, `/tools`) cause the agent to stuck
forever. After issuing a meta-only command, the agent becomes unresponsive
to subsequent requests like `/new` or regular messages.
The agent logs show the meta-only message is processed, but then the loop
waits indefinitely for a response that never arrives.
## Root cause
In `chat_with_model()` at run_agent.py:3115-3119:
- When `meta_only=True`, `_process_user_message()` is called
- It returns `meta_result` (e.g., "Model changed")
- But the code continues to Line 3136-3148 response processing
- Meta-only messages don't produce LLM responses, so response is None
- The loop waits for `_get_response_content(response)` indefinitely
The original code:
```python
if meta_only:
meta_result = await self._process_user_message(...)
# Then continues to response loop without returning
```
## Why this fix is minimal
Added 5 lines: immediate return for meta-only path.
```python
if meta_only:
meta_result = await self._process_user_message(...)
# Meta-only messages don't produce LLM responses.
# Return the meta_result directly.
return meta_result if meta_result else "Processed meta-only message."
```
No changes to regular message handling (meta_only=False path unchanged).
No changes to `_process_user_message()` or `_run_meta_only_handler()`.
No opportunistic refactoring.
## What I tested
Added test suite tests/test_meta_only_stuck_fix.py:
- test_meta_only_returns_immediately
- test_meta_only_does_not_enter_response_loop
- test_meta_only_with_none_response
- test_meta_only_flag_detection
- test_process_user_message_meta_only_calls_handler
- test_chat_with_model_meta_only_exits_early
All tests verify meta-only path returns immediately without stuck.
## What I intentionally did not change
- No changes to regular message handling
- No changes to `_run_meta_only_handler()` implementation
- No changes to response content processing
- No opportunistic refactoring
## Evidence
Before: `/model` → agent stuck, no response, `/new` ignored
After: `/model` → "Model changed" response, agent responsive
Fixes NousResearch#11167
Contributor
This was referenced Apr 18, 2026
Contributor
Author
@teknium1 sweet, thanks for the review! |
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.
What does this PR do?
Fixes inconsistent Hermes gateway status reporting for the current profile.
Before this change, different parts of Hermes used different liveness checks:
hermes gateway runand gateway-dependent tooling relied on the profile-scopedgateway.pidvalidatorhermes gateway statuscould instead rely on service-manager state or process-table scanningThat could lead to contradictory behavior such as:
hermes gateway statussaying the gateway was not runninghermes gatewaythen refusing to start because a gateway process was already runningRelated Issue
Fixes #
Type of Change
Changes Made
gateway/status.pyso callers can validate an explicit gateway PID file path with the same logic used by the main gateway runtime.hermes_cli/gateway.pyto centralize current-profile liveness reporting.find_gateway_pids()inhermes_cli/gateway.pyto fall back to the current profile PID file before relying only on process-table scanning.hermes gateway statusinhermes_cli/gateway.pyto report service/process mismatches more clearly instead of silently producing contradictory output.hermes_cli/status.pyhermes_cli/dump.pyhermes_cli/profiles.pyto use the shared PID validator instead of a weaker custom implementation.tests/gateway/test_status.pytests/hermes_cli/test_gateway.pytests/hermes_cli/test_gateway_service.pytests/hermes_cli/test_profiles.pyHow to Test
hermes gateway statusdoes not rely on the same liveness path ashermes gateway run.hermes gateway statuscan report "not running" whilehermes gatewayrefuses to start because a gateway process is already running.hermes gateway statusChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs