Skip to content

agent-relay update reports success but is a no-op for standalone (Bun) installs #1336

Description

@kjgbot

Summary

agent-relay update always runs npm install -g agent-relay@latest and then prints Successfully updated to <version>, regardless of how the CLI was actually installed. When the CLI is installed as a standalone (Bun-compiled) binary — e.g. ~/.agentworkforce/relay/bin/agent-relay, reached via a shim on PATH at ~/.local/bin/agent-relay — the npm install updates a different, unused copy. The running command stays on the old version, but update falsely reports success and the "Update available" banner never clears.

This makes self-update a silent no-op for standalone installs, so users stay pinned to old versions and keep hitting already-fixed bugs.

Impact (concrete)

On 10.6.3 this stranded a user on the node up enrollment identity mismatch bug (fleet snowflake node id vs relaycast uuid session id — never matches; fixed in 10.6.4). Running agent-relay update reported Successfully updated to 10.6.4, but:

$ agent-relay version
agent-relay v10.6.3        # still the old Bun binary; shim → ~/.agentworkforce/relay/bin/agent-relay

Only manually repointing the ~/.local/bin/agent-relay shim to the npm 10.6.4 binary made the fix take effect.

Steps to reproduce

  1. Install agent-relay as a standalone binary at ~/.agentworkforce/relay/bin/agent-relay, with a shim at ~/.local/bin/agent-relay (first on PATH) execing it.
  2. With a newer version published, run agent-relay update.
  3. Observe: Installing update...Successfully updated to <new>.
  4. Run agent-relay version → still reports the old version. The banner keeps nagging.

Root cause

runUpdateCommand in packages/cli/src/cli/lib/core-maintenance.ts:157 unconditionally shells out to npm and reports success without verifying the running binary changed:

deps.log('Installing update...');
const toVersion = info.latestVersion ?? 'latest';
const { stdout, stderr } = await deps.execCommand('npm install -g agent-relay@latest');
...
deps.log(`Successfully updated to ${toVersion}`);   // printed even when the standalone binary is untouched

There is no detection of the install method. The codebase already knows standalone binaries live in ~/.local/binrunUninstallCommand handles exactly that (core-maintenance.ts:283, "Remove standalone binaries from ~/.local/bin") — but runUpdateCommand was never taught the same.

Suggested fix

  • Detect the active install method (standalone binary vs npm global) — e.g. resolve the real path behind the ~/.local/bin shim / process.execPath.
  • For standalone installs, update via the standalone path (re-download/replace the Bun binary + shim) instead of npm install -g.
  • Only claim Successfully updated to X after confirming the resolved binary now reports the new version; otherwise warn and print the manual remediation.
  • Bonus: update --check (and the passive banner) should reflect the version of the binary that will actually run, not just the npm package.

Environment

  • agent-relay 10.6.3 (standalone Bun binary), macOS arm64
  • Shim: ~/.local/bin/agent-relay~/.agentworkforce/relay/bin/agent-relay
  • npm global copy (updated, but unused by the shim): ~/.local/share/mise/installs/node/<ver>/bin/agent-relay

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions