Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

feat(console): build and release Linux arm64 desktop artifacts (#202)

Louis Amaudruz097414aabe1b
diff --git a/.github/workflows/switch-console-release.yml b/.github/workflows/switch-console-release.yml
index 6fad8f6fa..4fe5fd08a 100644
--- a/.github/workflows/switch-console-release.yml
+++ b/.github/workflows/switch-console-release.yml
@@ -4,10 +4,10 @@ name: Switch Console release
# repo, so anyone can install it without building from source. The repo is public,
# so the release assets are too — no token, no ACL.
#
-# macOS (arm64) is signed + notarized. Linux (x64) builds AppImage, deb and rpm,
-# unsigned. Windows (x64) builds nsis and msi, also unsigned — there is no
-# Authenticode identity for this app, so SmartScreen warns on first run
-# (CHOO-1468).
+# macOS (arm64) is signed + notarized. Linux (x64 and arm64) builds AppImage, deb
+# and rpm, unsigned — each arch on a runner of that arch. Windows (x64) builds nsis
+# and msi, also unsigned — there is no Authenticode identity for this app, so
+# SmartScreen warns on first run (CHOO-1468).
#
# Trigger by pushing a tag like `switch-console-v1.1.34` (the version after
# `switch-console-v` MUST match apps/switch-console-desktop/package.json `version`).
@@ -66,13 +66,11 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version="${GITHUB_REF_NAME#switch-console-v}"
- notes="Switch Console desktop app $version — macOS arm64 and Linux x64.
+ notes="Switch Console desktop app $version — macOS arm64 and Linux x64 + arm64.
**macOS (arm64):** download the .dmg, open it, drag Switch Console to Applications. Signed and notarized with SandboxAQ's Developer ID — it opens without a Gatekeeper bypass.
- **Linux (x64):** download the .AppImage (\`chmod +x\` then run), the .deb (\`sudo apt install ./<file>.deb\`) or the .rpm (\`sudo dnf install ./<file>.rpm\`). Linux builds are unsigned.
-
- In-app updates require a GitHub login via the gh CLI (\`gh auth login\`)."
+ **Linux (x64 and arm64):** match your \`dpkg --print-architecture\`. Download the .AppImage (\`chmod +x\` then run), the .deb (\`sudo apt install ./<file>.deb\`) or the .rpm (\`sudo dnf install ./<file>.rpm\`). Linux builds are unsigned."
gh release create "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--title "Switch Console $version" \
@@ -185,12 +183,26 @@ jobs:
if-no-files-found: error
build-linux:
- name: Build & release (Linux x64)
- runs-on: ubuntu-latest
+ name: Build & release (Linux ${{ matrix.arch }})
+ runs-on: ${{ matrix.runner }}
# Waits only for the Release to exist, not for the macOS build — the two
# platform jobs are independent. Linux is unsigned, so no cert secrets.
needs: create-release
if: ${{ !cancelled() && needs.create-release.result != 'failure' }}
+ strategy:
+ # One arch must not take the other down with it: an arm64 runner outage
+ # should still ship x64.
+ fail-fast: false
+ matrix:
+ include:
+ - arch: x64
+ runner: ubuntu-latest
+ - arch: arm64
+ # Native arm64 runner rather than cross-building: `npmRebuild` is
+ # off, so the native modules baked into the package are the ones
+ # `pnpm rebuild` produced on this machine. Cross-building would
+ # emit an arm64 package carrying x64 `.node` files.
+ runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -232,9 +244,9 @@ jobs:
- name: Build workspace packages + app
run: pnpm run build
- - name: Package (linux x64, no publish)
+ - name: Package (linux ${{ matrix.arch }}, no publish)
working-directory: console/apps/switch-console-desktop
- run: pnpm exec electron-builder --linux --publish never --config electron-builder.config.ts
+ run: pnpm exec electron-builder --linux --${{ matrix.arch }} --publish never --config electron-builder.config.ts
- name: Upload to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
@@ -243,9 +255,11 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Attach the Linux installers + the electron-updater channel manifest
- # (latest-linux.yml) so auto-update works on Linux too.
+ # so auto-update works on Linux too. The glob covers both manifests:
+ # electron-builder names the arm64 one `latest-linux-arm64.yml`, and
+ # each arch's job uploads only its own.
shopt -s nullglob
- assets=(release/*.AppImage release/*.deb release/*.rpm release/*.blockmap release/latest-linux.yml)
+ assets=(release/*.AppImage release/*.deb release/*.rpm release/*.blockmap release/latest-linux*.yml)
gh release upload "$GITHUB_REF_NAME" "${assets[@]}" \
--repo "$GITHUB_REPOSITORY" \
--clobber
@@ -254,7 +268,7 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
- name: switch-console-linux-x64
+ name: switch-console-linux-${{ matrix.arch }}
path: |
console/apps/switch-console-desktop/release/*.AppImage
console/apps/switch-console-desktop/release/*.deb
@@ -370,7 +384,7 @@ jobs:
assets="$(gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name')"
echo "$assets"
missing=""
- for required in latest-mac.yml latest-linux.yml latest.yml; do
+ for required in latest-mac.yml latest-linux.yml latest-linux-arm64.yml latest.yml; do
printf '%s\n' "$assets" | grep -qx "$required" || missing="$missing $required"
done
if [ -n "$missing" ]; then
diff --git a/RELEASING.md b/RELEASING.md
index ae94ac9da..aba8edd38 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -90,8 +90,9 @@ The desktop app (`console/`) releases on its own tag, `switch-console-v<version>
`console/apps/switch-console-desktop/package.json` `version` (the workflow verifies
this and fails on mismatch). Procedure: bump `package.json`, cut the
`## switch-console` `CHANGELOG.md` section, merge to `main`, tag, push. The workflow
-publishes a **GitHub Release** (macOS arm64 signed + notarized; Linux x64
-AppImage/deb/rpm, unsigned).
+publishes a **GitHub Release** (macOS arm64 signed + notarized; Linux x64 and
+arm64 AppImage/deb/rpm, unsigned — one job per arch, each on a runner of that
+arch).
**Approval gate (required).** The `build-macos` job runs in the GitHub
`release` environment (required reviewers), which holds the Apple signing /
diff --git a/console/AGENTS.md b/console/AGENTS.md
index d0d295ba1..5cab70f0d 100644
--- a/console/AGENTS.md
+++ b/console/AGENTS.md
@@ -182,10 +182,26 @@ Package desktop artifacts locally:
```bash
pnpm run package
pnpm run package:mac
-pnpm run package:linux
+pnpm run package:linux # x64
+pnpm run package:linux:arm64
pnpm run package:win
```
+Two things these scripts do NOT do for you:
+
+- **Build the workspace packages.** They package the app only, so on a fresh
+ clone the renderer build fails with `Failed to resolve entry for package
+ "@switch-console/shared"` — its `exports` point at a `dist/` that no one has
+ written yet. Run `pnpm run build` from the repo root (or
+ `pnpm -r --filter './packages/**' run build`) first.
+- **Rebuild the native modules.** `npmRebuild` is off, so whatever
+ `pnpm --filter @switch-console/desktop run rebuild` last produced is what
+ gets copied into the package.
+
+The Linux scripts name an arch for that second reason: the natives are built for
+the host, so packaging the other arch yields a package that installs, launches,
+and dies on the first wrong-arch `.node`. Build each arch on that arch.
+
Run formatting, linting, type checks, and tests:
```bash
diff --git a/console/apps/switch-console-desktop/electron-builder.canary.config.ts b/console/apps/switch-console-desktop/electron-builder.canary.config.ts
index 3f3ff7966..b56547cb6 100644
--- a/console/apps/switch-console-desktop/electron-builder.canary.config.ts
+++ b/console/apps/switch-console-desktop/electron-builder.canary.config.ts
@@ -75,11 +75,9 @@ const config: Configuration = {
// without it.
maintainer: 'Louis Amaudruz <[email protected]>',
syncDesktopName: true,
- target: [
- { target: 'AppImage', arch: ['x64'] },
- { target: 'deb', arch: ['x64'] },
- { target: 'rpm', arch: ['x64'] },
- ],
+ // Arch comes from the CLI flag / host — see the base config for why naming
+ // both arches here produces a broken package.
+ target: ['AppImage', 'deb', 'rpm'],
},
deb: {
packageName: APP_NAME_LOWER,
diff --git a/console/apps/switch-console-desktop/electron-builder.config.ts b/console/apps/switch-console-desktop/electron-builder.config.ts
index 07c27e6fb..b78b07a07 100644
--- a/console/apps/switch-console-desktop/electron-builder.config.ts
+++ b/console/apps/switch-console-desktop/electron-builder.config.ts
@@ -127,11 +127,16 @@ const config: Configuration = {
// space-free name avoids that and matches `desktopName` above.
executableName: APP_NAME_LOWER,
syncDesktopName: true,
- target: [
- { target: 'AppImage', arch: ['x64'] },
- { target: 'deb', arch: ['x64'] },
- { target: 'rpm', arch: ['x64'] },
- ],
+ // No `arch` here on purpose: electron-builder then builds the HOST arch,
+ // or whichever `--x64` / `--arm64` the caller passes. Naming both arches
+ // in the target entries instead makes every invocation build both and
+ // ignore the flag — which is not merely slow. `npmRebuild: false` means
+ // the native modules (better-sqlite3, node-pty, @parcel/watcher) are
+ // whatever the earlier `pnpm rebuild` produced for the host, copied into
+ // every package unchanged, so the non-host arch comes out installable,
+ // launchable, and dead on the first require of a wrong-arch `.node`. The
+ // release workflow builds each arch on a runner of that arch.
+ target: ['AppImage', 'deb', 'rpm'],
},
// deb/rpm package names must be lowercase and space-free, so they are pinned
// rather than derived from the display name (same as the canary channel).
diff --git a/console/apps/switch-console-desktop/package.json b/console/apps/switch-console-desktop/package.json
index b2732019b..87ea2301f 100644
--- a/console/apps/switch-console-desktop/package.json
+++ b/console/apps/switch-console-desktop/package.json
@@ -36,7 +36,8 @@
"build:renderer": "electron-vite build --filter renderer",
"package": "pnpm run build && electron-builder --config electron-builder.config.ts",
"package:mac": "pnpm run build && electron-builder --mac --config electron-builder.config.ts",
- "package:linux": "pnpm run build && electron-builder --linux --publish never --config electron-builder.config.ts",
+ "package:linux": "pnpm run build && electron-builder --linux --x64 --publish never --config electron-builder.config.ts",
+ "package:linux:arm64": "pnpm run build && electron-builder --linux --arm64 --publish never --config electron-builder.config.ts",
"package:win": "pnpm run build && electron-builder --win --publish never --config electron-builder.config.ts",
"postinstall": "node --experimental-strip-types scripts/postinstall.ts",
"rebuild": "electron-rebuild -f -v 40.7.0 --only=better-sqlite3,node-pty",
diff --git a/console/docs/INSTALL.md b/console/docs/INSTALL.md
index 0454dbd35..d40a6d939 100644
--- a/console/docs/INSTALL.md
+++ b/console/docs/INSTALL.md
@@ -4,8 +4,8 @@ Switch Console is distributed as a desktop app through **GitHub Releases on this
repository** (`sandbox-quantum/switch`). The repo is public, so the downloads
need no account, token or sign-up. No need to build from source.
-> Builds are currently **macOS arm64** (Apple Silicon), **Linux x64** and
-> **Windows x64**. Windows builds are not code signed — see
+> Builds are currently **macOS arm64** (Apple Silicon), **Linux x64 and arm64**
+> and **Windows x64**. Windows builds are not code signed — see
> [Install (Windows x64)](#install-windows-x64).
## Download
@@ -52,27 +52,46 @@ gh release download switch-console-v<version> \
Tagged macOS releases are signed and notarized with SandboxAQ's Developer ID, so
they open without a Gatekeeper bypass.
-## Install (Linux x64)
+## Install (Linux)
-Linux builds are **unsigned**. Pick the format your distro uses:
+Linux builds are **unsigned**. First check which arch you are on — the assets
+carry it in the filename, and each packager reports it differently:
+
+```bash
+dpkg --print-architecture # amd64 | arm64
+```
+
+An asset for the wrong arch does not fail cleanly. `apt` reports every
+dependency as "not installable" (including core ones like `libuuid1`), which
+reads like a broken package list rather than an arch mismatch.
+
+Pick the format your distro uses:
- **AppImage** — no install step; make it executable and run it:
```bash
- chmod +x switch-console-x86_64.AppImage
+ chmod +x switch-console-x86_64.AppImage # arm64: switch-console-arm64.AppImage
./switch-console-x86_64.AppImage
```
+ On Ubuntu 22.04+ the AppImage needs FUSE 2 (`sudo apt install libfuse2`), and
+ on 24.04+ AppArmor's restriction on unprivileged user namespaces can break
+ Electron's sandbox. The `.deb` has neither problem — it installs
+ `chrome-sandbox` correctly — so prefer it on Ubuntu.
+
- **Debian / Ubuntu** (`.deb`):
```bash
- sudo apt install ./switch-console-amd64.deb
+ sudo apt install ./switch-console-amd64.deb # arm64: switch-console-arm64.deb
```
+ Use `apt install ./file.deb` rather than `dpkg -i`, so the Electron runtime
+ dependencies get resolved.
+
- **Fedora / RHEL** (`.rpm`):
```bash
- sudo dnf install ./switch-console-x86_64.rpm
+ sudo dnf install ./switch-console-x86_64.rpm # arm64: switch-console-aarch64.rpm
```
> The app does not yet set a `desktopName`, so desktop environments may not
@@ -126,6 +145,31 @@ You can always grab a newer build manually from the
[Releases page](https://github.com/sandbox-quantum/switch/releases) and
re-install (drag over the old app).
+## Building from source
+
+Only needed for a platform with no published artifact. Requires the Node version
+in `console/.nvmrc` and the pinned pnpm, plus `build-essential`, `python3` (for
+the native modules) and `rpm` if you want the `.rpm` target. Budget ~10 GB free
+disk: Electron's download plus the unpacked tree are several GB.
+
+```bash
+git clone https://github.com/sandbox-quantum/switch.git
+cd switch/console
+pnpm install
+pnpm run build # workspace packages, then the app
+pnpm --filter @switch-console/desktop run rebuild # native modules for THIS machine
+cd apps/switch-console-desktop
+pnpm run package:linux # or package:linux:arm64 / package:mac / package:win
+```
+
+The first two steps are not optional. Packaging from the app directory alone
+fails at the renderer with `Failed to resolve entry for package
+"@switch-console/shared"` — the workspace packages publish a `dist/` that has
+not been built yet. And because `npmRebuild` is off, skipping the rebuild ships
+whatever native binaries happen to be in `node_modules`.
+
+Artifacts land in `console/apps/switch-console-desktop/release/`.
+
## Notes
- Release **asset filenames are prefixed `switch-console-`** (e.g.
diff --git a/console/packages/plugins/src/agents/impl/codex/hooks.test.ts b/console/packages/plugins/src/agents/impl/codex/hooks.test.ts
index 5cb6bd5c6..404b09ac3 100644
--- a/console/packages/plugins/src/agents/impl/codex/hooks.test.ts
+++ b/console/packages/plugins/src/agents/impl/codex/hooks.test.ts
@@ -46,6 +46,16 @@ async function runHookCommand(
});
child.on('error', reject);
child.on('close', () => resolve());
+ // The stub `curl` need not read stdin, so the child can exit before this
+ // write lands and close the pipe under it. EPIPE then means "the child
+ // was already done with us", which is not a failure — the assertions run
+ // against the files it wrote. Any other stdin error still fails the test.
+ // `child.on('error')` does not cover the stdin stream, so without this
+ // the rejection is unhandled and Vitest fails the run after every test
+ // has passed.
+ child.stdin.on('error', (err: NodeJS.ErrnoException) => {
+ if (err.code !== 'EPIPE') reject(err);
+ });
child.stdin.end(stdin);
});