t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Threads launched from a linked machine show at the top level once their parent is an older settled thread

Open Abdullah97128 opened this issue 3 weeks ago • 1 comments

Before submitting

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

Area

Sidebar / linked environments

Steps to reproduce

  1. Link two machines (A and B).
  2. From a thread on B, launch threads on A (a remote delegate_task, or a launch that sets delegatedFrom).
  3. Settle that parent thread on B.
  4. Settle 25 or more newer threads on B.
  5. Look at A's sidebar, then reload the window.

Expected behavior

The threads launched from B stay nested under their parent and hidden from A's top-level list, the same as when the parent is recent.

Actual behavior

They all show as top-level threads in A's sidebar, and reloading doesn't change that. In our case 63 threads (finished tests and relays) appeared at once, and more appear as B settles new work. Archiving them by hand is the only workaround.

Diagnosis

  • The server sends only the 25 most recently settled listed threads in the shell snapshot (shellTrimFacts, olderSettledBeforeMs = settledTimes[24]). The client asks for this trim with omitOlderSettled when the server advertises shellOlderSettled.
  • The client hides a delegated thread only when its parent is in the parent environment's thread index: environment-delegated-under-parent checks environmentThreadIndexAtom(parentEnv).get(parentThreadId)?.archivedAt === null. A parent left out by the trim returns undefined, so the child is not hidden.
  • This is the same cause as #26467 (links to older settled threads show "Thread no longer available"), with a different symptom.
  • Possible fix: count a parent the snapshot left out as present (it is settled, not archived), or load the parent with the family read before deciding.

Impact

The sidebar fills with finished threads from other machines, mixed in with the user's own work, and keeps growing.

Version or commit

0.1.7 on both machines (Mac desktop and Linux server).

Environment

macOS desktop app linked to a Linux server over Tailscale Serve, full access.

Abdullah97128 avatar Nov 06 '26 04:11 Abdullah97128

Duplicate of pingdotgg/t3code#30320 (https://github.com/pingdotgg/t3code/issues/30320). It reports the same symptom: a thread delegated from a linked environment is listed at the top level once its settled parent falls outside the newest 25 settled threads in the shell snapshot. It names the same cause: delegatedUnderParentAtom in packages/client-runtime/src/state/threadShell.ts finds no entry for the trimmed parent, so it does not hide the child.

On current main (4a087861d0) that check is unchanged, and no open PR fixes it yet. Closing this one so the fix is tracked in https://git.cafe/pingdotgg/t3code/issues/30320. Your diagnosis and the scale you saw (63 threads appearing at once, growing as more work settles) are useful context there.

juliusmarminge avatar Nov 06 '26 04:11 juliusmarminge