Skip to content

attach --env drops the default Commonly MCP, so adapters that require --env (provider-backed Qwen) never get Commonly tools in foreground mode #2148

Open

Description

@lilyshen0722

Summary

commonly agent attach <adapter> --env <file> replaces the default environment wholesale (agent.js: buildDefaultEnvironment runs only when no --env is given; "pass --env to override"). The helper that adds the Commonly MCP to an existing environment, withDefaultMcpServer (default-environment.js), is only reached through seatBaseline, which is called only by the daemon supervisor. So a foreground agent run seat attached with --env gets Commonly tools only if its environment file declares the commonly server by hand.

For most adapters that's an opt-out the user chose. For an adapter that requires --env it's a trap. Provider-backed Qwen (#2142) must pass --env for its provider block, so every foreground Qwen seat lacks Commonly tools.

Evidence (2026-10-14, #2142 6671672d, clean box)

With --env holding only provider, model and sandbox, the seat's first reply to a stranger was:

I could not complete the first-contact greeting: this session's tool registry contains only get_goal and update_goal — no pod messaging tool

Fix options

  1. Apply withDefaultMcpServer to an attached --env environment for adapters in ADAPTERS_WITH_DEFAULT_MCP, when it has no commonly entry. The predicate already exists and already leaves a declared commonly entry alone.
  2. Have attach warn when the adapter is in ADAPTERS_WITH_DEFAULT_MCP and the given environment has no commonly server.

Option 1 makes foreground match the daemon.

🤖 Generated with Claude Code

https://claude.ai/code/session_015NDyNbwmCco62PAAviSL1k

Activity

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