Skip to content

Stopping a workflow leaves Bash background shells started by its subagents running (Linux) #103658

Open

Description

@star-ga

Version: Claude Code 2.1.289, Ubuntu 26.04.1 LTS.

What happens
Subagents in a workflow started long-lived Bash commands (polling loops over ssh, a copy loop, an ssh reconnect loop). After TaskStop on the workflow, those shells kept running: their parent became systemd --user, nothing read their output, and they kept opening ssh connections to a remote build host for over an hour. Together with other load, that host ran out of memory and had to be rebooted. We had to find and kill them by PID.

Expected
Stopping a workflow (or an agent) terminates the process trees its agents started from the Bash tool, or at least lists the survivors so the user can stop them.

Repro

  1. A workflow agent runs, from the Bash tool, something like bash -c 'while true; do ssh host uptime; sleep 30; done' & (or run_in_background).
  2. TaskStop the workflow.
  3. ps -eo pid,ppid,args | grep 'ssh host' → the loop is still alive, reparented to systemd --user.

Related: #101012 (same class on Windows / Git Bash), #74133 (orphaned background sub-agents).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions