fix(build): drop redundant @agent-relay/* tsconfig paths so the compiled CLI keeps workspace exports#1184
Conversation
…led CLI keeps workspace exports The Bun-compiled `agent-relay` standalone binary dropped every @agent-relay/* workspace export to `undefined` at runtime, so `local up` failed with "Fleet local node skipped: … is not a function" (the implicit Fleet local node calling `defineDefaultLocalNode`). Root cause: the root and packages/cli `tsconfig.json` mapped every @agent-relay/* import to a sibling package's `dist/index.d.ts` via `compilerOptions.paths`. Bun and esbuild honor tsconfig `paths` when bundling, so they inlined the declaration files — which have no runtime exports — and the bundled namespace came back empty. Those paths were redundant: the npm workspace already symlinks @agent-relay/* into node_modules, so `tsc` resolves their `.d.ts` (via package `exports`/`types`) and bundlers resolve their `.js` (via `import`/`default`). Removing them fixes the bundled binary without affecting type-checking. With the source defect gone, the namespace-import workarounds in fleet-sidecar.ts and fleet/src/index.ts (added to dodge the same .d.ts mis-resolution) revert to plain named imports. Verified: `npm run build:core` is green (0 type errors), and a freshly compiled binary runs `local up` with the implicit fleet node connected (fleet-node.json connected:true, handlers spawn:claude/codex/gemini). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📝 WalkthroughWalkthroughRemoves ChangesBun CLI Workspace Export Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
pr-reviewer could not complete review for #1184 in AgentWorkforce/relay. |
There was a problem hiding this comment.
Code Review
This pull request resolves an issue where the Bun-compiled agent-relay standalone binary dropped workspace exports to undefined at runtime, causing local up to fail. The fix removes the redundant @agent-relay/* path mappings from the root and package-level tsconfig.json files, allowing bundlers to resolve the compiled JavaScript files via npm workspace symlinks while TypeScript still resolves types. Additionally, previous namespace-import workarounds in fleet-sidecar.ts and fleet/src/index.ts have been reverted to standard named imports, and a trajectory log has been added. No review comments were provided, so there is no feedback to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 12: The CHANGELOG entry contains excessive implementation details
(tsconfig paths, .d.ts versus compiled JS, npm workspace symlinks) that distract
from the user-visible impact. Simplify the entry to focus only on what users
care about: that `agent-relay local up` now successfully starts the implicit
Fleet local node instead of failing with the "is not a function" error. Remove
all technical details about how the fix was implemented (tsconfig changes,
workspace symlinks, declaration files) and keep the entry concise and
impact-focused as per CHANGELOG guidelines.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 79c1670f-b9bb-49c3-a937-ab1414c1cb6d
📒 Files selected for processing (7)
.agentworkforce/trajectories/completed/2026-06/traj_d88jruejk2zk/summary.md.agentworkforce/trajectories/completed/2026-06/traj_d88jruejk2zk/trajectory.jsonCHANGELOG.mdpackages/cli/src/cli/lib/fleet-sidecar.tspackages/cli/tsconfig.jsonpackages/fleet/src/index.tstsconfig.json
|
|
||
| ### Fixed | ||
|
|
||
| - The Bun-compiled `agent-relay` standalone binary now bundles workspace packages from their compiled JS instead of their `.d.ts`, so `local up` starts the implicit Fleet local node instead of failing with `Fleet local node skipped: … is not a function`. The `tsconfig` `paths` that mapped `@agent-relay/*` to declaration files (no runtime exports) were redundant with the npm workspace symlinks and have been removed. |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
CHANGELOG entry includes implementation details; focus on user-visible impact only.
Per coding guidelines for CHANGELOG.md, entries should be "concise and impact-first, with one short bullet per user-visible change. Omit... internal notes, and implementation details."
The current entry includes technical implementation details (tsconfig paths, .d.ts vs. compiled JS, npm workspace symlinks, "no runtime exports") that users don't need to understand. The user-visible change is singular: local up now works instead of failing.
Suggested revision (concise, impact-first, omits implementation):
agent-relay local upnow starts the implicit Fleet local node instead of failing with "Fleet local node skipped: … is not a function" in the Bun-compiled standalone binary.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@CHANGELOG.md` at line 12, The CHANGELOG entry contains excessive
implementation details (tsconfig paths, .d.ts versus compiled JS, npm workspace
symlinks) that distract from the user-visible impact. Simplify the entry to
focus only on what users care about: that `agent-relay local up` now
successfully starts the implicit Fleet local node instead of failing with the
"is not a function" error. Remove all technical details about how the fix was
implemented (tsconfig changes, workspace symlinks, declaration files) and keep
the entry concise and impact-focused as per CHANGELOG guidelines.
Source: Coding guidelines
Review: PR #1184 — fix/fleet-bun-compile-namespace-dropWhat the PR doesRemoves the redundant Root cause being fixed: bun/esbuild honor Verification (ran the way CI does)
The change is non-semantic from a runtime-behavior standpoint (it restores correct exports rather than altering logic) and stays tightly within the PR's purpose. I made no edits — the PR is correct as written. Addressed comments
Advisory Notes
I cannot confirm the live status of GitHub CI checks or PR mergeability from this sandbox (those are reported by cloud post-run), so I am not declaring the PR human-ready. |
Review: PR #1184 —
|
Problem
The Bun-compiled
agent-relaystandalone binary dropped every@agent-relay/*workspace export toundefinedat runtime.agent-relay local upfailed with:C90was the minifieddefineDefaultLocalNodefrom@agent-relay/fleet. The whole@agent-relay/fleetnamespace bundled empty. (The broker still started — the implicit Fleet local node is best-effort and the failure is caught — but the node never came up.)Root cause
The root
tsconfig.jsonandpackages/cli/tsconfig.jsonmapped every@agent-relay/*import to a sibling package'sdist/index.d.tsviacompilerOptions.paths. Bun and esbuild honor tsconfigpathswhen bundling, so they inlined the declaration files — which have onlyexport declare(no runtime values) — leaving the bundled namespace{}.Two details that made it specific and multi-layered:
pathsfrom the tsconfig nearest the importing file (and followsextends). Packagesfleet/harnesses/integration-promptsextend root and inherited the paths → broke;sdk/harness-driverdon't → resolved vianode_modules→ worked. That's why only some packages failed.fleet→harnesses) broken, surfacing as a deeperspawn requires a PTY harness definition.Fix
Remove the
@agent-relay/*paths(and the now-orphanedbaseUrl) fromtsconfig.jsonandpackages/cli/tsconfig.json. They were redundant with the npm workspacenode_modulessymlinks:tscresolves@agent-relay/*→.d.tsvia each package'sexports/types..jsviaimport/default.With the source defect gone, the namespace-import workarounds in
fleet-sidecar.tsandfleet/src/index.ts(added to dodge the same.d.tsmis-resolution) revert to plain named imports.Scope / safety
npm run build:core→ 0 type errors (incl. the 3 packages that inherit root paths).@agent-relay/harness-driver/protocol,@agent-relay/sdk/actions, …) still resolve via packageexports.web/, and thetests//evalstsconfigs that still carry these paths, are independent — only ever consumed bytsc, never by a bun/esbuild bundle — so they're intentionally untouched.tsc/bun/esbuildread these files).Verification
A freshly compiled binary runs
local upwith the implicit fleet node fully up:No "Fleet local node skipped", no "is not a function".
🤖 Generated with Claude Code