Skip to content

fix: crosscode failed to start opencode serve on windows - #134

Merged
snhsish merged 1 commit into
snhsish:mainfrom
spicybirsge:fix/opencode-v2-windows-failed-to-start-and-prints-deadQR
Oct 15, 2026
Merged

snhsish merged 1 commit into
snhsish:mainfrom
spicybirsge:fix/opencode-v2-windows-failed-to-start-and-prints-deadQR

Conversation

@spicybirsge

@spicybirsge spicybirsge commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

fixes #128 and #131

Summary

Fix OpenCode V2 startup on Windows when installed through an npm command wrapper, and prevent Crosscode from displaying a QR code when the backend fails to start.

Problem

Crosscode launched opencode using Node’s shell-free process APIs. On the affected Windows installation, the command resolved to an npm .cmd wrapper, causing:
spawn opencode ENOENT
Readiness detection could still return an unverified port, allowing the tunnel to connect and a QR code to appear despite OpenCode being unavailable.

Changes

  • Use cross-spawn to support Windows command wrappers without globally enabling a shell.
  • Use the same launcher for OpenCode version detection.
  • Require a successful authenticated health check before proceeding with tunnel setup.
  • Reject startup errors, early process exits, and readiness timeouts instead of returning dead ports.
  • Terminate Windows wrapper process trees during shutdown, fallback, and fatal-error cleanup.
  • Catch asynchronous fallback startup failures.

Validation

  • Verified startup with npm-installed OpenCode V2.0.27 on Windows 11, also tested from phone by scanning the QR and it connected.
  • Confirmed correct V2 detection and a successful authenticated health check.
  • CLI build and TypeScript checks passed.
  • Linux/macOS runtime behavior have not been verified.

@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
crosscode-web Skipped Skipped Oct 14, 2026 7:46am UTC

@snhsish
snhsish self-requested a review October 15, 2026 14:47
@snhsish snhsish self-assigned this Oct 15, 2026
@snhsish snhsish added enhancement New feature or request fixes: done labels Oct 15, 2026
@snhsish
snhsish merged commit 10afd6e into snhsish:main Oct 15, 2026
6 checks passed

This branch was previously deployed

1 inactive deployment
Preview — d2c55ab0 Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request fixes: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: says failed to start opencode serve at first, but later generate a QR that doesnt work

2 participants