No way to kill running agent tasks (Task tool)

Resolved 💬 2 comments Opened Feb 28, 2026 by karthic-kikoff Closed Mar 28, 2026

Problem

When an agent is launched via the Task tool with run_in_background: true, there is no way to terminate it. KillShell only works on background bash processes — it errors with "Task X is not a local bash task" when given an agent task ID.

Why this matters

  1. Stale instructions — If you update project rules (e.g., CLAUDE.md) mid-session, running agents don't pick up the changes. You're forced to launch a new agent, but the old one keeps running with outdated behavior.
  1. Conflicting agents — Two agents can end up operating on the same branch/PR simultaneously (e.g., two pr-watchers pushing to the same branch), causing conflicts or duplicate work.
  1. No control — The user has no mechanism to stop a misbehaving or no-longer-needed agent. You just have to wait for it to finish on its own.

Expected behavior

KillShell should work on agent tasks, or there should be a dedicated KillTask / KillAgent tool that can terminate any background task by ID.

Reproduction

  1. Launch an agent in the background: Task with run_in_background: true
  2. Try to kill it: KillShell with the agent ID
  3. Get error: "Task X is not a local bash task"

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗