anomalyco / anomalyco/opencode
Bug: V2 Node process-lock implementation imports unavailable node:ffi, blocking embedded SDK
@rekram1-node is already working on this.
Since Sep 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The V2 core's Node-conditioned process-lock module imports dlopen and getInt32 from node:ffi. On Node v26.8.1 this fails immediately with:
ERR_UNKNOWN_BUILTIN_MODULE: No such built-in module: node:ffi
We encountered this while embedding @opencode-ai/sdk@0.0.0-beta-18684 in an Electron/Node backend. After bundling past the separate extensionless-ESM problem tracked in #44582, this is the next runtime blocker. This report concerns POSIX process locking, not PTY support.
Versions / environment
- macOS 26.2, ARM64; Node v26.8.1.
- The offending import is present in core beta-18684 and beta-19086 (the current npm beta when checked).
- The isolated reproduction below was run against beta-19086. This is not a claim that the full latest SDK was otherwise validated.
- No plugins required.
Steps to reproduce
In an empty temporary directory, without installing dependencies or running lifecycle scripts:
npm pack @opencode-ai/core@0.0.0-beta-19086 --silent
tar -xzf opencode-ai-core-0.0.0-beta-19086.tgz
node --input-type=module -e 'await import("./package/dist/util/process-lock-ffi.node.js")'
The import fails with the error above, before any lock function is called. This direct file import is only a minimal reproducer, not a proposed SDK integration surface.
Expected behavior
The Node implementation should load and provide real interprocess locking on supported Node/Electron versions. If it requires a particular experimental runtime or flag, please document and validate that requirement. Disabling locking would not be a safe workaround.
The current V2 Node implementation and conditional import mapping still contain this path. A packed-artifact Node load test plus competing-process lock/release tests would help guard it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.