[Bug]: Orchestrator can delete its own active worktree during worker cleanup

Author: somewherelosttCreated Sep 18, 2026Updated Sep 19, 2026
Labelsbugcomp/daemon

Reported via AO support. In an active project-orchestrator Chat session, the user approved a rescue-and-cleanup request:

Create a new worker to rescue and then report back here and terminate. For the rest you can clean them up.

During that cleanup, the orchestrator removed its own active worktree and deleted its branch. The persistent OpenCode process remained alive, but the next message failed with:

json
{"code":-32603,"message":"Internal error: OpenCode service failure","data":{"providerData":{"service":"session"}}}

Recreating the worktree at the same path did not recover the running process. After OpenCode was respawned in the recreated worktree, message processing resumed and later turns succeeded.

Environment reported:

  • Ubuntu 24.04.4 LTS on x86_64
  • AO dev build from September 14
  • OpenCode 1.18.30
  • Chat mode through the persistent ACP host

Expected: cleaning up workers must not remove the active orchestrator's own worktree or leave its Chat session running against a deleted working directory.

Source: Untrivial-ai/agent-orchestrator