@devries-cameron20 / t3code-1 / commits / f41518f3bc
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

ci(release): desktop builds that cannot open no longer publish (#25928)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 27, 2026 at 05:31 UTC f41518f3bc2672c419871c02a3c6728d0f627142
11 files changed +146 -62
.github/workflows/release-desktop.yml
+38
@@ -64,6 +64,12 @@ on:
64 required: false
65 default: false
66 type: boolean
67 + # Whether the job opens the packaged app against a seeded database and
68 + # opens a thread before uploading it. Linux AppImage or macOS DMG.
69 + launch_check:
70 + required: false
71 + default: false
72 + type: boolean
73 # A runner of the target's own platform and architecture, for a `runner`
74 # that cannot execute the target. The build job skips everything that
75 # runs the packaged binaries, and a second job runs it there.
@@ -517,6 +523,38 @@ jobs:
523
524 vp run dist:desktop:artifact "${args[@]}"
525
526 + # A build can package fine and still not open (a missing module in the
527 + # backend or the bundle). This launches the app from the shipped
528 + # AppImage or DMG.
529 + - name: Launch check
530 + if: inputs.launch_check
531 + shell: bash
532 + run: |
533 + set -euo pipefail
534 + check=(node scripts/smoke-desktop-app.ts --artifacts-dir "$RUNNER_TEMP/desktop-launch-check")
535 + if [[ "${{ inputs.platform }}" == "mac" ]]; then
536 + mount="$RUNNER_TEMP/desktop-launch-dmg"
537 + hdiutil attach -nobrowse -readonly -mountpoint "$mount" "$(ls "$GITHUB_WORKSPACE"/release/*.dmg)"
538 + trap 'hdiutil detach "$mount" -force >/dev/null || true' EXIT
539 + app=$(ls -d "$mount"/*.app)
540 + executable=$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "$app/Contents/Info.plist")
541 + "${check[@]}" --executable "$app/Contents/MacOS/$executable"
542 + else
543 + sudo apt-get install -y xvfb
544 + appimage=$(ls "$GITHUB_WORKSPACE"/release/*.AppImage)
545 + chmod +x "$appimage"
546 + (cd "$RUNNER_TEMP" && "$appimage" --appimage-extract >/dev/null)
547 + xvfb-run -a "${check[@]}" --executable "$RUNNER_TEMP/squashfs-root/t3code"
548 + fi
549 +
550 + - name: Upload launch check output
551 + if: failure() && inputs.launch_check
552 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
553 + with:
554 + name: desktop-launch-check-${{ inputs.platform }}-${{ inputs.arch }}
555 + path: ${{ runner.temp }}/desktop-launch-check
556 + if-no-files-found: ignore
557 +
558 # The verify job runs what this host could not: the packaged natives and
559 # the CLI. Its scripts are bundled so that job needs no install.
560 - name: Stage verification inputs
.github/workflows/release.yml
+2
@@ -619,6 +619,7 @@ jobs:
619 rust_target: aarch64-apple-darwin
620 resource_key: darwin-arm64
621 cli_archive: true
622 + launch_check: true
623
624 desktop_mac_x64:
625 name: Desktop macOS x64
@@ -668,6 +669,7 @@ jobs:
669 rust_target: x86_64-unknown-linux-gnu
670 resource_key: linux-x64
671 cli_archive: true
672 + launch_check: true
673
674 # node-pty has no Linux prebuild and compiles from source, so the arm64 app
675 # and archive are built on arm64 hardware rather than cross-built.
apps/desktop/package.json
+1 -2
@@ -7,8 +7,7 @@
7 "scripts": {
8 "ensure:electron": "node scripts/ensure-electron-runtime.mjs",
9 "start": "node scripts/start-electron.mjs",
10 - "test": "vp test run --passWithNoTests",
11 - "smoke-test": "node scripts/smoke-test.mjs"
10 + "test": "vp test run --passWithNoTests"
11 },
12 "dependencies": {
13 "@clerk/electron": "catalog:",
apps/desktop/scripts/smoke-test.mjs deleted
-58
@@ -1,58 +0,0 @@
1 -import * as NodeChildProcess from "node:child_process";
2 -import * as NodePath from "node:path";
3 -import * as NodeURL from "node:url";
4 -import { resolveElectronLaunchCommand } from "./electron-launcher.mjs";
5 -
6 -const __dirname = NodePath.dirname(NodeURL.fileURLToPath(import.meta.url));
7 -const desktopDir = NodePath.resolve(__dirname, "..");
8 -const mainJs = NodePath.resolve(desktopDir, "dist-electron/boot.cjs");
9 -
10 -console.log("\nLaunching Electron smoke test...");
11 -
12 -const electronCommand = resolveElectronLaunchCommand([mainJs]);
13 -const child = NodeChildProcess.spawn(electronCommand.electronPath, electronCommand.args, {
14 - stdio: ["pipe", "pipe", "pipe"],
15 - env: {
16 - ...process.env,
17 - VITE_DEV_SERVER_URL: "",
18 - ELECTRON_ENABLE_LOGGING: "1",
19 - },
20 -});
21 -
22 -let output = "";
23 -child.stdout.on("data", (chunk) => {
24 - output += chunk.toString();
25 -});
26 -child.stderr.on("data", (chunk) => {
27 - output += chunk.toString();
28 -});
29 -
30 -const timeout = setTimeout(() => {
31 - child.kill();
32 -}, 8_000);
33 -
34 -child.on("exit", () => {
35 - clearTimeout(timeout);
36 -
37 - const fatalPatterns = [
38 - "Cannot find module",
39 - "MODULE_NOT_FOUND",
40 - "Refused to execute",
41 - "Uncaught Error",
42 - "Uncaught TypeError",
43 - "Uncaught ReferenceError",
44 - ];
45 - const failures = fatalPatterns.filter((pattern) => output.includes(pattern));
46 -
47 - if (failures.length > 0) {
48 - console.error("\nDesktop smoke test failed:");
49 - for (const failure of failures) {
50 - console.error(` - ${failure}`);
51 - }
52 - console.error("\nFull output:\n" + output);
53 - process.exit(1);
54 - }
55 -
56 - console.log("Desktop smoke test passed.");
57 - process.exit(0);
58 -});
docs/operations/release.md
+1
@@ -36,6 +36,7 @@ the version.
36 - macOS `x64` DMG
37 - Linux `x64` and `arm64` AppImage and `.deb`, from one electron-builder run. The `.deb` updates in the app through electron-updater, which installs it with `dpkg`.
38 - Windows `x64` and `arm64` NSIS installer
39 +- Opens the packaged Linux x64 AppImage (under Xvfb) and macOS arm64 DMG against a seeded database and opens a thread (`scripts/smoke-desktop-app.ts`). A build whose backend or bundle cannot start fails here, so nothing is published. The database in `scripts/fixtures/desktop-launch` is an old snapshot on purpose: the packaged server must migrate it forward, as it does for upgrading users. Do not regenerate it on schema changes.
40 - Publishes one GitHub Release with all produced files.
41 - Stable tags with a suffix after `X.Y.Z` (for example `1.2.3-alpha.1`) are published as GitHub prereleases.
42 - Only plain stable `X.Y.Z` releases are marked as the repository's latest release.
knip.jsonc
+3 -1
@@ -21,7 +21,8 @@
21 // worktree setup (from t3.json) run directly. release-desktop.yml bundles the
22 // Windows verify script with esbuild through a path knip does not trace,
23 // electron-builder loads the macOS signer by path, and mobile-e2e.ts runs
24 - // agent-device's CLI by path.
24 + // agent-device's CLI by path. release-desktop.yml runs the desktop launch
25 + // check through xvfb-run, which knip does not trace.
26 "entry": [
27 // These fixture scripts are injected into a browser page by path.
28 "fixtures/*/*.js",
@@ -29,6 +30,7 @@
30 "mobile-native-client.ts",
31 "setup-worktree.ts",
32 "sign-macos.ts",
33 + "smoke-desktop-app.ts",
34 "verify-windows-desktop-artifact.ts",
35 ],
36 "ignoreDependencies": ["agent-device", "esbuild"],
package.json
-1
@@ -39,7 +39,6 @@
39 "test:cached": "node scripts/test-cached.ts",
40 "test:perf:v2-wire": "vp test run apps/server/src/orchestration-v2/WireProjection.test.ts apps/server/src/orchestration-v2/threadHistoryPaging.test.ts apps/server/src/orchestration-v2/ThreadStream.test.ts apps/server/src/orchestration-v2/ThreadTransportPerformance.test.ts apps/server/src/orchestration-v2/ShellStream.test.ts apps/server/src/orchestration-v2/CommandPolicy.test.ts apps/server/src/orchestration-v2/runtimeLayer.test.ts apps/server/src/ws.test.ts packages/contracts/src/orchestrationV2.test.ts packages/client-runtime/src/operations/commands.test.ts packages/client-runtime/src/operations/commands.performance.test.ts packages/client-runtime/src/state/boundedThreadSnapshotHttp.test.ts packages/client-runtime/src/state/threadHistoryController.test.ts packages/client-runtime/src/state/threadHistoryMerge.test.ts packages/client-runtime/src/state/threads-sync.test.ts packages/client-runtime/src/state/shellReducer.test.ts",
41 "test:resource-monitor": "cargo test --locked --manifest-path native/resource-monitor/Cargo.toml",
42 - "test:desktop-smoke": "vp run --filter @t3tools/desktop smoke-test",
42 "fmt": "vp fmt",
43 "fmt:check": "vp fmt --check",
44 "dist:desktop:artifact": "node scripts/build-desktop-artifact.ts",
pnpm-lock.yaml
+3
@@ -2258,6 +2258,9 @@ importers:
2258 effect:
2259 specifier: 4.0.5
2260 version: 4.0.5
2261 + playwright-core:
2262 + specifier: 1.60.0
2263 + version: 1.60.0
2264 plist:
2265 specifier: 'catalog:'
2266 version: 3.1.1
scripts/fixtures/desktop-launch/statev2.sqlite
Binary files /dev/null and b/scripts/fixtures/desktop-launch/statev2.sqlite differ
scripts/package.json
+1
@@ -14,6 +14,7 @@
14 "@t3tools/tailscale": "workspace:*",
15 "agent-device": "0.21.32",
16 "effect": "catalog:",
17 + "playwright-core": "1.60.0",
18 "plist": "catalog:",
19 "pngjs": "7.0.0",
20 "sharp": "0.35.4"
scripts/smoke-desktop-app.ts new
+97
@@ -0,0 +1,97 @@
1 +// @effect-diagnostics nodeBuiltinImport:off globalConsole:off
2 +// Launches a packaged desktop app against a seeded T3 home, opens a thread, and checks its
3 +// messages render. Release jobs run it so a build whose backend or bundle cannot start fails
4 +// before it is published.
5 +import * as NodeFS from "node:fs";
6 +import * as NodeOS from "node:os";
7 +import * as NodePath from "node:path";
8 +import * as NodeTimersPromises from "node:timers/promises";
9 +import * as NodeUtil from "node:util";
10 +import { _electron, type ElectronApplication } from "playwright-core";
11 +
12 +// A snapshot from an older build on purpose: the packaged server must migrate it forward, as it
13 +// does for every upgrading user. It holds one project and two threads, nothing else.
14 +const FIXTURE_DB = NodePath.join(import.meta.dirname, "fixtures/desktop-launch/statev2.sqlite");
15 +const THREAD_TITLE = "Release launch check";
16 +const THREAD_MESSAGE = "The release opens and shows this thread.";
17 +const STEP_TIMEOUT_MS = 60_000;
18 +
19 +const { values } = NodeUtil.parseArgs({
20 + options: {
21 + executable: { type: "string" },
22 + "artifacts-dir": { type: "string" },
23 + },
24 +});
25 +const executable = values.executable;
26 +if (!executable)
27 + throw new Error("Usage: smoke-desktop-app.ts --executable <app> [--artifacts-dir <dir>]");
28 +const artifactsDir = NodePath.resolve(values["artifacts-dir"] ?? "desktop-launch-check");
29 +
30 +const home = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-desktop-launch-"));
31 +const t3Home = NodePath.join(home, "t3");
32 +NodeFS.mkdirSync(NodePath.join(t3Home, "userdata"), { recursive: true });
33 +NodeFS.copyFileSync(FIXTURE_DB, NodePath.join(t3Home, "userdata/statev2.sqlite"));
34 +
35 +let step = "launching the app";
36 +let app: ElectronApplication | undefined;
37 +try {
38 + app = await _electron.launch({
39 + executablePath: executable,
40 + // Linux CI runners do not allow the Chromium sandbox's user namespaces.
41 + args: ["--no-sandbox"],
42 + // HOME stays real: on macOS a fake HOME has no login keychain, and safeStorage blocks the
43 + // main process on a keychain dialog. macOS keeps its Electron profile in the runner's HOME.
44 + env: {
45 + ...process.env,
46 + XDG_CONFIG_HOME: NodePath.join(home, ".config"),
47 + XDG_DATA_HOME: NodePath.join(home, ".local/share"),
48 + T3CODE_HOME: t3Home,
49 + T3CODE_TELEMETRY_ENABLED: "false",
50 + T3CODE_DISABLE_AUTO_UPDATE: "true",
51 + },
52 + timeout: STEP_TIMEOUT_MS,
53 + });
54 + // A backend that never starts leaves no window, or only the "could not start" window, so the
55 + // thread wait below fails either way and its screenshot shows the startup error.
56 + step = "waiting for the first window";
57 + const page = await app.firstWindow({ timeout: STEP_TIMEOUT_MS });
58 + try {
59 + step = `finding "${THREAD_TITLE}" in the sidebar`;
60 + const thread = page.locator("li[data-thread-item]", { hasText: THREAD_TITLE });
61 + await thread.waitFor({ timeout: STEP_TIMEOUT_MS });
62 + step = "opening the thread";
63 + await thread.click();
64 + await page.getByText(THREAD_MESSAGE).waitFor({ timeout: STEP_TIMEOUT_MS });
65 + } catch (error) {
66 + NodeFS.mkdirSync(artifactsDir, { recursive: true });
67 + await page
68 + .screenshot({ path: NodePath.join(artifactsDir, "window.png"), timeout: 10_000 })
69 + .catch(() => {});
70 + throw error;
71 + }
72 + console.log("Desktop launch check passed: the app opened and showed the seeded thread.");
73 +} catch (error) {
74 + console.error(`Desktop launch check failed while ${step}.`);
75 + NodeFS.mkdirSync(artifactsDir, { recursive: true });
76 + console.error(error instanceof Error ? error.message : error);
77 + const logs = NodePath.join(t3Home, "userdata/logs");
78 + if (NodeFS.existsSync(logs)) {
79 + NodeFS.cpSync(logs, NodePath.join(artifactsDir, "logs"), { recursive: true });
80 + const serverLog = NodePath.join(logs, "server-child.log");
81 + if (NodeFS.existsSync(serverLog)) {
82 + console.error("\nLast backend output (server-child.log):");
83 + console.error(NodeFS.readFileSync(serverLog, "utf8").split("\n").slice(-20).join("\n"));
84 + }
85 + }
86 + process.exitCode = 1;
87 +} finally {
88 + if (app) {
89 + // A hung app never finishes closing; kill it so the job does not wait for its timeout.
90 + // Playwright drops the process handle once the app closes, so read it first.
91 + const child = app.process();
92 + const closed = app.close().catch(() => {});
93 + await Promise.race([closed, NodeTimersPromises.setTimeout(10_000, undefined, { ref: false })]);
94 + child.kill("SIGKILL");
95 + }
96 + NodeFS.rmSync(home, { recursive: true, force: true, maxRetries: 5 });
97 +}