Skip to content

Linked machines: poll a busy machine every 3 s and show a finished run at once - #27

Closed
hsalazr wants to merge 1 commit into
mainfrom
t3/multi-environment-thread-detection
Closed

hsalazr wants to merge 1 commit into
mainfrom
t3/multi-environment-thread-detection

Conversation

@hsalazr

@hsalazr hsalazr commented Nov 11, 2026

Copy link
Copy Markdown
Owner

What and why

Threads on a linked machine have no live stream, so the deck only knows what its polls tell it. Two things made those keys lag:

  • The active list of every linked machine was asked for at most every 10 s.
  • When a run finished, the thread left the active list, but its finished state only arrived with the recent roots, which were fetched every 30 s. Until then the key kept showing the stale "working" entry, or dropped off the deck if the thread had started after the last fetch.

Now:

  • A machine with something running is asked every 3 s. An idle machine, or one that is failing, stays at 10 s.
  • Each machine has its own clock, counted from when its last answer came back, so a slow link is never asked faster than it answers.
  • When a top-level thread leaves a machine's active list, its recent roots are fetched in the same round. A finished run turns green at that poll. A subagent finishing doesn't trigger the fetch.
  • The linked-machines timer wakes when the next poll is due (at least 250 ms apart, at most 2 s), not on a fixed 2 s tick, so 3 s means 3 s.

The Poll setting is still the lower bound: with Poll at 10 s, a busy linked machine is asked every 10 s.

Not in this change

A thread on a linked machine whose turn ended with background work still running (subagents, commands) still shows as done. t3_thread_list doesn't report that yet; pingdotgg/t3code#33858 would add it.

Testing

  • npm test: 192 pass, 10 skipped, 0 fail. npm run typecheck passes.
  • Four new tests in test/remotes.test.ts: the busy and idle paces, a finished run showing at the next active poll, a subagent finishing not fetching the recent roots, and a failing machine staying at the idle pace. The finished-run test fails with the same-round fetch removed.
  • Not tested against a real linked machine: the plugin runs on macOS and this was written on Linux.

…n at once

A machine with something running is asked for its active list every 3 s
instead of every 10 (idle or failing: still 10), each machine on its own
clock, counted from when its last answer came back. When a top-level
thread leaves the active list, the recent roots are fetched in the same
round, so a finished run no longer shows as working, or drops off the
deck, until the 30 s refresh.
@hsalazr

hsalazr commented Nov 11, 2026

Copy link
Copy Markdown
Owner Author

Folded into #28, which now targets main and carries this commit unchanged, so the 1.2.2 patch needs one CI run and one merge.

@hsalazr hsalazr closed this Nov 11, 2026
@hsalazr
hsalazr deleted the t3/multi-environment-thread-detection branch November 11, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant