fix(client-runtime): @ menu offers machines the thread's server links to #40191
main fromrefs/pull/40191/head·merged by juliusmarminge View on GitHubWhen a client was paired only to the thread's server, the composer's @ menu offered no machines, even though that server links to other machines and its agent can act on a mention of them. The @ menu now also offers the machines the thread's server links to, on web and mobile.
matchComposerEnvironmentItemstakes the server'slinkedEnvironmentsand offers each linked machine the client hasn't paired with. A machine that is both paired and linked appears once, with its paired details.- The web (
useComposerMenuItems) and mobile (useComposerCommandMenu) composers pass thelinkedEnvironmentsmap they already had for thread search.
Fixes pingdotgg/t3code#40174
Reproduction on main#
Commit c6c796e37f (origin/main). Server B: t3 serve with its own base dir, linkedEnvironmentsEnabled=true in settings.json, T3CODE_ENVIRONMENT_LABEL=buildbox, on 127.0.0.1. Server A: T3CODE_DEV_SEED=0 vp run dev in a fresh worktree with linkedEnvironmentsEnabled=true. Minted a pairing code on B with t3 pair, then on A ran t3 environment link http://127.0.0.1:<B port> --pairing-code <code> --access read-only; t3 environment list on A showed buildbox as reachable. Paired the web client (Chromium preview) to A only, opened a new thread on A and typed @build in the composer. The menu showed only the 'Files and folders' listbox (builtInDrivers.ts and similar) with no machine entry for buildbox. Control: in the same client, Settings → Connections → Environments shows A with '1 link out' and buildbox listed as its link, so the client knows the link. (A first attempt was inconclusive because both servers defaulted to the same hostname label; B was relabelled and the test repeated.)
Evidence#
Steps: Run two isolated servers with linked environments enabled. Link A to B (buildbox) read-only, pair Chromium only to A, verify the link in Connections, then open A's thread and enter @build. Chromium 156, Linux, 1280×800, light theme; fresh synthetic state on each revision.
| Evidence | Before | After |
|---|---|---|
| Commit | 3f5492fcf4 | dc4bfe5e81 |
| Result | Only file match; buildbox absent | buildbox offered as Machine |
| Connections control | ![]() | ![]() |
| @build menu | ![]() | ![]() |
| Interaction | Before recording | After recording |
Scenario · Second-server helper
scenarios:prove exited 0: fails on base and passes on head. Clips retain the composer interaction and omit pairing screens.
Not shown:
- The mobile composer change was not exercised; this proof covers the reported web-client reproduction.
Tests#
vp test run src/composerThreadItems.test.ts(packages/client-runtime) without the source fix: 1 failed, 4 passed (the new linked-machine case fails, as expected)vp test run src/composerThreadItems.test.tswith the fix: 5 passedvp run check:changed: format, lint, knip, typecheck (7 packages), tests (3 files), react compiler all pass- CI on dc4bfe5: all 39 checks passed
Not in this change#
- Linked-only machines show the generic
servericon because the server's peer link names don't carry a machine kind. - Web's
mentionableEnvironmentsis still built from every paired environment, not only those the thread's server can reach; that is unchanged here.
Who did the work#
- Written by Claude Opus 5.5, in Claude Code
- Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
- Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5
Run by the t3code factory in T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
juliusmarminge merged thisd9fdd02
juliusmarminge closed this
Sign in to join this conversation.




No actionable comments were generated in the recent review.
Walkthrough
The environment matcher now accepts linked environments and adds unpaired linked machines to its suggestions as servers. Paired environments are not duplicated, and retain their listed machine types. The mobile and web composer integrations pass linked-environment data to the matcher.
Changes: Linked machine suggestions
packages/client-runtime/src/composerThreadItems.ts,packages/client-runtime/src/composerThreadItems.test.tsapps/mobile/src/features/threads/use-composer-command-menu.ts,apps/web/src/components/chat/useComposerMenuItems.tsEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
maria-rcks,stienswoutMerge Risk:
Minimal · up to
dc4bfThe @ menu now also offers machines linked to the thread's server, even if the client has not paired with them. The change is small and covered by unit tests, so merge risk is minimal.
Pre-merge checks:
4
#40174] requires the @ menu to offer machines that the thread's server links to, even when the client has not paired with them. At head, matchComposerEnvironmentItems in packages/client-runtime/src/c…Full details: Title check
Explanation
The title names the change: the @ composer menu now offers machines that the thread's server links to. It uses the fix() conventional-commit form and the client-runtime scope, which matches the changed matcher in composerThreadItems.ts and the web and mobile callers. It is specific and does not describe unrelated work.
Full details: Linked Issues check
Explanation
[
#40174] requires the @ menu to offer machines that the thread's server links to, even when the client has not paired with them. At head, matchComposerEnvironmentItems in packages/client-runtime/src/composerThreadItems.ts accepts linkedEnvironments and builds linkedOnly entries for linked IDs absent from the paired list, with machine "server" and the link-supplied label. Paired entries are kept unchanged, so a machine that is both paired and linked appears once with its paired details. The composer's own environment is still excluded by the filter. The PR passes linkedEnvironments from useComposerMenuItems (web) and useComposerCommandMenu (mobile), per the PR description and the raw summary. The issue's sketch placed the logic in mentionableEnvironments; this PR places it in the matcher, which satisfies the same requirement. Unresolved: the real-app evidence section is empty, and the issue does not require it. The test file adds a linked-only case, which the PR reports passing with the fix. I did not re-run the tests. Non-coding items were not assessed. Paired but unlinked environments are still offered, as the issue requires.Full details: Out of Scope Changes check
Explanation
The changes cover the matcher (composerThreadItems.ts), its unit tests (composerThreadItems.test.ts), and the web and mobile call sites that pass the existing linkedEnvironments map. The matcher doc comment was updated to describe the broader picker. The PR notes that web mentionableEnvironments is unchanged and that linked-only machines use the generic server icon. Both are documented limits, not unrelated changes. No unrelated files were identified in the summary. The PR description's evidence section is a process placeholder, not a code change.
Full details: Description check
Explanation
The description states the problem (the composer's @ menu offers no machines when a client is paired only to the thread's server), the change (matchComposerEnvironmentItems takes linkedEnvironments; web and mobile composers pass the existing map), a linked issue (
#40174), a reproduction on main, before/after evidence with commits and screenshots, the test results, and the authors. It follows the required template sections: Problem, Change, Scope, Verification, plus the agent attribution line. The Scope section is only partly aligned with the template: it links the issue, but the template asks for bug fixes only and this is framed as a bug fix, which is acceptable. The description is thorough and specific, and the Verification section names the focused tests and their observed results, not just 'tests pass'. A minor gap: the mobile composer change was not exercised, which the author discloses. Overall the description is mostly complete and clearly meets the template's requirements.Finishing Touches
Generate unit tests (beta)
71622d8d-9b5f-42f9-9790-df508f3fa92cReviewing files that changed from the base of the PR and between cf945982811a4a73863727f10541ab029437b419 and dc4bfe5e81428b5669d47aa31e41b13954caa694.
apps/mobile/src/features/threads/use-composer-command-menu.tsapps/web/src/components/chat/useComposerMenuItems.tspackages/client-runtime/src/composerThreadItems.test.tspackages/client-runtime/src/composerThreadItems.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.