fix(harness-driver): resolve installed broker under mise launchers
Summary
- canonicalize package-manager entry points before resolving the platform broker optional dependency
- fall back to broker binaries beside installed launchers and in standard Relay user install directories
- add regression coverage and a patch changelog entry
Bug A evidence
Before, a clean globally installed CLI with its optional broker packages unavailable and a minimal PATH failed with:
Failed to start broker: @agent-relay/harness-driver could not find an agent-relay-broker binary for darwin-arm64
After deploying this harness-driver build into the same install, agent-relay node up --no-spawn --background started PID 95430, node status reported RUNNING and Node delivery CONNECTED, and fleet nodes --name no-optional-after reported the node online/live. The temporary node was stopped afterward.
Bug B investigation
No Bug B code is included. The original failing target was a different remote mini in a separate workspace; that node and exact invocation are unavailable. Targeted fleet spawn succeeded end to end against the currently available relay node from standalone 11.4.0, clean npm 11.4.0, and mise npm 11.2.0 clients; all three workers appeared in node agent list and were released.
The trace found two important diagnostics for a future reproduction:
- workspace queries resolve explicit flag, environment, project session, then global active workspace, while targeted spawn requires and prefers an agent token that is already bound to one workspace
- targeted spawn returns the immediate asynchronous invocation acknowledgement; a downstream broker failure is only visible by reading that invocation result
- current broker caches node tokens by node id, workspace id, and engine URL, and clears/remints a rejected cache after a node-control 401
Validation
npx vitest run packages/harness-driver/src/broker-path.test.ts packages/cli/src/cli/commands/fleet.test.ts(25 passed)npm run typechecknpx prettier --check packages/harness-driver/src/broker-path.ts packages/harness-driver/src/broker-path.test.ts CHANGELOG.mdnpm pack --dry-runin packages/harness-drivergit diff origin/main...HEAD --check