Skip to content

fix(gateway): ignore invoking CLI ancestor during PID scan#14177

Closed
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/issue-13242-gateway-self-scan
Closed

fix(gateway): ignore invoking CLI ancestor during PID scan#14177
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/issue-13242-gateway-self-scan

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

Summary

  • skip ancestor PIDs while scanning the process table for running gateways
  • keep PID-file and service-managed discovery unchanged
  • add a regression test covering an interactive CLI parent plus a real gateway child

Root cause

find_gateway_pids() scans process-table matches broadly enough to see the foreground CLI process that launched hermes gateway run --replace. Because the scan only excluded the current PID, an ancestor in the same process tree could still be reported as an already-running gateway.

Fix

Restrict the ancestor filter to _scan_gateway_pids() so only process-table matches are skipped when they belong to the current process tree. This preserves the existing PID-file fallback and service PID discovery paths.

Regression coverage

  • added TestFindGatewayPidsExclude::test_excludes_ancestor_process_tree
  • verifies a matching CLI ancestor is ignored while a real gateway/run.py process is still returned

Testing

  • scripts/run_tests.sh tests/hermes_cli/test_update_gateway_restart.py::TestFindGatewayPidsExclude::test_excludes_ancestor_process_tree
  • scripts/run_tests.sh tests/hermes_cli/test_update_gateway_restart.py
  • scripts/run_tests.sh tests/hermes_cli/test_gateway.py

Closes #13242

@alt-glitch alt-glitch added comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working labels Apr 22, 2026
@liuhao1024

Copy link
Copy Markdown
Contributor Author

Closing inactive PR with no discussion. Opened 2026-04-22 with 0 comments. Will reopen if still relevant.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery 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.

gateway run detects calling CLI process as running gateway instance (self false positive)

2 participants