Skip to content

fix(opencode): use node:http transport for ACP SDK calls on Windows - #64688

Open
lihongfang16 wants to merge 1 commit into
anomalyco:v1from
lihongfang16:fix/acp-windows-fetch-starvation
Open

lihongfang16 wants to merge 1 commit into
anomalyco:v1from
lihongfang16:fix/acp-windows-fetch-starvation

Conversation

@lihongfang16

Copy link
Copy Markdown

Issue for this PR

Closes #64686

Type of change

  • Bug fix

What does this PR do?

On Windows, every ACP session method hangs forever because Bun's fetch never completes a request once the process holds an open streaming HTTP response. The ACP server keeps a long-lived /global/event SSE subscription to its own embedded server (acp/event.ts) through the same SDK client that session RPCs use, so the concurrent SDK calls in loadDirectorySnapshot are starved and session/new/session/list never return (issue has the minimal bun repro).

Fix: on win32, pass a node:http-backed fetch to createOpencodeClient in the acp command. node:http in the same process is unaffected by the bun bug, and the SSE subscription rides the same client so it moves to the new transport as well. No behavior change on other platforms.

Also fixes the @acp/profile import in acp.ts, which doesn't resolve on the v1 branch (no such tsconfig path alias) — v1 HEAD currently fails to build with it.

How did you verify your code works?

  • Built locally on Windows (./packages/opencode/script/build.ts --single, bun 1.4.4)
  • Before: official v1.19.6 windows-x64 with acp --pure → initialize returns, session/new hangs forever (reproduced on 1.15.13 through 1.19.6)
  • After: this build with acp --pure → initialize 1.3s, session/new completes, session/prompt streams a model reply and settles with end_turn
  • typecheck clean for the changed files (the remaining src/bus/global.ts error also reproduces on unmodified v1 HEAD locally on Windows; CI typecheck on Linux is green for v1 HEAD)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Bun's fetch on Windows never completes a request once the process holds an
open streaming HTTP response. The ACP server keeps a long-lived SSE
subscription (/global/event) to its own embedded server through the same
SDK client that session methods use, so every session RPC starves forever
on Windows. Route SDK traffic through node:http there, which is unaffected.

Also fix the @acp/profile import in acp.ts, which does not resolve on the
v1 branch (no such tsconfig path alias).

Closes anomalyco#64686

This branch has not been deployed

No deployments
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.

1 participant