Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/actions/setup-bun/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 25 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -84,6 +84,23 @@ 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 -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'
run: bun run lint:effect-simplifications
Expand All @@ -105,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 }}
Expand Down Expand Up @@ -178,9 +195,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' }}
Expand Down
12 changes: 6 additions & 6 deletions packages/app/e2e/regression/composer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {} } }),
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -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")
})
5 changes: 4 additions & 1 deletion packages/app/e2e/regression/whats-new.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ async function serveChangelog(page: Page, body: typeof changelog | typeof cliOnl
async function start(page: Page, seed: SeedInput) {
await mockWorkspace(page, { name: "Whats New", sessions: [], seed })
await page.goto("/")
await expectAppVisible(page.getByRole("button", { name: "Settings", exact: true }))
// The startup dialog may already hide the shell from accessibility queries.
await expectAppVisible(
page.getByRole("button", { name: "Settings", exact: true, includeHidden: true }).filter({ visible: true }),
)
}

function stored(page: Page, key: string) {
Expand Down
9 changes: 9 additions & 0 deletions packages/app/src/session/session-screen.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
terminalPassedDocument,
} from "@opencode/session-ui/storybook"
import { SessionPreview } from "./story-model"
import { SettingsProvider } from "@/settings/model"
import type { JSX } from "solid-js"

const description = "opencode · modular-session-ui"

Expand Down Expand Up @@ -51,6 +53,13 @@ export default {
title: "OpenCode/Session/Complete workspace",
id: "app-current-session-surface",
component: SessionPreview,
decorators: [
(Story: () => JSX.Element) => (
<SettingsProvider>
<Story />
</SettingsProvider>
),
],
parameters: {
layout: "fullscreen",
docs: {
Expand Down
4 changes: 3 additions & 1 deletion packages/app/test-browser/cm-loading.fixture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function Fixture() {
return (
<main style={{ color: state.light ? "rgb(215, 225, 235)" : "rgb(17, 91, 177)", padding: "24px" }}>
<style>{`[data-component="session-progress-indicator-v2"] { color: inherit; }
section { display:flex; } svg { flex-shrink:0; }`}</style>
section { display:flex; } svg { flex-shrink:0; }
/* Own layer per compared row, so identical rows raster from the same tile origin. */
#project, #recent, #tabs { will-change: transform; }`}</style>
<button id="late" onClick={() => setState("late", !state.late)}>
Toggle copies
</button>
Expand Down
4 changes: 3 additions & 1 deletion packages/app/test-browser/cm-loading.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import solid from "vite-plugin-solid"

test("session cookies share their animation and phase across late mounts, updates, and reduced motion", async () => {
const directory = await mkdtemp(join(tmpdir(), "cm-loading-"))
const browser = await chromium.launch()
// SVG images follow Chromium's own reduced-motion preference (the OS setting on Windows), not page emulation.
// Pin it so the motion checks are deterministic; page emulation below still covers reduced motion.
const browser = await chromium.launch({ args: ["--force-prefers-no-reduced-motion"] })

const server = createServer(async (request, response) => {
const pathname = new URL(request.url ?? "/", "http://localhost").pathname
Expand Down
12 changes: 9 additions & 3 deletions packages/cli/script/build-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ for (const target of targets) {
)}\n`,
)
await verifyArtifact(path.join(outdir, name))
if (host) await smoke(output)
if (host) await smoke(output, builder)
}

async function resolveHostNode() {
Expand Down Expand Up @@ -225,14 +225,20 @@ async function resolveTargetNode(target: NodeTarget, host?: string) {
return realpath(executable)
}

async function smoke(output: string) {
async function smoke(output: string, node: string) {
const root = await mkdtemp(path.join(os.tmpdir(), "opencode-node-smoke-"))
const executable = path.join(root, path.basename(output))
await copyFile(output, executable)
if (process.platform !== "win32") await chmod(executable, 0o755)
run(executable, ["--version"], root)
run(executable, ["--help"], root)
await rm(root, { recursive: true, force: true })
// Use Node's retry-aware cleanup for transient Windows directory locks.
run(node, [
"--input-type=module",
"-e",
"import { rm } from 'node:fs/promises'; await rm(process.argv[1], { recursive: true, force: true, maxRetries: 10, retryDelay: 100 })",
root,
])
}

function targetName(target: NodeTarget) {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/electron.vite.config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 11 additions & 2 deletions packages/desktop/src/main/browser/download-recovery-data.ts
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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
}
}

Expand Down
25 changes: 13 additions & 12 deletions packages/desktop/src/main/macos-user-install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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-"))
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down
8 changes: 3 additions & 5 deletions packages/storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ export default defineMain({
const { mergeConfig, searchForWorkspaceRoot } = await import("vite")
const merged = mergeConfig(config, {
plugins: [tailwindcss(), playgroundCss()],
// The previous directory alias kept Solid Query unbundled.
optimizeDeps: { exclude: ["@tanstack/solid-query"] },
resolve: {
dedupe: ["solid-js", "solid-js/web", "@solidjs/meta"],
dedupe: ["solid-js", "solid-js/web", "@solidjs/meta", "@tanstack/solid-query"],
alias: [
{ find: "@solidjs/router", replacement: path.resolve(mocks, "solid-router.tsx") },
{
find: "@tanstack/solid-query",
replacement: path.resolve(here, "../../app/node_modules/@tanstack/solid-query"),
},
{ find: /^@\/providers\/models\/selection$/, replacement: path.resolve(mocks, "app/context/local.ts") },
{ find: /^@\/workspaces\/files\/model$/, replacement: path.resolve(mocks, "app/context/file.ts") },
{ find: /^@\/shell\/state\/layout$/, replacement: path.resolve(mocks, "app/context/layout.ts") },
Expand Down
Loading