From 560106bdd59f1c0dcc269a5283f86b07ac31260a Mon Sep 17 00:00:00 2001 From: tiisetso Date: Tue, 20 Oct 2026 09:15:35 +0200 Subject: [PATCH 1/5] fix(ci): run PR checks on GitHub-hosted runners Replace unavailable Blacksmith labels with ubuntu-24.04 and windows-2025 for PR tests and duplicate checks. Preserve every job, matrix entry and command while allowing this fork's queued checks to start. --- .github/workflows/pr-management.yml | 2 +- .github/workflows/test.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-management.yml b/.github/workflows/pr-management.yml index b6aa4e589d..ecb1c7b72d 100644 --- a/.github/workflows/pr-management.yml +++ b/.github/workflows/pr-management.yml @@ -6,7 +6,7 @@ on: jobs: check-duplicates: - runs-on: blacksmith-4vcpu-ubuntu-2404 + runs-on: ubuntu-24.04 permissions: contents: read pull-requests: write diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d004db4658..c1c8f491ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ env: jobs: affected: name: affected packages - runs-on: blacksmith-4vcpu-ubuntu-2404 + runs-on: ubuntu-24.04 outputs: app: ${{ steps.packages.outputs.app }} steps: @@ -58,9 +58,9 @@ jobs: matrix: settings: - name: linux - host: blacksmith-4vcpu-ubuntu-2404 + host: ubuntu-24.04 - name: windows - host: blacksmith-4vcpu-windows-2025 + host: windows-2025 runs-on: ${{ matrix.settings.host }} defaults: run: @@ -178,9 +178,9 @@ jobs: matrix: settings: - name: linux - host: blacksmith-4vcpu-ubuntu-2404 + host: ubuntu-24.04 - name: windows - host: blacksmith-4vcpu-windows-2025 + host: windows-2025 runs-on: ${{ matrix.settings.host }} env: E2E_ENABLED: ${{ needs.affected.outputs.app == 'true' && github.ref_name != 'dev' && github.head_ref != 'dev' }} From 65b4da5b81bad5599741416e86d334289f6fc2ac Mon Sep 17 00:00:00 2001 From: tiisetso Date: Tue, 20 Oct 2026 09:35:40 +0200 Subject: [PATCH 2/5] fix(ci): repair V2 desktop test prerequisites and Windows fixtures --- .gitattributes | 3 +++ .github/workflows/test.yml | 4 +++ packages/desktop/electron.vite.config.test.ts | 2 +- packages/desktop/package.json | 2 +- .../main/browser/download-recovery-data.ts | 13 ++++++++-- .../src/main/macos-user-install.test.ts | 25 ++++++++++--------- 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.gitattributes b/.gitattributes index 9f43f6095a..d575062b44 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,6 @@ packages/core/src/database/migration.gen.ts linguist-generated packages/core/src/models-dev/snapshot.txt linguist-generated packages/core/src/**/*.txt text eol=lf packages/httpapi-codegen/test/generated/*.ts text eol=lf + +# Preserve the audited bytes of the vendored CookieJar bundle on Windows. +packages/desktop/vendor/cm-ae/** -text diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1c8f491ea..449236f274 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,6 +84,10 @@ jobs: if: runner.os == 'Linux' run: bun run test:effect-simplification-rules + - name: Install Electron for desktop runtime tests + working-directory: packages/desktop + run: node node_modules/electron/install.js + - name: Check Effect simplifications if: runner.os == 'Linux' run: bun run lint:effect-simplifications diff --git a/packages/desktop/electron.vite.config.test.ts b/packages/desktop/electron.vite.config.test.ts index bde2052332..b66b4b77ca 100644 --- a/packages/desktop/electron.vite.config.test.ts +++ b/packages/desktop/electron.vite.config.test.ts @@ -39,7 +39,7 @@ test("minifies only builds, previews onboarding only in development, and ships s process.env.OPENCODE_CLI_TARGET = item.target const main = (await load("build")).config.main expect(main?.build?.externalizeDeps).toEqual({ - exclude: bundled, + exclude: ["@cookiemonster/wpp", ...bundled], include: [nodePtyPackage(item.target)], }) } diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 9f5cca8ce0..730a008ae2 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -11,7 +11,7 @@ }, "scripts": { "typecheck": "tsgo -b", - "test": "bun test --timeout 30000", + "test": "bun test --preload ./test/preload.ts --timeout 30000", "dev": "bun ./scripts/dev.ts", "migration": "bun ./scripts/migration.ts", "prebuild": "bun ./scripts/prebuild.ts", diff --git a/packages/desktop/src/main/browser/download-recovery-data.ts b/packages/desktop/src/main/browser/download-recovery-data.ts index d8a77b8dcf..8a3b66f1d5 100644 --- a/packages/desktop/src/main/browser/download-recovery-data.ts +++ b/packages/desktop/src/main/browser/download-recovery-data.ts @@ -1,6 +1,6 @@ import { createHash, randomUUID } from "node:crypto" import { constants } from "node:fs" -import { open, mkdir, unlink, stat, copyFile } from "node:fs/promises" +import { open, mkdir, unlink, stat, lstat, copyFile } from "node:fs/promises" import { basename, dirname, extname, isAbsolute, join } from "node:path" import { physicalDownloadPath } from "./download-path" @@ -218,7 +218,16 @@ export async function publishDownload( return destination } catch (error) { - if (!error || typeof error !== "object" || !("code" in error) || error.code !== "EEXIST") throw error + if (!error || typeof error !== "object" || !("code" in error)) throw error + if (error.code === "EEXIST") continue + // Windows reports an existing directory as EPERM rather than EEXIST. + if ( + process.platform === "win32" && + error.code === "EPERM" && + (await lstat(destination).catch(() => undefined))?.isDirectory() + ) + continue + throw error } } diff --git a/packages/desktop/src/main/macos-user-install.test.ts b/packages/desktop/src/main/macos-user-install.test.ts index 51002ca8df..4ccb9fe908 100644 --- a/packages/desktop/src/main/macos-user-install.test.ts +++ b/packages/desktop/src/main/macos-user-install.test.ts @@ -113,7 +113,8 @@ test("confirmation, failure handling and lock handoff precede launch", async () } }) -test("replaces the whole app, retains the previous bundle and preserves unrelated data", async () => { +// These filesystem fixtures require POSIX directory handles and permissions. +test.skipIf(process.platform === "win32")("replaces the whole app, retains the previous bundle and preserves unrelated data", async () => { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source", "CookieMonster.app") const applications = join(root, "Applications With Spaces") @@ -151,7 +152,7 @@ test("replaces the whole app, retains the previous bundle and preserves unrelate } }) -test("moves read-only bundle roots and restores their modes without changing the source", async () => { +test.skipIf(process.platform === "win32")("moves read-only bundle roots and restores their modes without changing the source", async () => { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") const destination = join(root, "CookieMonster.app") @@ -208,7 +209,7 @@ test("moves read-only bundle roots and restores their modes without changing the } }) -test("backup cleanup is best-effort and retries after a later successful replacement", async () => { +test.skipIf(process.platform === "win32")("backup cleanup is best-effort and retries after a later successful replacement", async () => { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") const destination = join(root, "CookieMonster.app") @@ -269,7 +270,7 @@ test("backup cleanup is best-effort and retries after a later successful replace } }) -test("pruning leaves unowned, changed, symlinked and unrelated backup candidates alone", async () => { +test.skipIf(process.platform === "win32")("pruning leaves unowned, changed, symlinked and unrelated backup candidates alone", async () => { for (const change of [ "unmarked", "extra", @@ -365,7 +366,7 @@ test("pruning leaves unowned, changed, symlinked and unrelated backup candidates } }) -test("backup ownership-write failure leaves older backups without failing the published install", async () => { +test.skipIf(process.platform === "win32")("backup ownership-write failure leaves older backups without failing the published install", async () => { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") const destination = join(root, "CookieMonster.app") @@ -409,7 +410,7 @@ test("backup ownership-write failure leaves older backups without failing the pu } }) -test("failed staging, moves, permission cleanup and recovery never prune completed backups", async () => { +test.skipIf(process.platform === "win32")("failed staging, moves, permission cleanup and recovery never prune completed backups", async () => { for (const failure of ["staging", "backup", "publication", "recovery", "chmod", "close"]) { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") @@ -513,7 +514,7 @@ test("failed staging, moves, permission cleanup and recovery never prune complet } }) -test("backup handle cleanup failures restore the moved app before reporting failure", async () => { +test.skipIf(process.platform === "win32")("backup handle cleanup failures restore the moved app before reporting failure", async () => { for (const failure of ["chmod", "close"]) { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") @@ -578,7 +579,7 @@ test("backup handle cleanup failures restore the moved app before reporting fail } }) -test("publication handle cleanup failures retain the complete new app and any previous backup", async () => { +test.skipIf(process.platform === "win32")("publication handle cleanup failures retain the complete new app and any previous backup", async () => { for (const existing of [false, true]) { for (const failure of ["chmod", "close"]) { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) @@ -649,7 +650,7 @@ test("publication handle cleanup failures retain the complete new app and any pr } }) -test("permission and move failures are not masked by mode restoration or handle close failures", async () => { +test.skipIf(process.platform === "win32")("permission and move failures are not masked by mode restoration or handle close failures", async () => { for (const failure of ["chmod", "rename"]) { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") @@ -711,7 +712,7 @@ test("permission and move failures are not masked by mode restoration or handle } }) -test("failed staging copies leave the installed app intact and can be retried", async () => { +test.skipIf(process.platform === "win32")("failed staging copies leave the installed app intact and can be retried", async () => { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") const destination = join(root, "CookieMonster.app") @@ -796,7 +797,7 @@ test("rejects self-replacement and destinations changed while copying", async () } }) -test("concurrent first installs publish only one complete bundle", async () => { +test.skipIf(process.platform === "win32")("concurrent first installs publish only one complete bundle", async () => { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") const destination = join(root, "CookieMonster.app") @@ -823,7 +824,7 @@ test("concurrent first installs publish only one complete bundle", async () => { } }) -test("publication failures restore the old app or retain its backup without overwriting concurrent data", async () => { +test.skipIf(process.platform === "win32")("publication failures restore the old app or retain its backup without overwriting concurrent data", async () => { for (const scenario of ["restore", "restore-fails", "concurrent-destination"]) { const root = await mkdtemp(join(tmpdir(), "cm-install-test-")) const source = join(root, "Source") From 65618da109b0ed345380ab43c75548ea63c9f470 Mon Sep 17 00:00:00 2001 From: tiisetso Date: Tue, 20 Oct 2026 09:51:33 +0200 Subject: [PATCH 3/5] fix(ci): install browser prerequisites and preserve visible effort coverage --- .github/actions/setup-bun/action.yml | 2 +- .github/workflows/test.yml | 15 ++++++++++++++- packages/app/e2e/regression/composer.spec.ts | 12 ++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-bun/action.yml b/.github/actions/setup-bun/action.yml index 013b334b56..77c608d432 100644 --- a/.github/actions/setup-bun/action.yml +++ b/.github/actions/setup-bun/action.yml @@ -20,7 +20,7 @@ runs: - name: Setup Node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - node-version: "24" + node-version: "24.15" - name: Get baseline download URL id: bun-url diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 449236f274..c011ed17ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,7 +86,20 @@ jobs: - name: Install Electron for desktop runtime tests working-directory: packages/desktop - run: node node_modules/electron/install.js + run: node -e "require(require.resolve('electron/install.js'))" + + - name: Install Chromium for browser unit tests + working-directory: packages/app + run: bunx playwright install --with-deps chromium + + - name: Install ripgrep for offline core tests + run: | + if [ "$RUNNER_OS" = "Linux" ]; then + sudo apt-get update + sudo apt-get install -y ripgrep + else + choco install ripgrep --yes --no-progress + fi - name: Check Effect simplifications if: runner.os == 'Linux' diff --git a/packages/app/e2e/regression/composer.spec.ts b/packages/app/e2e/regression/composer.spec.ts index 87fe50661d..652fae7188 100644 --- a/packages/app/e2e/regression/composer.spec.ts +++ b/packages/app/e2e/regression/composer.spec.ts @@ -455,7 +455,7 @@ test("marks a Console provider with its workspace only when it is also connected await expect(menu.getByText(/Anomaly \//)).toHaveCount(0) }) -test("shows thinking on hover or a non-default selection while preserving keyboard access", async ({ page }) => { +test("keeps the effort picker visible while preserving selection and keyboard access", async ({ page }) => { const { editor: input } = await openSession(page, { name: "ComposerThinking", provider: provider({ id: "thinking-model", name: "Thinking Model", variants: { high: {} } }), @@ -467,13 +467,13 @@ test("shows thinking on hover or a non-default selection while preserving keyboa await page.mouse.move(0, 0) await expect(control).toHaveText("default") - await expect(control).toHaveCSS("opacity", "0") - await expect(control).toHaveCSS("pointer-events", "none") + await expect(control).toHaveCSS("opacity", "1") + await expect(control).toHaveCSS("pointer-events", "auto") await input.hover() await expect(control).toHaveCSS("opacity", "1") - // The menu keeps the control visible after the pointer leaves. + // The control stays visible while its menu is open. await control.click() await expect(option("high")).toBeVisible() await page.mouse.move(0, 0) @@ -491,7 +491,7 @@ test("shows thinking on hover or a non-default selection while preserving keyboa await input.click() await page.mouse.move(0, 0) await expect(control).toHaveText("default") - await expect(control).toHaveCSS("opacity", "0") + await expect(control).toHaveCSS("opacity", "1") // The single-agent fixture has only Add and Model before the thinking trigger. await page.keyboard.press("Tab") @@ -507,5 +507,5 @@ test("shows thinking on hover or a non-default selection while preserving keyboa await page.keyboard.press("Escape") await expect(control).toBeFocused() await page.keyboard.press("Tab") - await expect(control).toHaveCSS("opacity", "0") + await expect(control).toHaveCSS("opacity", "1") }) From 98b57d5349e7ce36805df08013f839d6a9b62320 Mon Sep 17 00:00:00 2001 From: tiisetso Date: Tue, 20 Oct 2026 10:19:13 +0200 Subject: [PATCH 4/5] chore(ci): serialize workspace unit checks --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c011ed17ea..06d0abc5a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,12 +122,12 @@ jobs: - name: Run unit tests timeout-minutes: 20 run: | - # The runners have four vCPUs, and each Bun test process performs its own concurrent work. + # Each package creates concurrent work; serialize packages to bound hosted process pressure. if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - GITHUB_ACTIONS=false bun turbo test --concurrency=3 + GITHUB_ACTIONS=false bun turbo test --concurrency=1 exit 0 fi - GITHUB_ACTIONS=false bun turbo test --affected --concurrency=3 + GITHUB_ACTIONS=false bun turbo test --affected --concurrency=1 env: OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }} TURBO_SCM_BASE: ${{ github.event_name == 'pull_request' && format('{0}^1', github.sha) || github.event.before }} From 28eaf96c19f8291fb4dd51fffb1437e345e7e362 Mon Sep 17 00:00:00 2001 From: tiisetso Date: Tue, 20 Oct 2026 11:16:58 +0200 Subject: [PATCH 5/5] fix(core): keep native AE loading out of workerd --- packages/core/package.json | 4 ++++ packages/core/src/cm-ae/plugin.ts | 2 ++ packages/core/src/cm-ae/plugin.workerd.ts | 4 ++++ packages/core/src/cm-ae/skills.ts | 6 +++--- packages/core/src/plugin/internal.ts | 4 ++-- packages/core/test/cm-ae-platform.test.ts | 22 ++++++++++++++++++++++ 6 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 packages/core/src/cm-ae/plugin.workerd.ts create mode 100644 packages/core/test/cm-ae-platform.test.ts diff --git a/packages/core/package.json b/packages/core/package.json index c249782e64..f1d67760e5 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -30,6 +30,10 @@ "./*": "./src/*.ts" }, "imports": { + "#cm-ae-plugin": { + "workerd": "./src/cm-ae/plugin.workerd.ts", + "default": "./src/cm-ae/plugin.ts" + }, "#sqlite": { "workerd": "./src/database/sqlite.workerd.ts", "bun": "./src/database/sqlite.bun.ts", diff --git a/packages/core/src/cm-ae/plugin.ts b/packages/core/src/cm-ae/plugin.ts index 7b6c8dbc91..0c544a30b6 100644 --- a/packages/core/src/cm-ae/plugin.ts +++ b/packages/core/src/cm-ae/plugin.ts @@ -238,3 +238,5 @@ export const Plugin = { ) }), } + +export const plugins = [Plugin] as const diff --git a/packages/core/src/cm-ae/plugin.workerd.ts b/packages/core/src/cm-ae/plugin.workerd.ts new file mode 100644 index 0000000000..e826884ffb --- /dev/null +++ b/packages/core/src/cm-ae/plugin.workerd.ts @@ -0,0 +1,4 @@ +export * as CmAePlugin from "./plugin.workerd.js" + +// The desktop bundle loader needs native files and dynamic imports unavailable in workerd. +export const plugins = [] as const diff --git a/packages/core/src/cm-ae/skills.ts b/packages/core/src/cm-ae/skills.ts index 028c83a856..d56f92786c 100644 --- a/packages/core/src/cm-ae/skills.ts +++ b/packages/core/src/cm-ae/skills.ts @@ -2,6 +2,7 @@ import path from "node:path" import { randomBytes } from "node:crypto" import { stat } from "node:fs/promises" import { AbsolutePath } from "@opencode/schema/schema" +import { Glob } from "@opencode/util/glob" import { Schema } from "effect" import type { Skill } from "@opencode/schema/skill" import { ManagedSkill } from "./managed.js" @@ -29,11 +30,10 @@ export function skills(input: { throw error }) if (!exists) continue - for await (const file of new Bun.Glob("**/SKILL.md").scan({ + for (const file of await Glob.scan("**/SKILL.md", { cwd: root, absolute: true, - onlyFiles: true, - followSymlinks: true, + symlink: true, })) files.add(AbsolutePath.make(file)) } diff --git a/packages/core/src/plugin/internal.ts b/packages/core/src/plugin/internal.ts index a026f6342a..2f8c50efc7 100644 --- a/packages/core/src/plugin/internal.ts +++ b/packages/core/src/plugin/internal.ts @@ -1,7 +1,7 @@ export * as PluginInternal from "./internal.js" import { ScheduleRuntime } from "../schedule/runtime.js" -import { CmAePlugin } from "../cm-ae/plugin.js" +import { CmAePlugin } from "#cm-ae-plugin" import { SchedulePlugin } from "../schedule/plugin.js" import { LLMClient } from "@opencode/ai" import type { Plugin } from "@opencode/plugin/effect/plugin" @@ -290,6 +290,6 @@ export const list = Effect.fn("PluginInternal.list")(function* () { ) return { pre: resolve(pre), - post: resolve(process.env.CM_DESKTOP === "1" ? [...post, SchedulePlugin.Plugin, CmAePlugin.Plugin] : post), + post: resolve(process.env.CM_DESKTOP === "1" ? [...post, SchedulePlugin.Plugin, ...CmAePlugin.plugins] : post), } }) diff --git a/packages/core/test/cm-ae-platform.test.ts b/packages/core/test/cm-ae-platform.test.ts new file mode 100644 index 0000000000..2ecb96898e --- /dev/null +++ b/packages/core/test/cm-ae-platform.test.ts @@ -0,0 +1,22 @@ +import { expect, test } from "bun:test" +import { join } from "node:path" +import { CmAePlugin } from "#cm-ae-plugin" + +test("native AE registration keeps the desktop plugin", () => { + expect(CmAePlugin.plugins).toHaveLength(1) + expect(CmAePlugin.plugins[0] === CmAePlugin.Plugin).toBe(true) +}) + +test("workerd omits the native AE bundle loader", () => { + const result = Bun.spawnSync( + [ + process.execPath, + "--conditions=workerd", + "-e", + 'import { CmAePlugin } from "#cm-ae-plugin"; console.log(CmAePlugin.plugins.length)', + ], + { cwd: join(import.meta.dir, "..") }, + ) + expect(result.exitCode, result.stderr.toString()).toBe(0) + expect(result.stdout.toString().trim()).toBe("0") +})