Skip to content

Conversation

@mynameistito
Copy link

Summary

This PR implements Shadow Copying for the bun-pty native binaries on Windows to resolve file-locking conflicts that cause the OpenCode Host to crash during multi-instance startup.

Changes

  • Created src/plugin/pty/shadow.ts to handle copying the rust_pty.dll to a temporary directory and setting process.env.BUN_PTY_LIB.
  • Refactored PTYManager in src/plugin/pty/manager.ts to lazy-load the bun-pty module only when needed, after ensuring the shadow copy is prepared.
  • Updated ptySpawn tool in src/plugin/pty/tools/spawn.ts to support the now-async manager.spawn method.

Impact

@mynameistito
Copy link
Author

mynameistito commented Jan 18, 2026

Please don't merge yet 😅

Edit: sweet it works as intended on Windows!

However maybe a little laggy if anyone else on Windows wants to check it out too that would be great :)

@shekohex
Copy link
Owner

You should upgrade to https://github.com/shekohex/opencode-pty/releases/tag/v0.1.5 and try to apply your fix. or maybe it works without it? opencode uses the same lib internally, so maybe worth firing off an agent and it will help with that.

Needs more eyes on this PR for people with windows machines to try it out.

@mynameistito
Copy link
Author

You should upgrade to v0.1.5 (release) and try to apply your fix. or maybe it works without it? opencode uses the same lib internally, so maybe worth firing off an agent and it will help with that.

Needs more eyes on this PR for people with windows machines to try it out.

Will have a suss, also FYI that was fired off by my agent 😭

@mynameistito
Copy link
Author

You should upgrade to v0.1.5 (release) and try to apply your fix. or maybe it works without it? opencode uses the same lib internally, so maybe worth firing off an agent and it will help with that.
Needs more eyes on this PR for people with windows machines to try it out.

Will have a suss, also FYI that was fired off by my agent 😭

Hey so yeah, I haven't fired my agent on it yet, but it still insta crashes with it on. and giving the issue failed to install for a plugin that is set after this plugin.

Will try get my agent to fix it later.

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.

[Windows] Startup crash when opening multiple instances: EBUSY: failed copying files... package bun-pty

2 participants