feat: natural-language abort triggers#2911
Open
Glucksberg wants to merge 1 commit intoNousResearch:mainfrom
Open
feat: natural-language abort triggers#2911Glucksberg wants to merge 1 commit intoNousResearch:mainfrom
Glucksberg wants to merge 1 commit intoNousResearch:mainfrom
Conversation
1b00408 to
9923d68
Compare
Author
|
human note: manually tested it. it works. and it helps a lot when my qwen 9b goes nuts. |
9868324 to
fd65205
Compare
Detect plain-text abort requests ("stop", "stop hermes", etc.) and
immediately abort the running agent — no slash command required.
On 2026-02-23 an AI agent deleted a user's entire Gmail inbox because
context compaction discarded the "confirm before acting" instruction.
The user typed "STOP" but only /stop was recognised. This ensures
plain-text abort requests are caught in Hermes.
Implementation:
- tools/abort_triggers.py: trigger sets, normalization, is_abort_request()
- gateway/platforms/base.py: intercept abort at adapter level before
message is enqueued (critical — without this, abort triggers were
queued as pending messages and only processed after the agent finished)
- gateway/run.py: intercept abort in gateway runner (fallback path)
- cli.py: intercept abort in the CLI interrupt queue
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fd65205 to
7d2720d
Compare
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.
Summary
base.py) and the gateway runner (run.py) — the adapter-level check is critical because the active-session handler short-circuits before messages reach the gateway runner🚫 Agent aborted.Background
On 2026-02-23 an AI agent (OpenClaw) deleted a user's entire Gmail inbox after context compaction discarded the "confirm before acting" instruction. The user typed "STOP" in the chat but the agent kept going because only the
/stopslash command was recognised. This patch ensures that will never happen in Hermes.Trigger list
Single-word:
stop,abort,cancel,halt,quitMulti-word:
stop hermes,stop agent,stop please,stop now,stop it,stop that,stop action,stop run,stop everything,stop allAll matching is exact after normalization (lowercase, strip trailing punctuation, collapse spaces). Partial matches like "when you stop hermes from doing that task..." are NOT caught.
Implementation
tools/abort_triggers.pyABORT_TRIGGERS(single-word),ABORT_TRIGGER_PHRASES(multi-word),_normalize(),is_abort_request()gateway/platforms/base.pyBasePlatformAdapter._handle_message()before the message is enqueued as a pending interrupt — this is the primary intercept point for Telegram/Discord/etc.gateway/run.pyGatewayRunnerpriority handler (fallback for other code paths)cli.pytests/test_abort_triggers.pyWhy the adapter-level check matters
When an agent is actively running,
base.py's active-session handler intercepts incoming messages and enqueues them as priority interrupts — the message never reaches the gateway runner. Without the adapter-level check, "stop hermes" was queued as a pending message and processed as normal input after the agent finished its turn.Test plan
tools/abort_triggers.py)🤖 Generated with Claude Code