Repository navigation
Description
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
A client connected to server A keeps a cached list of A's linked environments. If A gets linked to server B outside this client (for example from the CLI), the list is never refreshed. A t3-thread://v2/<B>/<thread> link in an A thread then renders as an unresolved chip until the page is reloaded or the client reconnects to A.
The repro uses two servers on one machine and one web client. The same happens with A on a workstation and B on a VPS.
- Turn on Linked environments on both servers before starting them, and clone a repository that has a GitHub remote.
delegate_taskpicks B's project by matching the repository, so both servers need a project for it.for d in /tmp/t3-a /tmp/t3-b; do mkdir -p "$d/userdata" echo '{"linkedEnvironmentsEnabled": true}' > "$d/userdata/settings.json" done git clone --depth 1 https://github.com/octocat/Hello-World /tmp/hello
- Start both servers (in separate terminals), then add the project to each:
t3 serve --base-dir /tmp/t3-a --port 4101 t3 serve --base-dir /tmp/t3-b --port 4102 t3 project add /tmp/hello --base-dir /tmp/t3-a t3 project add /tmp/hello --base-dir /tmp/t3-b
- Open the web client and pair it with A only, using the pairing URL that A's
t3 serveprints. Open a thread in the project on A and leave it open. Do not add B to this client: a client that has B saved opens B's threads directly, which hides the bug. - From a terminal, link A to B.
t3 pairprints B's pairing code on itsToken:line, andt3 environment linkprints B's environment id.t3 pair --base-dir /tmp/t3-b t3 environment link http://127.0.0.1:4102 --pairing-code <token> --base-dir /tmp/t3-a
- Without reloading the page, ask the agent in A's thread to call
delegate_taskwith a small task that needs no tools (for example "reply OK") andtarget.environmentId=<B's id>, and to put the returnedlinkin its reply. - Look at the thread chip in the reply.
- Reload the page and look at the chip again.
Expected behavior
In step 6 the chip can be clicked and its tooltip reads "Read the thread on ", the same as after the reload in step 7.
Actual behavior
In step 6 the chip renders as unavailable: a dashed icon, the link text as its label, and the tooltip "Thread on another machine". It does not open. After the reload in step 7 the same chip can be clicked. In both steps, the delegated task's row opens B's thread read-only through A.
Cause: nothing refreshes the client's peerLinks.names cache when a link changes outside this client.
namesis a plain RPC query with a 10 s stale time. It has norefreshTrigger, norefreshIntervalMsand no subscription:peerLinks.ts#L47-L52.- The stale time is checked only when the query's node builds, which happens when its first reader mounts:
runtime.ts#L612-L649. The composer always callsuseLinkedEnvironments(environmentId)(ChatComposer.tsx#L1212). The query therefore stays mounted while an A thread is open, and the stale check never runs again. refreshLinksruns only after this client's ownlink,unlinkoranswerRequestsucceeds:peerLinks.ts#L53-L151.- The server sends no event when a link changes. It answers
peerLinks.namesfrom the store on each call (ws.ts#L2765-L2766), andPeerLinkshas no stream or PubSub (PeerLinks.ts#L99-L138).t3 environment linkwrites the store directly, without going through the running server (environment.ts#L39-L80). MarkdownThreadLinklooks B up in the cached names. With B missing,resolveLinkedThreadOpenreturns"unavailable"and the chip falls through toUnresolvedChip:MarkdownThreadLink.tsx#L48-L58,#L87-L133,linkedThread.ts#L49-L61. The delegated row goes throughuseLinkedThreadOpener, which treats"unavailable"as"linked", so the row still opens:linkedThreadView.ts#L55.
Settings → Connections → "Link several…" leaves A's names stale even within one client. The batch links through linkInBatch, which has no onSuccess, and when it ends it refreshes only list: peerLinks.ts#L109-L113, LinkSeveralEnvironments.tsx#L109, #L187.
Suggested fix:
- Have the server push link changes. Add a link-change subscription that
PeerLinkspublishes to on link and unlink, and pass it tonamesandlistasrefreshTrigger, the waypullRequests.tsusespullRequestsSubscribeRefreshes(pullRequests.ts#L694-L701,#L735). This also covers links made from a second client. The CLI links in its own process, sot3 environment linkandunlinkwould also need to go through the running server withRunningServer.changeState, ast3 projectdoes (runningServer.ts#L87-L91,project.ts#L325). - Client-only fix: refetch
nameson window focus, and whenever a message or delegated row references an environment id thatnamesdoes not contain. Also refreshnameswhen a batch ends.
Related: #39406 added peerLinks.names and the linked-chip path. #26434 fixed a similar gap for links made through the client's own link card.
Impact
Minor bug or occasional failure
Version or commit
v0.1.12-nightly.20261121.5051 (dd941b9); the code path is unchanged on main @ 2621031
Environment
Servers on Linux. Seen in the macOS desktop app; the code path is in apps/web, so the browser client behaves the same. Any provider.
Logs or stack traces
No error is logged. A's server traces show no peerLinks.names request between the moment the link was made and the reload. The reload sends one, and the chip resolves.
Workaround
Reload the page or reconnect to A. Opening the delegated task's row instead of the chip also works.
Activity