Skip to content

fix: clean up stale gateway pid files and skip wrapper memory plugins#13872

Closed
aditzel wants to merge 2 commits into
NousResearch:mainfrom
aditzel:fix/stale-gateway-pid-memory-plugin-classification
Closed

fix: clean up stale gateway pid files and skip wrapper memory plugins#13872
aditzel wants to merge 2 commits into
NousResearch:mainfrom
aditzel:fix/stale-gateway-pid-memory-plugin-classification

Conversation

@aditzel

@aditzel aditzel commented Apr 22, 2026

Copy link
Copy Markdown

Summary

  • unlink stale gateway.pid records directly when get_running_pid() determines the recorded process is gone
  • auto-classify wrapper-style user memory provider plugins as exclusive when their implementation advertises register_memory_provider / MemoryProvider
  • add regression coverage for both cases

Why

Two separate foot-guns were showing up locally:

  1. A stale JSON gateway.pid could survive cleanup because remove_pid_file() only deletes the file when the current process owns it. That left launchd stuck in a restart loop, repeatedly logging PID file race lost to another gateway instance.
  2. User-installed memory-provider plugins under $HERMES_HOME/plugins/ were still visible to the general plugin loader. Wrapper-style plugins (repo-root __init__.py, real implementation under src/) then tried to call ctx.register_memory_provider(...) against the generic PluginContext, producing warnings like:
    • Failed to load plugin 'muninndb': 'PluginContext' object has no attribute 'register_memory_provider'

Test Plan

  • pytest tests/gateway/test_status.py::TestGatewayPidState::test_get_running_pid_removes_stale_json_pid_file -q
  • pytest tests/hermes_cli/test_plugins.py::TestPluginDiscovery::test_user_memory_provider_plugins_are_classified_exclusive -q
  • pytest tests/hermes_cli/test_plugins.py tests/gateway/test_status.py -q

Notes

  • I also ran the broader core suite locally (python -m pytest tests/ -q --ignore=tests/integration --ignore=tests/e2e --tb=short -n auto) and reproduced a large set of unrelated baseline failures; origin/main is currently red on tests.yml as well.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

PID cleanup portion overlaps with #13709, #13559, and #13713 — all address stale gateway.pid files via different approaches. Plugin classification fix is unique to this PR.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the detailed PR, @aditzel! Both fixes here have since landed on main independently.

Automated hermes-sweeper review.

Both fixes live at hermes_cli/plugins.py:767-785 and gateway/status.py:249-264 respectively.

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 comp/plugins Plugin system and bundled plugins 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.

3 participants