[Bug]: @ menu offers no machines when the client is paired only to the thread's server #40174
Filed by Claude Opus 5.5 on behalf of Davies.
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#
- Use a desktop client that is paired to one environment, server A. Server A has the peer links capability and Linked environments turned on in Labs.
- Link server A to a second environment, server B, so that agents on A can work on B. Do not pair B in this client.
- Open a thread on server A, type
@and then the start of B's name.
Expected behavior#
The @ menu offers B as a machine. Server A already links to B, so the agent on A can act on that mention. The client also already knows the link, because ChatComposer fetches A's links through useLinkedEnvironments for thread search.
Actual behavior#
The @ menu offers no machines. Threads on B do show up, because thread search covers linked environments. The machine list does not.
In apps/web/src/components/chat/useComposerMenuItems.ts, the machine candidates (mentionableEnvironments) come only from useEnvironmentIdentities(), which is the environments paired in this client. The linkedEnvironments map that the hook already receives feeds thread search but never the machine list. A client paired only to the thread's own server therefore has no machines to offer, because matchComposerEnvironmentItems also excludes the thread's own environment.
Impact#
Minor bug or occasional failure
Version or commit#
main @ cfb720fa8a
Environment#
macOS desktop app, with the client paired to one environment that links to others.
Workaround#
Pair every linked environment into the client as well. The links then have to be kept in sync by hand in each client.
Possible fix#
Append the thread environment's linked environments that this client has not paired to mentionableEnvironments, named as the link names them (linkedEnvironments already resolves the client's name where one exists). We run this locally:
const pairedEnvironmentIds = new Set(
environmentIdentities.map((identity) => identity.environmentId),
);
const mentionableEnvironments = [
...environmentIdentities.map((identity) => ({
...identity,
machine: environmentMachines.get(identity.environmentId) ?? ("server" as const),
})),
...Array.from(linkedEnvironments)
.filter(([linkedEnvironmentId]) => !pairedEnvironmentIds.has(linkedEnvironmentId))
.map(([linkedEnvironmentId, label]) => ({
environmentId: linkedEnvironmentId,
label,
machine: "server" as const,
})),
];
Two open questions for maintainers:
- A linked environment that this client has not paired has no known machine kind, so the sketch uses
"server". - The sketch keeps offering paired but unlinked environments, as today. #31967 notes that a machine mention sends the agent to
t3_environment_link, so those can still lead to a link.
Related: #31967 (mention the thread's own machine) and #31966 (machines first in the @ menu) change the same machine list.
tanstack-source added labelsbug
juliusmarminge closed this
Sign in to join this conversation.