Skip to content

fix: add self-termination guard for pkill/killall targeting hermes/gateway#3400

Closed
arasovic wants to merge 1 commit into
NousResearch:mainfrom
arasovic:fix/self-termination-guard
Closed

fix: add self-termination guard for pkill/killall targeting hermes/gateway#3400
arasovic wants to merge 1 commit into
NousResearch:mainfrom
arasovic:fix/self-termination-guard

Conversation

@arasovic

Copy link
Copy Markdown
Contributor

Problem

A Telegram gateway agent ran pkill -f "cli.py --gateway" and killed its own process. This command is not caught by any existing DANGEROUS_PATTERNS entry — the current pkill pattern only matches pkill -9 (force kill), not pkill -f (filter by name).

This is a variant of #2617, where the agent killed the gateway via kill PID + &disown.

Closes #3397

Changes

tools/approval.py — Add one pattern to DANGEROUS_PATTERNS:

(r'\b(pkill|killall)\b.*\b(hermes|gateway|cli\.py)\b', "kill hermes/gateway process (self-termination)")

tests/tools/test_approval.py — 4 new tests:

  • pkill -f "cli.py --gateway" → detected
  • killall hermes → detected
  • pkill -f gateway → detected
  • pkill -f nginx → not flagged (unrelated process)

Test plan

  • python -m pytest tests/tools/test_approval.py -q — 91 passed, 0 failed

…teway (NousResearch#3397)

A Telegram gateway agent ran `pkill -f "cli.py --gateway"` and killed
its own process. This pattern was not caught by DANGEROUS_PATTERNS.

Add a pattern to detect pkill/killall commands targeting hermes, gateway,
or cli.py processes, triggering the existing approval flow.

Closes NousResearch#3397
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #3593 — cherry-picked onto current main with authorship preserved, all 4 tests included. Thanks @arasovic!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: agent self-terminates via pkill -f "cli.py --gateway" — not caught by DANGEROUS_PATTERNS

2 participants