Fix thread's worktree being discarded upon archiving the previous thread in the sidebar (#52271)

This PR fixes a bug where archiving a thread could cause the *next*
thread to be opened in the current workspace, even though it belonged to
a different worktree.

Release Notes:

- N/A
cc56071c96Max Brunsfeld committed on 3/24/2026, 12:23:33 AM· committed by GitHubparent28687ff
1 file changedLine totals unavailable