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 327962621e18794f01d632dc038bbf2358578c77 Mon Sep 17 00:00:00 2001 From: tiisetso Date: Tue, 20 Oct 2026 12:04:06 +0200 Subject: [PATCH 5/5] fix(app): end timeline scrolls at the live offset The virtualizer core's reset-delay fallback ends a scroll with the offset read by the last scroll event. When a history prepend or anchor write moves scrollTop and a long task holds that write's own scroll event past the delay, the stale end delivery resets the core offset. Later prepend compensation then targets the stale offset, so loaded history rows are skipped. End-of-scroll deliveries now report the live scrollTop; scrolling deliveries are unchanged. Refs #89 --- .../timeline/observe-element-offset.test.ts | 40 +++++++++++++++++++ .../timeline/observe-element-offset.ts | 6 ++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/packages/app/src/session/timeline/observe-element-offset.test.ts b/packages/app/src/session/timeline/observe-element-offset.test.ts index 2a2eea1449..e6f6e59134 100644 --- a/packages/app/src/session/timeline/observe-element-offset.test.ts +++ b/packages/app/src/session/timeline/observe-element-offset.test.ts @@ -170,6 +170,46 @@ test("cleanup suppresses queued delegated callbacks, reconnect checks, and later route.remove() }) +test("ends a scroll at the live offset after a write without its own scroll event", async () => { + const viewport = document.createElement("div") + document.body.append(viewport) + + const instance = { + scrollElement: viewport, + targetWindow: window, + scrollOffset: 0, + options: { + horizontal: false, + isRtl: false, + isScrollingResetDelay: 10, + useScrollendEvent: false, + }, + } as unknown as Virtualizer + + const calls: [number, boolean][] = [] + + const cleanup = observeElementOffsetReconnectAware(instance, (offset, isScrolling) => { + calls.push([offset, isScrolling]) + instance.scrollOffset = offset + }) + + try { + viewport.scrollTop = 100 + viewport.dispatchEvent(new Event("scroll")) + // A history prepend anchors with a write whose scroll event a long task can hold past the reset delay. + viewport.scrollTop = 2_620 + await new Promise((resolve) => setTimeout(resolve, 25)) + + expect(calls).toEqual([ + [100, true], + [2_620, false], + ]) + } finally { + cleanup?.() + viewport.remove() + } +}) + type FrameWindow = { requestAnimationFrame(callback: () => void): unknown performance: { now(): number } diff --git a/packages/app/src/session/timeline/observe-element-offset.ts b/packages/app/src/session/timeline/observe-element-offset.ts index 80f3d5fb4d..5571955cd9 100644 --- a/packages/app/src/session/timeline/observe-element-offset.ts +++ b/packages/app/src/session/timeline/observe-element-offset.ts @@ -6,14 +6,16 @@ export function observeElementOffsetReconnectAware void, ) { let active = true + const element = instance.scrollElement const deliver = (offset: number, isScrolling: boolean) => { if (!active) return - callback(offset, isScrolling) + // The core's reset-delay fallback repeats the offset read by the last scroll event. A long task can hold a + // write's own scroll event past that delay, so ending the scroll at the stored offset would revert the write. + callback(isScrolling || !element ? offset : element.scrollTop, isScrolling) } const cleanupOffset = observeElementOffset(instance, deliver) - const element = instance.scrollElement const targetWindow = instance.targetWindow const root = element?.closest("main") ?? element?.ownerDocument.body