OpenCode executes `bunfig.toml` preload scripts from the working directory
Description
When starting OpenCode in a directory that contains a bunfig.toml file with a preload configuration, OpenCode incorrectly executes the specified preload scripts. This causes unexpected behavior, such as running setup scripts intended for the project's runtime environment, not the editor/agent environment.
Expected behavior
OpenCode should not load or execute the project's bunfig.toml preload scripts during its own startup. It should run in isolation from the project's runtime configuration.
OpenCode version
1.0.143
Steps to reproduce
- Create a project directory with a
bunfig.tomlfile. - Add a
preloadscript tobunfig.toml:
preload = ["./src/setup.ts"]
- Create the corresponding script (e.g., src/setup.ts) with some side effects (e.g., logging, network requests, or
process.exit()). - Start OpenCode in this directory.
- Observe that the preload script is executed.
Screenshot and/or share link
No response
Operating System
macOS 15.6.1 (Build 24G90)
Terminal
Ghostty
thanks, will fix
This is weird, I can replicate but I don't know what's causing it, we clearly set the flag here to disable it: https://github.com/sst/opencode/blob/26d0280f70760a1212636683c1b5753afa4e70d8/packages/opencode/script/build.ts#L118
Might be a bun bug, adding label if anyoen can investigate this deeper