Skip to content

fix(directory-picker-native): run win32 dialog worker under plain node - #37

Open
takoyakiwhite wants to merge 1 commit into
whitelonng:masterfrom
takoyakiwhite:fix/win32-dialog-worker-source-launch-upstream
Open

fix(directory-picker-native): run win32 dialog worker under plain node#37
takoyakiwhite wants to merge 1 commit into
whitelonng:masterfrom
takoyakiwhite:fix/win32-dialog-worker-source-launch-upstream

Conversation

@takoyakiwhite

Copy link
Copy Markdown
Contributor

Summary

Fixes the Windows source-plane folder dialog failure reported in deepseek-ai/deepseek-harness discussions #154 / #197: the Web UI showed win32 folder dialog worker exited before reporting a result.

Root cause

packages/host/directory-picker-native/src/win32-dialog-host.ts launched the source-plane worker as:

node --import tsx/esm <absolute .ts path>

With a loader registered via --import, Node's ESM loader resolves the entry as a URL. On Windows, the absolute path E:\... becomes an e: scheme URL and Node rejects it with ERR_UNSUPPORTED_ESM_URL_SCHEME before the worker posts its first IPC message, so the driver only surfaces its generic exit error. Packaged consumers were unaffected because they launch the built worker.cjs under plain node.

CI also missed it: the built/source arm test used import.meta.url.endsWith('.ts'), and under Vitest/Vite the URL carries a query string, so the win32 smoke test silently exercised the built arm.

Change

  • Launch the source worker directly under plain node with native type stripping (stable since Node 22.18, inside the engines range ^22.19.0 || >=24.0.0). The worker's three modules use only erasable TS syntax, so no tsx bootstrap is needed — this does not conflict with the CLI source graph's tsx decision.
  • Switch the arm test to new URL(import.meta.url).pathname.endsWith('.ts') so bundler query strings cannot misclassify source modules as built.
  • Add a spawn-args regression pin (worker path passed positionally, no --import) and the real-dialog win32 smoke now covers the source arm.
  • Remove the now-unused tsx devDependency from the package.

Verification

  • packages/host/directory-picker-native suite: 48 passed, 1 skipped (win32-skipped built-worker e2e).
  • The win32 smoke test opens and abort-closes a real dialog through the source launch (verified on Windows, Node 24).
  • pnpm run typecheck passes.

The source-plane worker launched through `--import tsx/esm` with a Windows
absolute path, which Node's ESM loader misparses as an `e:` scheme URL and
rejects with ERR_UNSUPPORTED_ESM_URL_SCHEME before the first IPC message —
the UI then only sees "win32 folder dialog worker exited before reporting
a result". The worker's modules use only erasable TS syntax, so launch it
directly under Node's native type stripping (stable since 22.18, inside
the engines range) with no loader chain. Also switch the built/source arm
test to `pathname.endsWith('.ts')` so bundler query strings cannot
misclassify source modules as built, and pin the spawn args plus a real
dialog smoke against the source arm.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant