Skip to content

Task thread attachments are append-only, and the list returns a dead thread first #1761

Closed

Description

@MGrin

Summary

bb tasks attach appends and there is no detach, so a task accumulates every thread ever attached to it. bb tasks threads then returns them oldest-first, which after a few respawns means the first row a reader or a script sees is usually a dead thread.

Reproduced on bb 0.38.0, macOS 26.

Observed

$ bb tasks threads SC-170
THREAD          STATUS  PRESET    TITLE
thr_7vkzpssciq  failed  Attached  SC-170 · OSS divergence audit (phase 1, analysis only)
thr_95z774573i  failed  Attached  Resuming the OSS port after a machine crash killed your predecessor…
thr_uwfpuxdt7u  idle    Attached  Resuming SC-193 after bb was updated and restarted…
thr_p9xei5xi9f  idle    Attached  Take SC-170 — the private repo has diverged from its own upstream…
$ bb tasks threads SC-202
THREAD          STATUS  PRESET    TITLE
thr_pue9jzpjw7  failed  Attached  SC-187 · transfers into a manual Scani account
thr_z5g3nw27ey  idle    Attached  Resuming SC-202 after a machine crash killed your predecessor mid-work…
thr_bbzyu33ips  idle    Attached  SC-202 · PaymentFormPage strings
thr_m82w2aermn  failed  Attached  It has been a while we didn't review our current setup on production…
thr_e3qnf2u6e3  idle    Attached  Take SC-202 — extract v3's remaining strings behind useTranslation…

In both cases the first row is a failed thread and the one actually holding the work is last. SC-202 has grown from 4 attachments to 5 since this was first noticed, so it accumulates in normal use rather than as a one-off.

Note the first row of SC-202 is also attached to the wrong task by title (SC-187), which is the same accumulation seen from another angle: a thread respawned onto new work keeps its old attachments.

No way to undo it

$ bb tasks --help
  attachment add|get|list|remove     <- file attachments, not threads
  attach                             Attach an agent thread to a task
  threads                            List threads attached to a task

attach has no inverse. attachment remove is for file attachments and does not apply.

Why it matters

The convention this machine runs on — and which bb's own task model encourages — is that a task in progress carries an attached thread, precisely so the Active view answers who holds this work. With append-only attachments and oldest-first ordering, that view answers with a corpse, and the answer looks authoritative.

It is also self-worsening: an orchestrator that correctly re-attaches on every respawn makes the ordering worse each time.

Suggested fixes, either would help

  • bb tasks detach <key> --thread <id> — the missing inverse.
  • Order bb tasks threads most-recent-first, or sort live threads above failed/error ones. This fixes the legibility half with no destructive operation at all, and is probably the cheaper change.

Ordering alone would be a real improvement even if detach never lands.

Activity

  1. added theissue type on Aug 18, 2026
  2. added
    cli
    tasks
    on Aug 18, 2026
  3. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1761.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): plugins/tasks: listTaskThreads is ORDER BY attached_at, id (oldest first) and the store's deleteTaskThread is dead code with no RPC/CLI/UI path, so attach is append-only and the first listed row after respawns is the dead predecessor.
    • Proposed fix: (1) Add taskThreadsDetach to delegationRpcContract (plugins/tasks/delegate/contract.ts) implemented via existing store.getTaskThreadByThreadId + deleteTaskThread, then publishThreadsChanged/publishTasksChanged; add bb tasks detach <key> [--thread <id>] in cli/index.ts (same thread resolution as runAttach), root-help line, README/SKILL.md updates, and a Remove control on the thread card in views/detail/threads.tsx. (2) Independently, change the store query in db/store.ts listTaskThreads to sort live threads first / most-recent-first (e.g. ORDER BY CASE WHEN live_status IN ('failed','completed…
    • Caveats: Reporter's bb 0.38.0/macOS not available; reproduced at 16ceb3a on Linux with codex threads (one forced into status=error via a bogus model). The tasks "Active" sidebar filter itself only counts starting/working threads, so dead rows do not inflate it; the corpse-first problem is in the per-task thread list (CLI, --json, show, detail page). Repro test file was left in the worktree at plugins/tas…

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Opus 5

  4. added
    confirmed-repro
    on Aug 18, 2026
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

    cliconfirmed-reprotasks

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions