#19256: feat: add 'stop all' command and fix subagent cascade on word-trigger abort
size: S
Cluster:
Subagent Enhancements and Features
## Problem
When a channel has multiple active agents running (e.g. a main session that spawned background work), saying **'stop'** only kills the current agent run. The next active session starts speaking and the user has to say stop again — repeat for every session. This is especially painful in voice mode.
Two root causes:
1. **Bug:** `handleAbortTrigger` (word-trigger: 'stop', 'abort', 'esc'…) does **not** call `stopSubagentsForRequester`, so registered subagents keep running after a word-trigger abort. The `/stop` slash command already calls it correctly — this brings word triggers in line.
2. **Gap:** Even with the fix above, sessions that were activated *indirectly* (e.g. a Discord channel session spun up when a subagent posted a message) are not in the subagent registry and are not stopped by any existing mechanism.
## Solution
### Fix 1 — `handleAbortTrigger` now stops registered subagents
Mirrors what `/stop` already does: calls `stopSubagentsForRequester` with cascade, then reports the count in the reply text.
### Fix 2 — new `stop all` command (`handleStopAllCommand`)
Trigger phrases (case-insensitive): **stop all**, **abort all**, **stop everything**, **cancel all**, **cancel everything**, **/stop-all**
Behaviour:
- Calls `stopSubagentsForRequester` (cascade-stops everything in the subagent registry)
- Then calls new `stopAllAgentSessions` which iterates the live session store and aborts every session that shares the same agent prefix (e.g. `agent:main`) and was active in the last 30 minutes — excluding the caller's own session
Scoping is intentionally conservative: same agent, recent activity only. Does not kill sessions from other agents or sessions idle >30 min.
## Files changed
- `src/auto-reply/reply/abort.ts` — adds `STOP_ALL_TRIGGERS`, `isStopAllTrigger`, `stopAllAgentSessions`
- `src/auto-reply/reply/commands-session.ts` — fixes `handleAbortTrigger` + adds `handleStopAllCommand`
- `src/auto-reply/reply/commands-core.ts` — registers `handleStopAllCommand` in the handler chain
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds cascade subagent stopping to word-trigger abort and introduces a new "stop all" command. The PR fixes a bug where saying "stop" in voice mode would only kill the current agent, leaving background sessions running. Now `handleAbortTrigger` mirrors `/stop` behavior by calling `stopSubagentsForRequester`. The new "stop all" command (`/stop-all` or phrases like "stop all", "abort all") goes further by terminating all recently-active sessions for the current agent (not just registered subagents), with conservative scoping: same agent prefix only, active within 30 minutes, excludes caller's own session.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The implementation correctly addresses both stated problems with clean, focused changes. The bug fix brings `handleAbortTrigger` in line with `/stop` behavior, and the new "stop all" command has conservative scoping rules (same agent, 30-minute window, excludes self) that prevent unintended impact. The code follows existing patterns for session cleanup and authorization checks.
- No files require special attention
<sub>Last reviewed commit: aec5eea</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#21115: fix(agent): immediately abort active run on stop/abort message during…
by anillBhoi · 2026-02-19
79.8%
#10509: fix(telegram): bare abort words bypass debounce + clear buffered me...
by romancircus · 2026-02-06
76.1%
#13284: fix(commands): /stop now kills orphaned exec processes
by thebtf · 2026-02-10
73.2%
#22982: fix: prevent stale threadId from routing subagent announces to wron...
by unboxed-ai · 2026-02-21
73.0%
#8471: fix(subagent): add defensive checks for undefined string fields
by adam-smeth · 2026-02-04
72.7%
#20072: feat(sessions_spawn): add sessionKey param to reuse sub-agent sessions
by Be1Human · 2026-02-18
72.4%
#18468: fix(agents): prevent infinite retry loops in sub-agent completion a...
by BinHPdev · 2026-02-16
71.7%
#17721: fix: abort child run on subagent timeout + retry with backoff + sta...
by IrriVisionTechnologies · 2026-02-16
71.6%
#19923: feat: track held messages during compaction gate and split verifica...
by PrivacySmurf · 2026-02-18
71.4%
#23166: fix(agents): restore subagent announce chain from #22223
by tyler6204 · 2026-02-22
71.4%