summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLuke Parker <[email protected]>2026-02-26 17:55:01 +1000
committerGitHub <[email protected]>2026-02-26 17:55:01 +1000
commitfce811b52f335eb28dc43b49a96f42b2ada751f5 (patch)
tree9d5eb1a6d4248b8e1809881f3c0ed6facaacf409
parentaae75b3cfb10cdff965fb434c487980b152efdec (diff)
downloadopencode-fce811b52f335eb28dc43b49a96f42b2ada751f5.tar.gz
opencode-fce811b52f335eb28dc43b49a96f42b2ada751f5.zip
fix: most segfaults on windows with Bun v1.3.10 stable (#15181)
-rw-r--r--.github/actions/setup-bun/action.yml56
-rw-r--r--.github/workflows/publish.yml4
-rw-r--r--.github/workflows/sign-cli.yml4
-rw-r--r--package.json2
-rw-r--r--packages/desktop/scripts/utils.ts2
-rwxr-xr-xpackages/opencode/script/build.ts7
6 files changed, 12 insertions, 63 deletions
diff --git a/.github/actions/setup-bun/action.yml b/.github/actions/setup-bun/action.yml
index e7966cb48..6c632f7e0 100644
--- a/.github/actions/setup-bun/action.yml
+++ b/.github/actions/setup-bun/action.yml
@@ -1,10 +1,5 @@
name: "Setup Bun"
description: "Setup Bun with caching and install dependencies"
-inputs:
- cross-compile:
- description: "Pre-cache canary cross-compile binaries for all targets"
- required: false
- default: "false"
runs:
using: "composite"
steps:
@@ -21,12 +16,13 @@ runs:
shell: bash
run: |
if [ "$RUNNER_ARCH" = "X64" ]; then
+ V=$(node -p "require('./package.json').packageManager.split('@')[1]")
case "$RUNNER_OS" in
macOS) OS=darwin ;;
Linux) OS=linux ;;
Windows) OS=windows ;;
esac
- echo "url=https://github.com/oven-sh/bun/releases/download/canary/bun-${OS}-x64-baseline.zip" >> "$GITHUB_OUTPUT"
+ echo "url=https://github.com/oven-sh/bun/releases/download/bun-v${V}/bun-${OS}-x64-baseline.zip" >> "$GITHUB_OUTPUT"
fi
- name: Setup Bun
@@ -35,54 +31,6 @@ runs:
bun-version-file: ${{ !steps.bun-url.outputs.url && 'package.json' || '' }}
bun-download-url: ${{ steps.bun-url.outputs.url }}
- - name: Pre-cache canary cross-compile binaries
- if: inputs.cross-compile == 'true'
- shell: bash
- run: |
- BUN_VERSION=$(bun --revision)
- if echo "$BUN_VERSION" | grep -q "canary"; then
- SEMVER=$(echo "$BUN_VERSION" | sed 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
- echo "Bun version: $BUN_VERSION (semver: $SEMVER)"
- CACHE_DIR="$HOME/.bun/install/cache"
- mkdir -p "$CACHE_DIR"
- TMP_DIR=$(mktemp -d)
- for TARGET in linux-aarch64 linux-x64 linux-x64-baseline linux-aarch64-musl linux-x64-musl linux-x64-musl-baseline darwin-aarch64 darwin-x64 windows-x64 windows-x64-baseline; do
- DEST="$CACHE_DIR/bun-${TARGET}-v${SEMVER}"
- if [ -f "$DEST" ]; then
- echo "Already cached: $DEST"
- continue
- fi
- URL="https://github.com/oven-sh/bun/releases/download/canary/bun-${TARGET}.zip"
- echo "Downloading $TARGET from $URL"
- if curl -sfL -o "$TMP_DIR/bun.zip" "$URL"; then
- unzip -qo "$TMP_DIR/bun.zip" -d "$TMP_DIR"
- if echo "$TARGET" | grep -q "windows"; then
- BIN_NAME="bun.exe"
- else
- BIN_NAME="bun"
- fi
- mv "$TMP_DIR/bun-${TARGET}/$BIN_NAME" "$DEST"
- chmod +x "$DEST"
- rm -rf "$TMP_DIR/bun-${TARGET}" "$TMP_DIR/bun.zip"
- echo "Cached: $DEST"
- # baseline bun resolves "bun-darwin-x64" to the baseline cache key
- # so copy the modern binary there too
- if [ "$TARGET" = "darwin-x64" ]; then
- BASELINE_DEST="$CACHE_DIR/bun-darwin-x64-baseline-v${SEMVER}"
- if [ ! -f "$BASELINE_DEST" ]; then
- cp "$DEST" "$BASELINE_DEST"
- echo "Cached (baseline alias): $BASELINE_DEST"
- fi
- fi
- else
- echo "Skipped: $TARGET (not available)"
- fi
- done
- rm -rf "$TMP_DIR"
- else
- echo "Not a canary build ($BUN_VERSION), skipping pre-cache"
- fi
-
- name: Install dependencies
run: bun install
shell: bash
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index cca7df5c4..8d4c9038a 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -77,8 +77,6 @@ jobs:
fetch-tags: true
- uses: ./.github/actions/setup-bun
- with:
- cross-compile: "true"
- name: Setup git committer
id: committer
@@ -90,7 +88,7 @@ jobs:
- name: Build
id: build
run: |
- ./packages/opencode/script/build.ts --all
+ ./packages/opencode/script/build.ts
env:
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
diff --git a/.github/workflows/sign-cli.yml b/.github/workflows/sign-cli.yml
index 891762231..d9d61fd80 100644
--- a/.github/workflows/sign-cli.yml
+++ b/.github/workflows/sign-cli.yml
@@ -20,12 +20,10 @@ jobs:
fetch-tags: true
- uses: ./.github/actions/setup-bun
- with:
- cross-compile: "true"
- name: Build
run: |
- ./packages/opencode/script/build.ts --all
+ ./packages/opencode/script/build.ts
- name: Upload unsigned Windows CLI
id: upload_unsigned_windows_cli
diff --git a/package.json b/package.json
index 2e7c1172a..3fd9f3066 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "AI-powered development tool",
"private": true,
"type": "module",
- "packageManager": "[email protected]",
+ "packageManager": "[email protected]",
"scripts": {
"dev": "bun run --cwd packages/opencode --conditions=browser src/index.ts",
"dev:desktop": "bun --cwd packages/desktop tauri dev",
diff --git a/packages/desktop/scripts/utils.ts b/packages/desktop/scripts/utils.ts
index f6ea7009c..2629eb466 100644
--- a/packages/desktop/scripts/utils.ts
+++ b/packages/desktop/scripts/utils.ts
@@ -8,7 +8,7 @@ export const SIDECAR_BINARIES: Array<{ rustTarget: string; ocBinary: string; ass
},
{
rustTarget: "x86_64-apple-darwin",
- ocBinary: "opencode-darwin-x64",
+ ocBinary: "opencode-darwin-x64-baseline",
assetExt: "zip",
},
{
diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts
index 19353b67f..34e80d71a 100755
--- a/packages/opencode/script/build.ts
+++ b/packages/opencode/script/build.ts
@@ -56,7 +56,7 @@ const migrations = await Promise.all(
)
console.log(`Loaded ${migrations.length} migrations`)
-const singleFlag = process.argv.includes("--single") || (!!process.env.CI && !process.argv.includes("--all"))
+const singleFlag = process.argv.includes("--single")
const baselineFlag = process.argv.includes("--baseline")
const skipInstall = process.argv.includes("--skip-install")
@@ -104,6 +104,11 @@ const allTargets: {
arch: "x64",
},
{
+ os: "darwin",
+ arch: "x64",
+ avx2: false,
+ },
+ {
os: "win32",
arch: "x64",
},