[BUG] Background subagents/tasks: orphaned loops run 24h+, inconsistent state between UI / ListAgents / TaskStop, lost contact with agents (Desktop, Windows)

Status Open
Reported on v2.1.284
Maintainer reply None cached
Activity 1 comment · opened Oct 4, 2026

Summary (EN)

In a long-running Claude Desktop (Code tab) session that orchestrated many background subagents and background Bash commands over ~2 days, I lost the ability to reliably track and control the work I had started. Task state shown in the UI, returned by TaskStop, and returned by ListAgents disagreed with each other; orphaned background loops kept "running" for 24+ hours; and some agents became unreachable.

Environment

  • Claude Desktop app (Windows package) 2.16120.0.0, Code tab
  • Claude Code 2.1.284 (session entrypoint: claude-desktop)
  • Windows 11 Pro 25H2, build 26200, time zone Europe/Istanbul (UTC+3)
  • Model: Opus 5.5, effort High, permission mode: bypass
  • Session started 2026-09-23 00:06 UTC; context compacted several times. The problems below were observed 2026-10-03 → 2026-10-05 (last check 2026-10-05 00:42 UTC+3).
  • ~20 background subagents (Agent with run_in_background) plus many background Bash commands; at most 3 agents at a time

Problems

  1. Orphaned background Bash loops keep running after their subagent is finished/stopped.

Subagents started until grep -q ... ; do sleep 5; done-style wait loops as background Bash tasks. After the subagent completed (or was stopped with TaskStop), these loops stayed in the "Background tasks → Running" panel for 24–25 hours (e.g. "Wait for compiled pages – 25h 09m", "Wait for mutation results – 24h 25m"). The parent session cannot stop them: their IDs are not visible to the parent, and TaskStop only lists agents. The user has to find and stop them by hand in the panel.
Expected: stopping/completing a subagent also stops its background children, or at least the parent can list and stop them.

  1. Inconsistent agent state between tools.
  • ListAgents showed 4 subagents as completed (started 1–2 days earlier).
  • At the same moment, TaskStop on other IDs failed with "No task found" and listed those same 4 as "Running background agents". TaskStop on them then "successfully stopped" them.
  • The UI showed "10 running tasks" while only 1 real task was actually doing work.

Expected: one source of truth; completed agents should not be counted as running.

  1. Repeated "completed" notifications with interim results.

When a subagent had its own background work, the parent got a task-notification with status: completed many times (5+) for the same agent, with bodies like "Still waiting for the test results." It is impossible to tell whether the agent is finished, waiting, or dead. A later notification sometimes re-sent an old final report after the issue it reported had already been fixed and re-verified.
Expected: a distinct waiting/in_progress status for interim stops, and one final completion.

  1. Lost communication with agents.

Some agents that had been resumed earlier with SendMessage later returned "No task found with ID …" from TaskStop, while still being resumable/visible elsewhere. As the user I could not see which agents were still alive, which were waiting on their own child loops, and which had silently ended. (A message I sent to an agent during a stop was queued "at its next tool round" without a clear delivery confirmation.)

  1. The assistant itself could not see what the user saw.

The UI showed "10 running tasks" and the Background tasks panel listed several running Bash loops (24–25 h old). When I asked the assistant what was running, it answered that only 1 task was running and the rest were finished — because its tools (ListAgents, TaskStop) did not expose those orphaned Bash tasks at all. The user and the assistant were looking at two different realities.

  1. No way for the user to see the agent tree.

The Background tasks panel shows long raw command lines (full temp paths), not which agent started which task. There is no parent → child view, so orphaned tasks cannot be traced back to the agent that created them.

Impact

Real work was delayed by many hours, and a lot of usage was spent on agents and loops the user could not see or stop. The weekly usage limit warning appeared during this session.

Suggested fixes

  • Cascade stop: stopping or completing a subagent kills its background Bash children.
  • Give background tasks a parent-agent field and show a tree in the panel; let TaskStop/ListAgents list and stop child Bash tasks.
  • Make ListAgents, TaskStop, and the UI "running tasks" counter use the same state.
  • Separate "interim stop / waiting" notifications from final "completed" ones, and do not re-deliver stale final reports.
  • Auto-expire or warn on background loops that run longer than N hours with no output.

---

Özet (TR)

Claude Desktop'ta (Code sekmesi), yaklaşık 2 gün süren ve çok sayıda arka plan ajanı ile arka plan Bash komutu çalıştıran tek bir oturumda, başlattığım işleri güvenilir şekilde takip edemedim ve durduramadım. Arayüzün gösterdiği, TaskStop'un döndürdüğü ve ListAgents'ın döndürdüğü durumlar birbirini tutmadı; sahipsiz bekleme döngüleri 24 saatten uzun süre "çalışıyor" göründü; bazı ajanlarla iletişim koptu.

Ortam: Claude Desktop (Windows paketi 2.16120.0.0, Code sekmesi); Claude Code 2.1.284; Windows 11 Pro 25H2, derleme 26200, saat dilimi İstanbul (UTC+3); Opus 5.5, efor High, izin kipi "bypass". Oturum 23.09.2026 03:06'da (TR) başladı, birkaç kez özetlendi. Sorunlar 03.10.2026 – 05.10.2026 arasında görüldü (son kontrol 05.10.2026 00:42). ~20 arka plan ajanı (aynı anda en çok 3) ve çok sayıda arka plan Bash komutu.

Sorunlar

  1. Sahipsiz arka plan döngüleri: Ajanların başlattığı until grep ...; do sleep ...; done bekleme döngüleri, ajan bittikten ya da durdurulduktan sonra da 24–25 saat "Running" listesinde kaldı ("Wait for compiled pages – 25 sa", "Wait for mutation results – 24 sa"). Ana oturum bunları durduramıyor: kimlikleri görünmüyor, TaskStop yalnız ajanları listeliyor. Kullanıcı elle tek tek kapatmak zorunda.
  2. Araçlar arasında tutarsız durum: ListAgents 4 ajanı "completed" gösterirken TaskStop aynı 4 ajanı "Running background agents" diye listeledi; arayüz "10 running tasks" dedi, oysa gerçekten çalışan iş 1 taneydi.
  3. Tekrarlanan "completed" bildirimleri: Kendi arka plan işi olan bir ajan için aynı ajandan 5'ten fazla "status: completed" bildirimi geldi; içerik "Still waiting…" gibi ara durumlardı. Ajanın bitti mi, bekliyor mu, öldü mü olduğu anlaşılmıyor. Bir bildirim, bildirdiği hata çoktan düzeltilmişken eski son raporu yeniden gönderdi.
  4. Ajanlarla iletişim kopması: Daha önce SendMessage ile sürdürülen bazı ajanlar için sonradan TaskStop "No task found" dedi. Hangi ajanın canlı olduğunu, hangisinin kendi döngüsünü beklediğini, hangisinin sessizce bittiğini göremedim.
  5. Asistan, kullanıcının gördüğünü göremedi: Arayüz "10 running tasks" diyor, panelde 24–25 saatlik döngüler "Running" görünüyordu. Asistana ne çalıştığını sorduğumda yalnız 1 işin çalıştığını, gerisinin bittiğini söyledi; çünkü araçları (ListAgents, TaskStop) bu sahipsiz Bash görevlerini hiç göstermiyor. Kullanıcı ile asistan iki farklı durum görüyordu.
  6. Ajan ağacı görünmüyor: Arka plan görevleri panelinde uzun ham komut satırları var; hangi görevi hangi ajanın başlattığı görünmüyor, sahipsiz görevin kaynağı bulunamıyor.

Etki

İşler saatlerce gecikti; göremediğim ve durduramadığım ajan ve döngüler kullanım hakkını tüketti. Oturum sırasında haftalık kullanım sınırı uyarısı çıktı.

Önerilen düzeltmeler

  • Ajan durdurulunca ya da bitince başlattığı arka plan Bash görevleri de dursun.
  • Arka plan görevlerinde "hangi ajan başlattı" alanı ve panelde ağaç görünümü; TaskStop / ListAgents alt görevleri de listeleyip durdurabilsin.
  • ListAgents, TaskStop ve arayüzdeki sayaç aynı durumu kullansın.
  • Ara durak ("bekliyor") bildirimi ile son "tamamlandı" bildirimi ayrı olsun; eski son rapor yeniden gönderilmesin.
  • Saatlerce çıktı vermeden dönen arka plan döngüleri için uyarı ya da otomatik zaman aşımı.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗