Skip to content

[Bug]: ACP Registry npm installs can miss the managed prefix when npm is a shim #43085

Done

Description

@drawmeanelephant

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Put an npm-compatible shim first on PATH. The shim implements literal --prefix arguments but does not implement npm's npm_config_prefix environment configuration. Bun-backed npm shims can have this shape.
  2. Start T3 Code with that environment.
  3. Add an ACP Registry agent whose distribution is npx, such as factory-droid (droid@<exact-version>).
  4. Let T3 prepare/install the agent.

A minimal shim reproduces the relevant contract mismatch without needing Factory specifically:

#!/bin/sh
# It understands --prefix <dir> / --prefix=<dir>, but intentionally ignores
# npm_config_prefix, matching the shim behavior that triggered this.
prefix=
for arg in "$@"; do
  case "$arg" in
    --prefix=*) prefix=${arg#--prefix=} ;;
  esac
done

if [ "$1" = root ] && [ "$2" = --global ]; then
  printf '%s\n' "${prefix:-$HOME/.bun/install/global/node_modules}"
  exit 0
fi
if [ "$1" = prefix ] && [ "$2" = --global ]; then
  printf '%s\n' "${prefix:-$HOME/.bun/install/global}"
  exit 0
fi
if [ "$1" = install ] && [ "$2" = --global ]; then
  # With only npm_config_prefix set, the package is not placed in T3's managed
  # prefix even though the install command exits successfully.
  exit 0
fi
exit 64

The important part is that T3 currently communicates the managed install root only through npm_config_prefix:

https://github.com/pingdotgg/t3code/blob/main/packages/provider-acp-registry/src/server/AcpRegistrySupport.ts#L1521-L1524

but then runs the install without an explicit --prefix argument:

https://github.com/pingdotgg/t3code/blob/main/packages/provider-acp-registry/src/server/AcpRegistrySupport.ts#L1545-L1551

and discovers the result by asking the same npm executable for root --global and prefix --global:

https://github.com/pingdotgg/t3code/blob/main/packages/provider-acp-registry/src/server/AcpRegistrySupport.ts#L1384-L1429

Expected behavior

T3 should either:

  • pass the managed prefix explicitly to npm install/query commands, or
  • validate before/after installation that the npm executable honors the required prefix contract and fail with an actionable message naming the shim/configuration problem.

Ideally a failed provider install should also not leave T3 with a dangling default model selection for a provider instance that is no longer configured.

Actual behavior

The npm install command can exit successfully while the package is not installed into T3's managed prefix. Discovery then fails with:

ACP Registry installed [email protected], but could not resolve its global command.

On the affected machine, the managed install directories existed but were effectively empty:

~/.t3/tools/factory-droid/1.14.0/npm/
~/.t3/tools/factory-droid/1.16.0/npm/
~/.t3/tools/factory-droid/1.17.2/npm/
~/.t3/tools/factory-droid/1.18.0/npm/

T3's settings also had a default model selection pointing at acpRegistry_factory_droid, while providerInstances no longer contained that provider instance. I cannot prove the install failure alone caused that state loss, but the combination left Factory Droid unavailable in the orchestrator even though the standalone droid CLI was installed, authenticated, and completed ACP initialize handshakes successfully.

Devin's ACP Registry provider was unaffected because it uses a binary archive distribution; this only hits npm/npx-distributed registry agents.

Impact

Minor bug or occasional failure

Version or commit

T3 Code desktop 0.1.12-nightly.20261124.5209.

The same install/discovery flow is present on main in packages/provider-acp-registry/src/server/AcpRegistrySupport.ts as of filing.

Environment

  • macOS arm64
  • Desktop app with local server
  • npm --version: 99.0.0-npm-shim (bun 1.4.5)
  • Factory Droid CLI 1.18.0 installed independently and authenticated
  • ACP Registry factory-droid version observed: 1.20.0, distributed as npx package [email protected]

Logs or stack traces

ACP Registry installed [email protected], but could not resolve its global command.

Workaround

Use an already-installed Factory Droid executable through the provider's command-path override, or repair the npm shim so it honors npm_config_prefix and returns npm-compatible global root/prefix/bin results.

In this case, configuring the registry provider as factory-droid with commandPath pointing at the existing droid executable restored orchestration immediately, while preserving the registry identity and icon.

Related issues

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