-
Notifications
You must be signed in to change notification settings - Fork 60
Fix fleet serve JS node loading in standalone CLI #1170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
.agentworkforce/trajectories/completed/2026-06/traj_t83sls93qtdp/summary.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Trajectory: Fix GitHub issue 1169 | ||
|
|
||
| > **Status:** ✅ Completed | ||
| > **Confidence:** 92% | ||
| > **Started:** June 19, 2026 at 01:30 PM | ||
| > **Completed:** June 19, 2026 at 01:34 PM | ||
|
|
||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| Fixed fleet serve node-definition loading for Bun-compiled CLI by using native import for JavaScript node files, lazy-loading jiti only for TypeScript sources, and validating the fleet marker locally to avoid compiled runtime import failures. | ||
|
|
||
| **Approach:** Standard approach | ||
|
|
||
| --- | ||
|
|
||
| ## Key Decisions | ||
|
|
||
| ### Use native dynamic import for JS fleet node definitions | ||
|
|
||
| - **Chose:** Use native dynamic import for JS fleet node definitions | ||
| - **Reasoning:** The Bun-compiled CLI fails when jiti constructs its transform backend; compiled JS can be loaded by the runtime directly, so jiti should only be loaded for TypeScript-like sources that need transpilation. | ||
|
|
||
| ### Validate loaded fleet node definitions locally in the CLI | ||
|
|
||
| - **Chose:** Validate loaded fleet node definitions locally in the CLI | ||
| - **Reasoning:** The Bun-compiled smoke showed the fleet SDK validator import can be undefined in the standalone binary; the public validator only checks the \_\_agentRelayFleetNode marker, so a local marker check avoids another runtime import failure without changing validation behavior. | ||
|
|
||
| --- | ||
|
|
||
| ## Chapters | ||
|
|
||
| ### 1. Work | ||
|
|
||
| _Agent: default_ | ||
|
|
||
| - Use native dynamic import for JS fleet node definitions: Use native dynamic import for JS fleet node definitions | ||
| - Validate loaded fleet node definitions locally in the CLI: Validate loaded fleet node definitions locally in the CLI |
65 changes: 65 additions & 0 deletions
65
.agentworkforce/trajectories/completed/2026-06/traj_t83sls93qtdp/trajectory.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { | ||
| "id": "traj_t83sls93qtdp", | ||
| "version": 1, | ||
| "task": { | ||
| "title": "Fix GitHub issue 1169" | ||
| }, | ||
| "status": "completed", | ||
| "startedAt": "2026-06-19T11:30:05.358Z", | ||
| "completedAt": "2026-06-19T11:34:06.470Z", | ||
| "agents": [ | ||
| { | ||
| "name": "default", | ||
| "role": "lead", | ||
| "joinedAt": "2026-06-19T11:31:29.687Z" | ||
| } | ||
| ], | ||
| "chapters": [ | ||
| { | ||
| "id": "chap_h8ukvp6tcyks", | ||
| "title": "Work", | ||
| "agentName": "default", | ||
| "startedAt": "2026-06-19T11:31:29.687Z", | ||
| "endedAt": "2026-06-19T11:34:06.470Z", | ||
| "events": [ | ||
| { | ||
| "ts": 1781868689689, | ||
| "type": "decision", | ||
| "content": "Use native dynamic import for JS fleet node definitions: Use native dynamic import for JS fleet node definitions", | ||
| "raw": { | ||
| "question": "Use native dynamic import for JS fleet node definitions", | ||
| "chosen": "Use native dynamic import for JS fleet node definitions", | ||
| "alternatives": [], | ||
| "reasoning": "The Bun-compiled CLI fails when jiti constructs its transform backend; compiled JS can be loaded by the runtime directly, so jiti should only be loaded for TypeScript-like sources that need transpilation." | ||
| }, | ||
| "significance": "high" | ||
| }, | ||
| { | ||
| "ts": 1781868801483, | ||
| "type": "decision", | ||
| "content": "Validate loaded fleet node definitions locally in the CLI: Validate loaded fleet node definitions locally in the CLI", | ||
| "raw": { | ||
| "question": "Validate loaded fleet node definitions locally in the CLI", | ||
| "chosen": "Validate loaded fleet node definitions locally in the CLI", | ||
| "alternatives": [], | ||
| "reasoning": "The Bun-compiled smoke showed the fleet SDK validator import can be undefined in the standalone binary; the public validator only checks the __agentRelayFleetNode marker, so a local marker check avoids another runtime import failure without changing validation behavior." | ||
| }, | ||
| "significance": "high" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "retrospective": { | ||
| "summary": "Fixed fleet serve node-definition loading for Bun-compiled CLI by using native import for JavaScript node files, lazy-loading jiti only for TypeScript sources, and validating the fleet marker locally to avoid compiled runtime import failures.", | ||
| "approach": "Standard approach", | ||
| "confidence": 0.92 | ||
| }, | ||
| "commits": [], | ||
| "filesChanged": [], | ||
| "projectId": "AgentWorkforce/relay", | ||
| "tags": [], | ||
| "_trace": { | ||
| "startRef": "66f972f23cafb958fa1956d3654710423e2391b5", | ||
| "endRef": "66f972f23cafb958fa1956d3654710423e2391b5" | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
.agentworkforce/trajectories/completed/2026-06/traj_upshg9a9y5tx/summary.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Trajectory: Address PR 1170 bot feedback | ||
|
|
||
| > **Status:** ✅ Completed | ||
| > **Confidence:** 90% | ||
| > **Started:** June 19, 2026 at 01:41 PM | ||
| > **Completed:** June 19, 2026 at 01:42 PM | ||
|
|
||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| Addressed PR 1170 automated review feedback by adding marker-aware default unwrapping for CommonJS default wrappers and a Node-only syntax-error fallback to jiti for ESM-syntax .js files in CommonJS projects. | ||
|
|
||
| **Approach:** Standard approach | ||
|
|
||
| --- | ||
|
|
||
| ## Key Decisions | ||
|
|
||
| ### Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback | ||
|
|
||
| - **Chose:** Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback | ||
| - **Reasoning:** Native import fixes compiled JavaScript node definitions in the Bun binary. Node.js can still hit SyntaxError for ESM-syntax .js files in CommonJS projects, so the loader falls back to jiti only for syntax failures outside Bun and unwraps nested CommonJS default wrappers. | ||
|
|
||
| --- | ||
|
|
||
| ## Chapters | ||
|
|
||
| ### 1. Work | ||
|
|
||
| _Agent: default_ | ||
|
|
||
| - Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback: Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback |
53 changes: 53 additions & 0 deletions
53
.agentworkforce/trajectories/completed/2026-06/traj_upshg9a9y5tx/trajectory.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| { | ||
| "id": "traj_upshg9a9y5tx", | ||
| "version": 1, | ||
| "task": { | ||
| "title": "Address PR 1170 bot feedback" | ||
| }, | ||
| "status": "completed", | ||
| "startedAt": "2026-06-19T11:41:01.857Z", | ||
| "completedAt": "2026-06-19T11:42:49.228Z", | ||
| "agents": [ | ||
| { | ||
| "name": "default", | ||
| "role": "lead", | ||
| "joinedAt": "2026-06-19T11:42:15.525Z" | ||
| } | ||
| ], | ||
| "chapters": [ | ||
| { | ||
| "id": "chap_tvtdh06tamro", | ||
| "title": "Work", | ||
| "agentName": "default", | ||
| "startedAt": "2026-06-19T11:42:15.525Z", | ||
| "endedAt": "2026-06-19T11:42:49.228Z", | ||
| "events": [ | ||
| { | ||
| "ts": 1781869335526, | ||
| "type": "decision", | ||
| "content": "Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback: Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback", | ||
| "raw": { | ||
| "question": "Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback", | ||
| "chosen": "Preserve Node.js JS interop while keeping Bun standalone off the jiti fallback", | ||
| "alternatives": [], | ||
| "reasoning": "Native import fixes compiled JavaScript node definitions in the Bun binary. Node.js can still hit SyntaxError for ESM-syntax .js files in CommonJS projects, so the loader falls back to jiti only for syntax failures outside Bun and unwraps nested CommonJS default wrappers." | ||
| }, | ||
| "significance": "high" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "retrospective": { | ||
| "summary": "Addressed PR 1170 automated review feedback by adding marker-aware default unwrapping for CommonJS default wrappers and a Node-only syntax-error fallback to jiti for ESM-syntax .js files in CommonJS projects.", | ||
| "approach": "Standard approach", | ||
| "confidence": 0.9 | ||
| }, | ||
| "commits": [], | ||
| "filesChanged": [], | ||
| "projectId": "AgentWorkforce/relay", | ||
| "tags": [], | ||
| "_trace": { | ||
| "startRef": "29a9c0361c067786c9771b87c5837d6d261b093e", | ||
| "endRef": "29a9c0361c067786c9771b87c5837d6d261b093e" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
package.jsonto ensure CJS module context.The test writes
exports.default = { ... }(CommonJS syntax) but does not create apackage.jsonto explicitly settype: "commonjs". This means the module type is inherited from parent directories. If the project root hastype: "module", the test file will be interpreted as ESM, whereexportsis undefined, causing aReferenceErrorduring nativeimport().Depending on
shouldFallbackToJitibehavior, this could either cause the test to unintentionally fall back tojiti(not exercising the native-import code path it's meant to test) or fail outright in ESM-configured projects.To ensure the test reliably exercises the native-import path for CommonJS-compiled wrappers, write a
package.jsonwithtype: "commonjs"in the temp directory, matching the pattern used in the test at lines 124–147.📦 Recommended fix: add package.json
it('loads CommonJS compiled JS node files that export default wrappers', async () => { const dir = await mkdtemp(path.join(os.tmpdir(), 'relay-node-def-')); try { + await writeFile(path.join(dir, 'package.json'), JSON.stringify({ type: 'commonjs' })); const file = path.join(dir, 'node-def.js'); await writeFile(🤖 Prompt for AI Agents