Skip to content

Fix stale sidebar spinners after thread send and stop - #6326

Merged
ymichael merged 1 commit into
mainfrom
bb/fix-sidebar-thread-spinning-thr_hy54juicfp
Oct 26, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/fix-sidebar-thread-spinning-thr_hy54juicfp

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Accepted optimistic thread predictions were written into the stored server row. If a turn finished or stopped before its mutation response arrived, accepting the prediction could overwrite the server's idle state with active or stopping. With realtime connected, nothing necessarily refetched that row, leaving the sidebar spinner running.

What changed

Keep accepted predictions as overlays until a server read started after acceptance confirms them, or confirm them explicitly with a sufficiently recent response row. Thread metadata mutations use their returned rows; send, send-now, stop, and stale responses trigger a detail read-back. Preserve pending predictions while confirming accepted ones and document the keyed-store contract.

How you verified

  • Rebased cleanly onto origin/main.
  • pnpm exec turbo run typecheck test --filter=@bb/query-tags --filter=@bb/app: typechecks passed; all 48 query-tags tests passed; app tests had 6,315 passes and one plugin-settings autosave assertion failure. All changed-area tests passed.
  • pnpm exec turbo run test --filter=@bb/app -- src/components/plugin/PluginSettings.test.tsx: all 20 tests passed on rerun without changes.
  • pnpm start:worktree --dryrun passed twice; the second run had 57/57 cache hits. Started pnpm start:worktree and checked server/daemon health and checkout ownership.
  • In the browser, sent a real initial turn and follow-up, pinned the thread, then sent another follow-up and clicked Stop. The sidebar spinner cleared on completion and stop; the API reported idle. Reload preserved the pinned thread with no working indicator.
  • The verification inventory helper reports an unmapped diagnostics CLI family; no inventory baseline was changed.

Owner-authenticated preview: prepared test thread.

Sanity check: send a short follow-up and confirm the sidebar spinner clears when it finishes. Send another and click Stop; confirm it clears again without refreshing. Pin/unpin or rename the thread and reload to check persistence.

AGENT GENERATED

The keyed store wrote an accepted prediction into the stored row,
overwriting whatever the server had reported while the write was in
flight. Stop answers only after the thread settles, so its idle update
always arrived first and was replaced with "stopping"; a send whose
turn finished first was replaced with "active", and with realtime
connected nothing refetched it, so the sidebar kept spinning.

A keyed prediction is now never written into the stored row. Once
accepted it stays until server data confirms it: a read of the row
that started after acceptance, or confirmKeyedEntity with a row the
caller already has. Plugin RPC rows are confirmed by the reads their
invalidations trigger, matching the documented plugin behaviour.

Thread guesses confirm with the row in their response when its
updatedAt is at least the stored row's (pin, unpin, rename/move, mark
read); otherwise, or when the response has no row (stop, send, send
now), the thread is read back and that read confirms the guess.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 8d0e4d1 into main Oct 26, 2026
51 checks passed
@ymichael
ymichael deleted the bb/fix-sidebar-thread-spinning-thr_hy54juicfp branch October 26, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant