Skip to content

af cleanup doesn't kill shellper processes — orphaned processes accumulate #389

Description

@waleedkadous

Problem

When af cleanup --project N runs, it:

  • Removes the worktree
  • Deletes local and remote branches
  • Kills the Tower terminal registration

But it does NOT kill the shellper process. The shellper continues running as an orphan, consuming resources. After cleaning up 6 builders, 20+ orphaned shellper processes were found still running.

Repro

  1. af spawn 100 --protocol bugfix
  2. Wait for builder to complete
  3. af cleanup --project 100
  4. ps aux | grep shellper | grep 100 — process still running

Expected

af cleanup should kill the shellper process (and any child processes like claude) before removing the worktree.

Where to Look

  • packages/codev/src/agent-farm/commands/cleanup.ts — cleanup logic
  • packages/codev/src/terminal/session-manager.ts — session teardown
  • The cleanup code calls killTowerTerminal() but this only removes the Tower registration, it doesn't send a kill signal to the shellper process

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions