[PR #1794] [MERGED] fix(plugin): prevent compiled binary hang by removing lazy dynamic import #10068

Closed
opened 2026-02-16 18:14:39 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1794
Author: @monotykamary
Created: 8/10/2025
Status: Merged
Merged: 8/10/2025
Merged by: @thdxr

Base: devHead: fix/binary-hang-dynamic-import


📝 Commits (1)

  • 743e38b fix(plugin): remove lazy dynamic import of server to prevent compiled binary hang

📊 Changes

1 file changed (+2 additions, -3 deletions)

View changed files

📝 packages/opencode/src/plugin/index.ts (+2 -3)

📄 Description

Summary

  • Fix binary hang in compiled builds by reverting lazy dynamic import in plugin client to direct Server import/call #1792.
  • Restores v0.4.2 startup behavior; dev mode unaffected.

Context

  • Regression introduced in v0.4.3 where packages/opencode/src/plugin/index.ts switched to await import('../server/server') inside fetch callback.
  • Bun compile caused startup deadlock before logs; bun dev worked.

Changes

  • plugin/index.ts: direct import { Server } from '../server/server' and Server.app().fetch.

Test plan

  • Build snapshot: OPENCODE_VERSION=0.0.0-dev OPENCODE_SNAPSHOT=true OPENCODE_DRY=true ./packages/opencode/script/publish.ts
  • Run compiled binary: ./packages/opencode/dist/opencode-<os>-<arch>/bin/opencode run -p "ping" --print-logs --log-level DEBUG
  • Verify no hang; TUI also launches.

🤖 Generated with opencode


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1794 **Author:** [@monotykamary](https://github.com/monotykamary) **Created:** 8/10/2025 **Status:** ✅ Merged **Merged:** 8/10/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `fix/binary-hang-dynamic-import` --- ### 📝 Commits (1) - [`743e38b`](https://github.com/anomalyco/opencode/commit/743e38b1e01130837ecc8a11349f72fa67467a93) fix(plugin): remove lazy dynamic import of server to prevent compiled binary hang ### 📊 Changes **1 file changed** (+2 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/plugin/index.ts` (+2 -3) </details> ### 📄 Description ## Summary - Fix binary hang in compiled builds by reverting lazy dynamic import in plugin client to direct Server import/call #1792. - Restores v0.4.2 startup behavior; dev mode unaffected. ## Context - Regression introduced in v0.4.3 where `packages/opencode/src/plugin/index.ts` switched to `await import('../server/server')` inside fetch callback. - Bun compile caused startup deadlock before logs; `bun dev` worked. ## Changes - plugin/index.ts: direct `import { Server } from '../server/server'` and `Server.app().fetch`. ## Test plan - Build snapshot: `OPENCODE_VERSION=0.0.0-dev OPENCODE_SNAPSHOT=true OPENCODE_DRY=true ./packages/opencode/script/publish.ts` - Run compiled binary: `./packages/opencode/dist/opencode-<os>-<arch>/bin/opencode run -p "ping" --print-logs --log-level DEBUG` - Verify no hang; TUI also launches. 🤖 Generated with [opencode](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:39 -05:00
yindo closed this issue 2026-02-16 18:14:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10068