Skip to content

queued thread messages can silently vanish: reported accepted, never delivered, no longer queued #1706

Closed

Description

@pixexid

Summary

bb thread tell --mode queue (queuedMessages.create) reported success ("Thread updated") but the message was never delivered to the target thread AND is absent from its queue — a silent loss of an inter-thread message.

Concrete instance (2026-08-17, bb-collab fleet)

  • Sent a ~600-char queue-mode message to an idle thread. CLI response: "Thread thr_5q7mvrmsyi updated".
  • Target thread's event log (bb thread log): message absent (verified by grep for unique strings).
  • Target thread's queue (bb thread queue list): empty — message neither delivered nor pending.
  • Two other queue-mode messages to the same thread within the same hour delivered fine; steer-mode messages have been reliable all evening.

Other instances tonight (same fleet, same day)

  1. Two queue-mode amendments to a worker thread never arrived; sender learned only by reading the worker's log, which still showed the original brief.
  2. A queue-mode STOP sat undelivered while the worker continued on a breached commit; the sender had confirmed the send, not the delivery.

Impact

Agent fleets coordinate through these messages. A silently dropped queue-mode message deadlocks the receiving agent (it waits on an answer that was "sent") with no signal on either side. Steer mode appears unaffected.

Expected

Queued messages are durably stored and delivered, or the create call fails loudly. Silent disappearance — accepted, not queued, not delivered — should not be a possible state.

Activity

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

    @SawyerHood
    Collaborator

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

    • Verdict: PARTIALLY REPRODUCED · root-cause confidence: medium
    • Root cause (short): No permanent-drop path found (accept and drain are transactional); the "accepted, not in log, not in queue" state arises because bb thread queue list hides claimed rows (in-flight drain, or an orphaned claim after a server restart mid-drain, which is only released by the 5-minute stale-claim sweep — now exercised for real in exp. H), bb thread tell/send returns no receipt to distinguish started vs queued, and bb thread log is a window (last 20 segments; --json = oldest 100 events).
    • Proposed fix: 1) Make POST /threads/:id/messages return a receipt ({outcome:"started"|"queued", requestId?, queuedMessageId?}) and have bb thread tell print/expose it; 2) make listQueuedThreadMessages / bb thread queue list include claimed rows with a state field ("queued"|"sending") instead of hiding them (treat "sending" rows as read-only in the app reorder/edit code), and consider releasing orphaned claims at server startup instead of waiting 5 minutes; 3) make bb thread log --format json return newest events (or add --all) and print timeline page metadata so agents know they saw a window; 4) optio…
    • Caveats: Revision addressed all verifier findings: repro scripts are now parameterized (BB_REPO env, thread id argument, bb.db discovered via scripts/bb-dev-app status) and were re-run on a fresh instance (worktree wf_debcf606-e4a-38, server :22889) with real output pasted; permalinks corrected against 16ceb3a (#L513-L519, #L125, #L601-L607, start-server.ts#L255-L258); the "claim persists after server …

    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
    partial-repro
    on Aug 18, 2026
  5. nimph977 commented on Oct 27, 2026

    @nimph977

    New evidence: the queued row is gone from the database, not just hidden.

    bb 0.46.2-nightly.39132907947.1 (built from d1b60165c, 2026-10-18), installed with npx bb-app, Linux server.

    The 2026-08-18 report explains "accepted, not delivered, not queued" by claimed rows that bb thread queue list hides. In our cases the row is absent from queued_thread_messages in any state (read directly from bb.db, read-only), and the message is never delivered later.

    Setup: a plugin hands a user's reply to a busy thread through the server send path; the server answers queued (acceptThreadSendRequest).

    Frequency: 4 of 60 queued sends lost over 2026-10-25…27. The other 56 were delivered, including pairs where two rows queued behind one turn were drained in order.

    Signature A (3 cases): turn ends with a row queued, no drain. Row inserted while a turn runs → turn/completed, status completed, thread goes idle → no client/turn/requested, no error. The message text is in no thread event and not in prompt_history_entries; queued_thread_messages has no row for it (no claimed, no failed_*). The next turn starts from an unrelated input.
    Insert / turn end (UTC): 10-25 06:31:39 / 06:32:26.484; 10-25 06:35:12 / 06:35:39.313; 10-26 06:49:45 / 06:49:59.936.

    Signature B (1 case): drain takes only the younger row. Two rows queued behind one turn (inserted 10-26 21:15:45 and 21:15:53 UTC). The drain fired normally 25 ms after turn/completed (21:16:48.652) but took only the younger row; the older one was already gone — removed while the other turn was still running.

    Healthy drain for comparison: turn/completed → 20–30 ms → client/turn/requested (source tell, target new-turn) → turn/started.

    What we checked (installed bundle, read only — not runtime):

    • No normal path deletes an inline row without delivery: delivery deletes claimed rows in the same transaction as client/turn/requested (consumeClaimedRows); errors and races keep the row (failed_retrying → failed_exhausted, stale-claim release, edit hold).
    • Paths that do delete: the explicit delete route (deleteQueuedMessage) — it emits a cancel event to plugins, we saw none; cascade on thread deletion — the threads are alive; retry-row cleanup on history edit — not this row type.
    • A missed thread-ready wake would delay delivery (idle recovery retries), not remove the row.
    • Not reproduced on demand. Not tested on 0.47.x. Our build predates Recover orphaned queued messages immediately on server startup #5785 and Prevent automatic queued messages from overtaking a pending send #6247; we did not check whether either is related.

    Why we cannot see the cause: none of the 33 thread event types records queue insert / claim / delete, and the server log has no queue lines at all — zero lines within ±2.5 s of every loss and of every healthy drain. The last queue lines in our logs (qmsg_…, level 30) date from 2026-10-05/06; the current build (installed 2026-10-19) writes none.

    Impact: a user's answer to an agent is silently lost; the agent keeps waiting. Our workaround: an external watcher re-sends the answer if it is accepted but neither delivered nor queued after 15 min.

    Ask:

    1. Find the race that removes a queued row during a running turn without delivering it.
    2. Bring back queue operation logging (insert, claim, release, delete with the reason), at least at info level as before, so the next case shows which operation removed the row.

    AGENT GENERATED — investigation by our agents; the internal report is not public.

  6. ymichael commented on Nov 17, 2026

    @ymichael
    Collaborator

    This report predates several queue fixes: #5785 (orphaned claims released at startup), #6493, #6956 and #7531 (sends return a queued/sent receipt). We found no remaining path on main that drops a queued message silently. Closing.

    AGENT GENERATED

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

    partial-reprothreads

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions