[Bug]: Deleting the open thread opens a snoozed or settled thread#29609

opened28d agobyIIweisc

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. In one project, have three finished threads created in this order: "Document the price helpers", "Add currency formatter", "Add a clamp helper".
  2. Right-click "Add currency formatter" in the sidebar, choose Snooze, then In 3 hours. It moves to the Snoozed shelf.
  3. Open "Add a clamp helper".
  4. Click its title in the header, choose Delete, then Confirm.

Expected behavior

T3 Code opens "Document the price helpers", the next thread visible in the sidebar. "Add currency formatter" stays hidden until its wake time, as docs/user/thread-sidebar.md describes for snoozed threads. Settling or snoozing the open thread already skips parked threads and goes to the next visible one.

Actual behavior

T3 Code opens "Add currency formatter", the snoozed thread. The header shows it and the status line reads "Snoozed, 3h left · Wake now". A settled thread behaves the same: deleting the open thread opened a thread from the Settled shelf.

Cause: deleteThread passes every thread of the environment to getFallbackThreadIdAfterDelete, which keeps the threads of the same project, drops the deleted ones, sorts by recency and takes the first. It never checks whether a thread is snoozed or settled.

https://github.com/pingdotgg/t3code/blob/60aec28a9c6fdb7417a7382ec094ccc4984d0738/apps/web/src/hooks/useThreadActions.ts#L552

https://github.com/pingdotgg/t3code/blob/60aec28a9c6fdb7417a7382ec094ccc4984d0738/apps/web/src/components/Sidebar.logic.ts#L1213-L1238

Settle and snooze navigate with planForwardNavigation, which walks the sidebar order and skips settled and snoozed threads:

https://github.com/pingdotgg/t3code/blob/60aec28a9c6fdb7417a7382ec094ccc4984d0738/apps/web/src/components/Sidebar.tsx#L1594

The fallback came in with #1395 ("Choose the next visible thread by sidebar sort order"), before settled and snoozed threads existed, and was not updated for them.

Impact

Minor bug or occasional failure

Version or commit

main @ 60aec28a9c (reproduced on a dev server built from 0847a448fd). v0.1.6 has the same code.

Environment

Linux, Chromium 151, Node 26.12.1, Replay (dev) provider threads

Logs or stack traces

No response

Screenshots, recordings, or supporting files

Session replay: https://bugreels.com/sessions/f623fa8b-2314-4033-87bb-15d4a769a688/recording?t=301 (sidebar before the delete at 5:01, delete dialog at 5:26, the snoozed thread opened at 5:35 and still open at 7:24)

Workaround

No response


Drafted with Claude Code (Claude Opus 5.5). I reproduced it on a local dev server and checked the cause against the linked source.

Synced from GitHub

@juliusmarminge Btw, was this bug report helpful? 😛