Repository navigation
Fix stale sidebar spinners after thread send and stop - #6326
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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 --dryrunpassed twice; the second run had 57/57 cache hits. Startedpnpm start:worktreeand checked server/daemon health and checkout ownership.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.