Skip to content

[Bug]: @ menu offers no machines when the client is paired only to the thread's server #40174

Closed

Description

@daviesayo

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

  1. 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.
  2. 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.
  3. 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 @ cfb720f

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:

Related: #31967 (mention the thread's own machine) and #31966 (machines first in the @ menu) change the same machine list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions