Conversation
…arch `filesystem.ts` reads `FileSystemSearch.node` while the module initializes, but `filesystem/search.ts` imported `FileSystem` back from `../filesystem` at runtime for the `Entry`/`Match` constructors. Bundlers may emit either module first; when `filesystem.ts` wins, `FileSystemSearch.node` is still undefined and is baked into its layer dependencies, so `LayerNode.hoist` throws `TypeError: undefined is not an object (evaluating 'a.name')` on every boot. `Entry` and `Match` come from `@opencode-ai/schema/filesystem`, which `filesystem.ts` merely re-exports, so importing them from there removes the runtime edge. The remaining `../filesystem` import is type-only. Co-Authored-By: Claude <noreply@anthropic.com>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found a potential duplicate:
This PR appears to address the exact same issue: breaking the circular import cycle between |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
filesystem.tsreadsFileSystemSearch.nodewhile it initializes, whilefilesystem/search.tsimportedFileSystemback from../filesystemat runtime for theEntry/Matchconstructors.A bundler is free to emit either module first. When
filesystem.tswins,FileSystemSearch.nodeis stillundefinedand is stored in its layer dependencies, soLayerNode.hoistthrowsTypeError: undefined is not an object (evaluating 'a.name')on every startup.Repro:
bun run script/build.ts --singleon bun 1.4.2 produces a binary that fails at init for every prompt. bun 1.3.14 happens to emit the modules in the other order, which is why this is currently latent.Entry/Matchare re-exports of@opencode-ai/schema/filesystem, so importing them from there removes the runtime edge. The remaining../filesystemimport is type-only.