Visitar URL original
fix(core): import ai agent utils through a file url in the daemon by AyeshaWaseemAhmad · Pull Request #37380 · nrwl/nx · GitHub
Skip to content

fix(core): import ai agent utils through a file url in the daemon - #37380

Merged
leosvelperez merged 5 commits into
nrwl:masterfrom
AyeshaWaseemAhmad:fix/daemon-ai-agents-status-windows-import
Nov 5, 2026
Merged

leosvelperez merged 5 commits into
nrwl:masterfrom
AyeshaWaseemAhmad:fix/daemon-ai-agents-status-windows-import

Conversation

@AyeshaWaseemAhmad

Copy link
Copy Markdown
Contributor

Current Behavior

computeAgentStatuses in the daemon passes the absolute path from require.resolve('nx/src/ai/utils.js') straight to import(). On Windows the ESM loader reads the drive letter as a URL scheme and throws ERR_UNSUPPORTED_ESM_URL_SCHEME, so the daemon logs "Failed to compute agent configuration status" and caches an empty status.

Expected Behavior

The path is converted with pathToFileURL(modulePath).href before import(), so the module loads on Windows and the status is computed. The URL for a POSIX path resolves to the same file as before.

The new spec checks that the specifier passed to import() comes from pathToFileURL, and it fails without the change. I haven't run this on Windows, and the loader error itself can't be reproduced from a macOS or Linux test run.

Related Issue(s)

Fixes #37374

computeAgentStatuses passed a raw require.resolve path to import(), which
the ESM loader rejects on Windows because the drive letter parses as a URL
scheme. Convert it with pathToFileURL first.
@AyeshaWaseemAhmad
AyeshaWaseemAhmad requested a review from a team as a code owner October 10, 2026 13:38
@netlify

netlify Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a5ce43e

@netlify

netlify Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

👷 Deploy request for nx-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a5ce43e

@leosvelperez leosvelperez self-assigned this Nov 2, 2026

@leosvelperez leosvelperez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nx-cloud

nx-cloud Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit a5ce43e

Command Status Duration Result
nx affected --targets=lint,oxlint,test,build,e2... ✅ Succeeded 23m 8s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 42s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 34s View ↗
nx-cloud record -- nx format:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-11-05 13:06:47 UTC

@leosvelperez
leosvelperez merged commit 1b0e996 into nrwl:master Nov 5, 2026
18 of 19 checks passed
jaysoo pushed a commit that referenced this pull request Nov 6, 2026
…7380)

## Current Behavior

`computeAgentStatuses` in the daemon passes the absolute path from
`require.resolve('nx/src/ai/utils.js')` straight to `import()`. On
Windows the ESM loader reads the drive letter as a URL scheme and throws
`ERR_UNSUPPORTED_ESM_URL_SCHEME`, so the daemon logs "Failed to compute
agent configuration status" and caches an empty status.

## Expected Behavior

The path is converted with `pathToFileURL(modulePath).href` before
`import()`, so the module loads on Windows and the status is computed.
The URL for a POSIX path resolves to the same file as before.

The new spec checks that the specifier passed to `import()` comes from
`pathToFileURL`, and it fails without the change. I haven't run this on
Windows, and the loader error itself can't be reproduced from a macOS or
Linux test run.

## Related Issue(s)

Fixes #37374

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daemon fails to compute AI agents status on Windows: import() of absolute path (Received protocol 'e:')

2 participants