Remote threads can permanently fail to appear under their remote project (one-shot, exact-match `remote_connection` backfill)
What happens
Threads created in a remote (SSH) project can end up with remote_connection = NULL in sidebar_threads. The sidebar only surfaces a thread under a remote project group when the thread's stored connection matches that project's host (entries_for_main_worktree_path / entries_for_path + matches_remote_connection), so those threads can never appear under their remote project — they only re-form a phantom local project group with the same paths. There is no in-product way to fix the association afterwards.
Why it happens (as best we can tell from 1.21.0 / main)
The backfill migrate_thread_remote_connections fills missing connections by matching a thread's folder_paths / main_worktree_paths exactly against "recent remote workspaces that don't also exist as local workspaces", and it runs once (kv key thread-metadata-remote-connection-backfill):
- Path lists that don't line up exactly (linked worktrees, subfolders, any drift) are missed forever.
- If the path list also exists as a local workspace (common: same repo checked out on both sides), the remote entry is skipped by design, so threads that only ever lived remotely can still miss the tag.
- Once the key is set nothing re-runs or retries, and no UI action can re-associate a thread.
Our data point
30 threads belonging to a remote ~/Company (SSH) project: only 6 had a connection in sidebar_threads; 24 were NULL and invisible under the remote project group. We repaired them by writing the connection JSON directly into sidebar_threads — not something a user can do.
Possible directions
- Set
remote_connectionwhen a thread is created/opened while the active workspace is remote (instead of relying only on a backfill). - Make the backfill retryable / re-runnable when workspaces change, and match by most-specific path prefix instead of exact
PathListequality. - Give the user a way to re-associate a thread with a project/host once it's been mis-layered.
Source: zed-industries/zed