Skip to content

feat: desktop installer for GAIA Agent UI (#530) - #731

Merged
kovtcharov merged 69 commits into
mainfrom
kalin/desktop-installer
Apr 10, 2026
Merged

kovtcharov merged 69 commits into
mainfrom
kalin/desktop-installer

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #530.

Ships GAIA as a real desktop app with one-click installers — the primary install path for non-developer end users.

What users get

One-click install on every platform. Download gaia-agent-ui-*.exe (Windows), .dmg (macOS), .deb or .AppImage (Linux) from GitHub Releases. Double-click and you're done. No Python, no pip, no terminal.

Automatic backend setup on first launch. The app shows a progress dialog while it downloads uv, creates a Python venv, installs the GAIA backend, and starts Lemonade Server. About 5–10 minutes the first time, instant on every launch after. If anything fails, users see an error dialog with a Retry button, a "Manual install" link, and a log file path — no more dead-end "Install with: pip install amd-gaia".

Auto-updates in the background. GAIA checks GitHub Releases on launch and every few hours. When a new version is available, users see a "Restart to update" prompt — same flow as Slack, VS Code, etc. No manual reinstalls.

Native uninstall. Add or Remove Programs / drag to Trash / apt remove all work as expected. User data in ~/.gaia/ is preserved unless explicitly purged. A gaia uninstall CLI offers tiered cleanup (--venv, --purge, --purge-lemonade, --purge-models, --purge-hf-cache, --dry-run) for power users.

Windows autostart by default. GAIA starts in the system tray when you sign in to Windows, matching the Slack/Discord/Zoom convention. Disable via Task Manager → Startup or the in-app tray menu.

Trusted installers (when secrets land). Code-signing scaffolding is in place for SignPath (Windows) and Apple Developer ID + notarization (macOS). Activates with zero code changes once #732 and #733 unblock — no more SmartScreen / Gatekeeper warnings.

Naming

Display name is GAIA (dock, Start Menu, title bar, tray). Electron binary is gaia-desktop (avoids collision with the Python CLI gaia). Download artifacts use gaia-agent-ui-* for URL stability.

Verification

  • Windows NSIS installer tested end-to-end on real hardware: install → first-launch bootstrap (uv + venv + pip + gaia init + Lemonade) → chat UI loads → functional
  • Local macOS DMG verified: mounted, code-signed, entitlements confirmed, first-launch bootstrap completes
  • Cross-platform CI green on Windows + macOS + Linux via the new build-installers.yml workflow (51/51 checks passing)
  • 3 automated code review passes: 19 issues found and fixed (name collisions, stale refs, orphaned registry keys, missing require, cwd bug, frontend loading bug, API_BASE file:// fix, doc sync)
  • 42 unit tests for gaia uninstall (containment guard, log handler cleanup, silent-purge refusal, Lemonade python resolution, exit codes, GAIA_HOME env var)

Test plan

Follow-ups

kovtcharov and others added 30 commits April 9, 2026 16:12
Comprehensive plan for the GAIA Agent UI desktop installer — the
primary install path for non-developer end users. Ground-up
implementation using Lemonade Server's installer as a reference
architecture (not vendored).

Key decisions:
- Distribute via GitHub Releases initially (R2 deferred)
- NSIS on Windows, DMG on macOS, DEB + AppImage on Linux
- Remove the existing Squirrel installer entirely (no migration —
  v0.17.1 users uninstall manually via release-notes step)
- Reuse `bin/gaia-ui.mjs` install logic via a shared
  `services/backend-installer.cjs` module — both the npm CLI and
  the Electron app call it (eliminates the broken Squirrel UX)
- Auto-update via electron-updater + GitHub provider
- `gaia uninstall` CLI as the unifying piece for all four platforms
- Drag-to-trash for macOS uninstall (DMG convention)
- Documentation as a first-class deliverable (Phase I)
- Code signing via SignPath OSS (Windows) + Apple Developer ID (macOS)

Plan is structured as 9 phases (A–I) with explicit dependency
ordering. Phase A is independently mergeable and ships first.

Refs: #530
Related: #341 (folded into Phase B), #597 (left as polish)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add top-level installer/ directory with placeholder subdirs for
scripts/, version/, nsis/, debian/, macos/, and linux/. Phase B of
the desktop installer plan (docs/plans/desktop-installer.mdx §7).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move build-ui-installer, install, start-agent-ui, and start-lemonade
scripts from scripts/ into installer/scripts/. Update in-file usage
comments to reflect the new paths.

Part of Phase B of the desktop installer plan
(docs/plans/desktop-installer.mdx §7).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move bump-ui-version.mjs and release-ui.mjs from scripts/ into
installer/version/. Fix rootDir resolution (now two levels up
instead of one) and update usage comments to reflect new paths.

Part of Phase B of the desktop installer plan
(docs/plans/desktop-installer.mdx §7).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Update all remaining references to scripts/ that were moved in the
previous commits:

- .github/workflows/{publish,test_lemonade_server,build_cpp}.yml
- docs/{reference/dev, guides/mcp/agent-ui, sdk/sdks/agent-ui,
  plans/installer}.mdx
- cpp/src/lemonade_client.cpp (user-facing error message)

docs/plans/desktop-installer.mdx is intentionally left alone --
its references to the old paths are historical and describe the
move being performed here.

Part of Phase B of the desktop installer plan.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The file began with a UTF-8 BOM (EF BB BF), which causes PowerShell to
fail with: "The term '#' is not recognized as the name of a cmdlet".
Removing the BOM so the script runs cleanly when piped through iex.

Folds in the first of three fixes from the stale PR #341.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…llback (#341)

GaiaLogger used to default to a relative "gaia.log" in the current
working directory, which had two problems:

1. It littered CWD with log files on every invocation.
2. It crashed with PermissionError when GAIA was invoked from a
   read-only or system directory (e.g. `cd / && gaia ...`), which
   broke the Windows PowerShell one-liner installer from PR #341
   whenever it ran in restricted shells.

Fix:

- Default log_file is now ~/.gaia/gaia.log (created on demand).
- File-handler creation is wrapped in try/except for both
  PermissionError and OSError.
- On failure we try ~/.gaia/gaia.log, then tempfile.gettempdir()
  /gaia.log, then fall back to console-only logging with a friendly
  warning on stderr instead of crashing.

Folds in the logger portion of the stale PR #341.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Document the new installer/ tree -- layout, how to build the Agent UI
installer locally, version helpers, and placeholders that later phases
(C and E) will populate. References the desktop installer plan and
credits Lemonade Server as the architectural inspiration.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Extract the first-run backend bootstrap (uv install, venv create,
amd-gaia[ui] install, gaia init) from bin/gaia-ui.mjs into a pure
CommonJS module at services/backend-installer.cjs so both the npm CLI
and the Electron main process can share a single install path.

The module adds:
- State machine (idle/installing/failed/partial/ready) persisted to
  ~/.gaia/electron-install-state.json
- Pre-flight checks: disk space (3 GB), network reachability
- Logging to ~/.gaia/electron-install.log with per-attempt truncation
- Per-stage progress callbacks (pre-checks → uv → venv → install → init
  → verify) with weighted overall 0-100 percentage
- Structured InstallError class with stage/suggestion fields
- Partial-install detection (per plan §10.4, restart from scratch)

Phase A of the desktop installer plan (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
New services/backend-installer-progress-dialog.cjs owns all the
Electron-specific UI for the first-run bootstrap:

- Borderless BrowserWindow with embedded HTML that listens for
  install:progress IPC events, showing stage / percent / message
- Failure dialog with Retry / Manual install instructions / Copy log
  path / Open log file / Quit buttons
- Retains the shared install module as pure Node — no Electron imports
  leak into backend-installer.cjs
- Registers ipcMain handlers for install:status, install:copy-log-path,
  and install:open-log-file (idempotent so createProgressWindow can run
  multiple times during retries)
- Buffers progress events sent before did-finish-load so early updates
  aren't lost when the renderer attaches its listener

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Per desktop installer plan §3.1, the npm CLI entry point and the
Electron main process both need to share install logic, but main.cjs
is CommonJS and .mjs is ESM. Rename the bin script to .cjs so it can
require() the shared backend-installer module directly, eliminating
duplicated install logic between the two entry points.

- bin/gaia-ui.cjs now delegates all install logic to
  services/backend-installer.cjs (ensureBackend with onProgress
  streaming to stdout)
- All logs go to ~/.gaia/electron-install.log — same file the Electron
  app writes, so manual/npm installs share a unified log
- package.json bin map updated: "gaia-ui": "bin/gaia-ui.cjs"
- The file extension change is invisible to users since the bin entry
  is the only public reference to the script

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Phase A of the desktop installer plan fixes the broken Squirrel
first-launch UX. Previously main.cjs's findGaiaCommand() printed
'Install with: pip install amd-gaia' and gave up if gaia wasn't on
PATH — leaving non-developer users stranded.

Changes:
- main.cjs: remove dead-end findGaiaCommand/warning path; add
  bootstrapBackend() that runs BEFORE the main window is created.
  Shows a borderless progress dialog while ensureBackend runs; on
  failure, surfaces the Retry / Manual / Quit dialog in a loop.
  Fast-path skips the dialog entirely when the binary is present
  and the version matches.
- main.cjs: startBackend now uses backendInstaller.findGaiaBin()
  so it always picks the managed venv gaia first.
- preload.cjs: expose window.gaiaInstall with onProgress event
  subscription and status/copyLogPath/openLogFile helpers via
  contextBridge. Mirrors the install:* IPC channels the dialog
  module registers with ipcMain.

With this change, a fresh Squirrel install followed by a
double-click of the shortcut will trigger the full backend
install with visible progress — no terminal required.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Implements the unified uninstall command specified in the desktop
installer plan (docs/plans/desktop-installer.mdx §5.2). Every desktop
installer platform (NSIS, DMG, DEB, AppImage) will delegate its
Python-side cleanup to this single implementation.

Tiers:
  * default (no flags)  — print friendly help, touch nothing
  * --venv              — remove ~/.gaia/venv/
  * --purge             — remove venv + chat + documents + electron
                          config + install logs (keeps ~/.gaia/ itself)
  * --purge-lemonade    — best-effort Lemonade Server removal (with --purge)
  * --purge-models      — remove ~/.cache/lemonade/models/ (with --purge)
  * --dry-run           — preview every path, touch nothing
  * --yes               — skip the confirmation prompt; also auto-skipped
                          when stdin is not a TTY (silent NSIS uninstall
                          and Debian postrm flows work without the flag)

Replaces the previous inline uninstall handling in cli.py with a
single call to `gaia.installer.uninstall_command.run()`. Adds pyfakefs
to the [dev] extras for unit-testing the filesystem operations.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Covers 25 scenarios across 8 classes:
  * TestBuildPlan (4)          — plan construction for every flag combo
  * TestDryRun (3)             — dry-run lists right paths, touches nothing
  * TestVenvRemoval (1)        — --venv removes venv only
  * TestPurgeRemoval (2)       — --purge removes tier 3, keeps ~/.gaia, skips Lemonade
  * TestPurgeModels (1)        — --purge --purge-models removes models/ only
  * TestValidationErrors (2)   — --purge-{lemonade,models} error without --purge
  * TestNoFlagsHelp (2)        — friendly help in TTY and non-TTY modes
  * TestErrorHandling (3)      — PermissionError → exit 2, missing paths = no-op
  * TestConfirmationPrompt (3) — decline → exit 1, accept → removes,
                                 non-TTY auto-skips prompt (NSIS silent path)
  * TestCrossPlatform (4)      — POSIX paths + Windows LOCALAPPDATA handling

All tests use pyfakefs so they run on any host without touching real
user data.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Moves the previously-listed "future command" up to a new "Additional
Commands" section with status "Implemented". Documents the full flag
set (matching §5.2 of desktop-installer.mdx), the confirmation-prompt
auto-skip behavior used by silent NSIS / Debian postrm uninstall flows,
and the exit-code contract. Keeps `gaia doctor` listed as future.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Phase D promoted `gaia uninstall` to the "Implemented" section but
left a duplicate stub in the "Future Commands" list. Remove the stub
and add a cross-reference to the implemented section instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
First commit of Phase C. Removes the electron-forge maker chain
(@electron-forge/cli, maker-deb, maker-squirrel) and the
electron-squirrel-startup runtime dependency. Deletes
forge.config.cjs and its package.json config pointer. Clears the
now-dead \`package\` and \`make\` scripts; they'll be re-added to
call electron-builder in the next commit.

This leaves the Electron app temporarily unpackageable between
this commit and the next — intentional so the swap is split into
clearly reviewable steps.

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Adds electron-builder ^26.8.1 (devDependency — build-time only) and
electron-updater ^6.8.3 (runtime dependency — Phase F will require() it
from main.cjs). Wires up the four electron-builder scripts that Phase C
will use to drive builds:

    package         — default target for the host platform
    package:win     — Windows NSIS .exe
    package:mac     — macOS DMG
    package:linux   — Linux DEB + AppImage

Deviation from the Phase C brief: electron-updater is committed as a
runtime dependency, not a devDependency. The brief said devDependency
but Phase F needs to require() it from main.cjs at runtime, which only
works if it ships in the packaged app's node_modules — i.e. it has to
be in "dependencies". Plan §8 lists it under "Added dependencies"
without the dev qualifier, consistent with this.

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…Image)

New electron-builder.yml at src/gaia/apps/webui/electron-builder.yml
replaces the retired forge.config.cjs. Produces four installer targets:

    Windows x64  → NSIS .exe (wizard, Start Menu + Desktop shortcuts,
                   custom installer.nsh with autostart checkbox)
    macOS arm64  → DMG (drag-to-/Applications, custom layout)
    Linux x64    → DEB (depends list, fpm hooks)
                 → AppImage (portable single-file)

Key design choices:

  * YAML config rather than inlined package.json "build" block —
    cleaner for 150+ lines.
  * buildResources points at ../../../../installer (the repo root's
    installer/ tree populated by Phase B and this phase). All other
    asset paths are expressed relative to the webui package dir.
  * publish is pre-wired for github (owner: amd, repo: gaia) so
    Phase F's electron-updater swap is a require() + config line,
    nothing else.
  * forceCodeSigning: false and notarize: false so local unsigned
    builds work end-to-end; Phase H flips the switches via env vars.
  * afterPack hook points at installer/scripts/after-pack.cjs (added
    in the next commit).
  * NSIS: oneClick=false (visible wizard), perMachine=false (no UAC
    required), deleteAppDataOnUninstall=false (per plan §5 — keep
    user data by default).
  * DMG layout: 660×400 window, icon at (130,220), Applications
    alias at (410,220) — matches the old forge behavior with the
    added drag-to-Applications affordance.

Also adds dist-app/ to src/gaia/apps/webui/.gitignore so the
electron-builder output directory doesn't accidentally get committed.

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Ports the Chromium locale-pruning logic from the retired
forge.config.cjs \`postPackage\` hook to
installer/scripts/after-pack.cjs so electron-builder invokes it
automatically via the \`afterPack\` field in electron-builder.yml.

Chromium ships ~50 locale .pak files that add ~45 MB to the install
size. GAIA is English-only so we strip everything except en-US.
Verified on a local macOS build: the hook pruned 273 locale entries
and saved 44.7 MB (vs. ~45 MB before, so parity with forge).

The new implementation handles both layouts electron-builder produces:

  * Windows/Linux: \`<appOutDir>/locales/<lang>.pak\`
  * macOS: nested \`<Framework>.framework/Versions/A/Resources/<lang>.lproj/\`

and walks \`context.appOutDir\` recursively rather than hard-coding a
path, so the hook stays portable if electron-builder changes its
packaging layout in a future release.

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…alize.mjs

Ports \`toSemVer()\` from the retired forge.config.cjs into a
standalone ES module at installer/version/normalize.mjs.

GAIA uses 4-part internal versions (e.g. 0.15.4.1) for hotfix
releases, but SemVer — which NSIS, MSI, Apple bundle version, and
Debian metadata all require — only accepts 3 parts. The normalizer
collapses the last two parts so ordering is preserved:

    "1.2.3"     -> "1.2.3"    (pass-through)
    "0.15.4.1"  -> "0.15.41"  (hotfix)
    "0.15.4.10" -> "0.15.410" (double-digit hotfix)

Exposed as:
  * A library export (\`import { toSemVer } from './normalize.mjs'\`)
    for use by any future release tooling.
  * A CLI entry point for shell scripts and CI workflows:
    \`node installer/version/normalize.mjs 0.15.4.1\` -> \`0.15.41\`.

Design note: electron-builder doesn't yet need the normalized
version because package.json is currently at 0.17.1 (3-part). Once
a 4-part release ships, bump-ui-version.mjs can pipe through
normalize.mjs before writing package.json — one-liner change and
no build-pipeline rework.

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Adds installer/nsis/installer.nsh, referenced from the
electron-builder.yml \`nsis.include\` field. The file hooks into
electron-builder's generated NSIS script to:

  * Add a "Start GAIA Agent UI when I sign in to Windows" checkbox
    to the finish page, default ON (matches Slack/Discord/Zoom
    convention per plan §4.1).
  * Write HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
    pointing at the installed .exe with the \`--minimized\` flag
    so the app starts into the tray (handled by
    services/tray-manager.cjs).
  * Remove the HKCU Run value on uninstall via the
    \`customUnInstall\` macro so clean uninstall actually undoes
    the autostart.

Uses electron-builder's MUI_FINISHPAGE_SHOWREADME_* and
customUnInstall extension points, which are processed at the top of
the generated .nsi before MUI_PAGE_FINISH is emitted — so the
!defines here take effect in the right place.

Phase E may replace the sidebar/header BMPs referenced elsewhere
in electron-builder.yml but should not need to touch this file.
Phase H will extend it with SignPath integration.

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Commits minimal placeholder assets so electron-builder can build
installer artifacts end-to-end before Phase E designs and ships the
final branded assets. Without these, local unsigned builds fail
with "missing icon" / "missing entitlements" errors even though the
electron-builder config is otherwise correct.

Files committed:

  installer/nsis/icon.ico               — copied from the existing
                                          webui tray icon
                                          (src/gaia/apps/webui/assets/icon.ico)
  installer/nsis/installer-sidebar.bmp  — 164×314 uncompressed 24bpp
                                          BMP, solid dark blue fill
  installer/macos/icon.icns             — multi-resolution .icns
                                          generated via \`iconutil\`
                                          (16/32/64/128/256/512/1024)
  installer/macos/entitlements.mac.plist — explicit hardened-runtime
                                          entitlements per plan §7
                                          Phase E (the five keys that
                                          let a notarized app spawn
                                          child processes)
  installer/macos/dmg-background.png    — 660×400 PNG, solid dark blue
  installer/linux/gaia-ui.png           — 512×512 PNG, solid dark blue
  installer/debian/{postinst,prerm,postrm} — \`#!/bin/sh\` + \`exit 0\`
                                             stubs so fpm has scripts
                                             to reference

Each file opens with a header comment explaining that it's a Phase C
placeholder and that Phase E is expected to replace it. The dimensions
and formats are the ones that electron-builder and NSIS require, so
Phase E only needs to swap pixel content without touching any config.

Local \`npm run package:mac\` tested successfully and produces a
~110 MB DMG with the after-pack locale pruning (44.7 MB saved).

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…n.cjs

Final Phase C change. Removes the lingering electron-squirrel-startup
require block from src/gaia/apps/webui/main.cjs:

    try {
      if (require("electron-squirrel-startup")) {
        app.quit();
      }
    } catch {
      // electron-squirrel-startup not available
    }

Squirrel was electron-forge's Windows maker and required a runtime
helper to handle its first-run shortcut creation by re-launching the
app with CLI flags. electron-builder's NSIS target creates shortcuts
at install time instead, so this code path is dead. The dependency
itself was already removed from package.json in the first Phase C
commit, so the require() would error on a clean install — the
try/catch hid that but produced confusing warnings.

Verified locally:
  node --check src/gaia/apps/webui/main.cjs  (passes)
  npm run package:mac                         (produces a valid .dmg
                                              that launches cleanly;
                                              no missing-module error)

Part of desktop-installer plan Phase C (docs/plans/desktop-installer.mdx).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace Phase C's single-size placeholder (a direct copy of the
source 256x256 PNG wrapped in an .ico container) with a proper
multi-size Windows icon containing 16/32/48/256 entries, generated
from src/gaia/apps/webui/assets/icon.png via Pillow. This gives the
Windows installer and the system tray crisp renders at all DPI levels.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace Phase C's solid-color 164x314 placeholder with a real NSIS
sidebar: the GAIA robot icon composited onto a #1a1a2e background
with "GAIA" / "Agent UI" wordmark, saved as Windows 3.x 24-bit BMP
(the format NSIS requires). Generated via Pillow from the existing
src/gaia/apps/webui/assets/icon.png source of truth — no new
visual identity invented.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Per user directive: "no spaces in binaries, all lowercase". Splits the
user-facing display name from the actual binary / artifact name so users
on every platform get terminal-friendly executables and installers
without losing the branded display name.

Naming model:

  productName    = "GAIA Agent UI"   (display: titlebar, dock, menu, etc.)
  executableName = gaia-agent-ui     (binary name on disk on all platforms)
  artifactName   = gaia-agent-ui-${version}-${arch}.${ext}

Concrete results:

  macOS:    /Applications/gaia-agent-ui.app/Contents/MacOS/gaia-agent-ui
            dist-app/gaia-agent-ui-0.17.1-arm64.dmg            (109 MB)
  Windows:  C:\...\gaia-agent-ui\gaia-agent-ui.exe
            dist-app/gaia-agent-ui-0.17.1-x64-setup.exe
  Linux:    /usr/bin/gaia-agent-ui
            dist-app/gaia-agent-ui-0.17.1-amd64.deb
            dist-app/gaia-agent-ui-0.17.1-x86_64.AppImage

  StartupWMClass: gaia-agent-ui                (matches Electron WM_CLASS)
  Linux icon:     installer/linux/gaia-agent-ui.png  (renamed from gaia-ui.png)

Trade-off acknowledged: macOS app bundle name is gaia-agent-ui.app
rather than "GAIA Agent UI.app", so Mac users see the lowercase form in
their Applications folder. The titlebar, dock, and menu bar still show
"GAIA Agent UI" because productName drives those. This matches the
user's explicit "all lowercase" directive and is consistent with how
Slack, Discord, and other Electron apps name their Linux/Windows
binaries.

Note: the npm CLI launcher (bin/gaia-ui.cjs → command `gaia-ui`) is
intentionally NOT renamed. It's a different thing — the npm-installed
launcher script that bootstraps uv + venv + Electron. Renaming it would
break npm users with no benefit. Two distinct commands now exist:

  gaia-ui         (npm CLI launcher; installs/updates the backend)
  gaia-agent-ui   (the Electron desktop app binary)

Files touched:

  electron-builder.yml         — executableName, all artifactNames, icon path
  installer/linux/             — renamed gaia-ui.png → gaia-agent-ui.png
  installer/debian/prerm       — pkill matches gaia-agent-ui (not "GAIA Agent UI")
  installer/debian/postinst    — comment update
  docs/guides/install.mdx       — download filenames in all 4 platform tabs
  docs/reference/install-troubleshooting.mdx  — proxy command examples
  docs/deployment/code-signing.mdx  — signtool / spctl verify examples
  docs/plans/desktop-installer.mdx  — apt remove pkg name, autostart paths
  .github/workflows/publish.yml  — release notes section + stale .mjs check fix

Drive-by fix: publish.yml's CLI entry point check was looking for the
old bin/gaia-ui.mjs path which Phase A renamed to .cjs. The check would
have failed on every release since Phase A merged.

Verified locally: npm run package:mac built gaia-agent-ui-0.17.1-arm64.dmg
and the .app bundle's binary is the lowercase gaia-agent-ui.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@kovtcharov kovtcharov self-assigned this Apr 10, 2026
@kovtcharov
kovtcharov requested a review from itomek-amd April 10, 2026 01:38
@kovtcharov
kovtcharov marked this pull request as ready for review April 10, 2026 02:46
kovtcharov and others added 8 commits April 9, 2026 21:06
Electron runtime hardening (main.cjs, backend-installer.cjs):
- Add requestSingleInstanceLock() to prevent double-launch races on
  the backend installer, port 4200, IPC handler registration, and
  auto-updater singleton.
- Pin uv to 0.11.6 and verify the downloaded asset against a SHA256
  map per rust-target, replacing the unversioned astral.sh install
  script pipe.
- Bump first-launch disk preflight from 3 GB to 5 GB to accommodate
  current PyTorch wheel sizes.
- Probe multiple hosts (pypi.org, astral.sh) for the network check
  so a single DNS hiccup doesn't fail pre-flight.
- Rotate electron-install.log only on the first ensureBackend call
  of a session; subsequent retries append so the original failure
  log stays intact for bug reports.

CI workflow hardening (build-installers.yml):
- Drop workflow-level contents:write; grant it only to the new
  publish-release-assets job, which is gated on non-PR events.
- Declare the SignPath/Apple secret surface explicitly under
  workflow_call so callers must forward each one (no secrets:
  inherit leakage from forks).
- Enable cancel-in-progress for pull_request runs only; tag and
  manual runs still run to completion.
- Move the SignPath signing step after the workflow-run artifact
  upload so steps.upload-artifacts.outputs.artifact-id is
  populated when SignPath reads it.

Docs (guides/install.mdx):
- Rewrite the Uninstalling section around the tiered
  `gaia uninstall` CLI flags.
- Update gaia-ui -> gaia-agent-ui in apt and path examples to
  match the 2a6311a rename.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Phase D safety hardening — defense-in-depth for the tiered
`gaia uninstall` CLI so a bug or misuse can't escalate to arbitrary
data loss:

- Containment guard on `_remove_path`: resolves every candidate path
  and refuses to delete anything outside `~/.gaia/`, the Lemonade
  models cache, or the HuggingFace cache. Raises RuntimeError rather
  than silently escaping. New `_safe_roots()` helper defines the
  permitted roots.

- Windows data-loss guard: new `_close_gaia_log_handlers()` detaches
  any logging.FileHandler whose target lives inside `~/.gaia` before
  Tier 3 purge. Fixes a Windows-only bug where shutil.rmtree raised
  PermissionError mid-delete because gaia.log was held open, leaving
  the uninstall in a partial state.

- Silent-purge refusal: `run()` now refuses `--purge` without `--yes`
  on non-TTY stdin. Tier 2 (`--venv`) still auto-skips confirmation
  so silent NSIS/Debian postrm flows work; only Tier 3 is guarded.
  Dry-run remains exempt since it touches nothing.

- Lemonade python resolution: when invoked from the GAIA installer
  bundle, `sys.executable` is the GAIA venv — NOT where Lemonade
  lives — so `pip uninstall lemonade-sdk` against it was always a
  no-op. New `_resolve_lemonade_python()` parses the `lemonade-server`
  script's shebang on POSIX and walks `Scripts/` on Windows to find
  the real interpreter.

- New `EXIT_USAGE = 64` (BSD EX_USAGE) distinguishes bad-flag
  misuse from real I/O failures. Flag-validation errors now return
  64 instead of EXIT_FS_ERROR (2), so NSIS / postrm hooks don't
  trigger reinstall retries on misuse.

- `$GAIA_HOME` env var override in `_gaia_home()` for multi-user
  and alternate-data-root installs.

Test coverage (42 passed, was 23):
- Fix 2 pre-existing validation tests for the new EXIT_USAGE code.
- New TestContainmentGuard (4 tests) — escape refusal, traversal
  refusal, allowed delete, safe roots shape.
- New TestSilentPurgeRefusal (4 tests) — purge without --yes on
  non-TTY refuses, purge with --yes proceeds, dry-run still allowed,
  Tier 2 silent flow still works (regression guard).
- New TestGaiaHomeEnvVar (2 tests) — env var override and fallback.
- New TestLogHandlerCleanup (2 tests) — closes handler inside
  ~/.gaia, leaves external handlers alone.
- New TestLemonadePythonResolution (4 tests) — direct shebang,
  env shebang, not on PATH, missing shebang.
- New `test_purge_hf_cache_without_purge_errors` closes the
  pre-existing coverage gap on the third validation error path.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Rename + branding:
- productName "GAIA Agent UI" → "GAIA", executableName → "gaia"
  so the .app, dock, Start Menu, and title bar all show "GAIA".
- Regenerate all platform icons using the robot HEAD crop (the
  full-body robot was too small at icon sizes) on a #1a1a28
  bg-tertiary background so the circular art pops on both light
  and dark desktops.
- New macOS DMG background: soft-glow drop targets aligned to
  electron-builder coordinates, no arrow, subtle grain, matches
  the Agent UI dark theme palette. Deterministic generator script
  at installer/macos/generate-dmg-background.py.
- New Windows NSIS sidebar: matching palette, robot head with
  radial glow, AMD red accent. Generator script at
  installer/nsis/generate-installer-sidebar.py.

Bug fixes:
- Fix ReferenceError: NETWORK_CHECK_URL → iterate the new
  NETWORK_CHECK_HOSTS array; only fail if ALL hosts unreachable.
- Fix ReferenceError: os is not defined in main.cjs (missing
  require("os") after cwd: os.homedir() was added).
- Fix OSError: Read-only file system '/gaia.log' — Electron's cwd
  is "/" when launched from Finder; set cwd: os.homedir() on all
  child process spawns (runCommand in backend-installer.cjs and
  startBackend in main.cjs).
- Fix frontend showing raw JSON instead of the chat UI — remove
  the mainWindow.loadURL(http://localhost:4200/) reload that
  replaced the bundled React app with the backend's API root
  response (the pip package has no frontend files). The bundled
  frontend now always loads from the asar.
- Fix file:// API calls — API_BASE now resolves to
  http://localhost:4200/api when the page protocol is file://
  (Electron), and to /api when served over http:// (dev/browser).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…haned keys

Fixes 5 issues found during deep code review:

1. executableName: gaia → gaia-desktop to avoid collision with the
   Python CLI `gaia` binary (setup.py console_scripts). On Linux,
   /usr/bin/gaia (Electron) + findGaiaBin()'s commandExists("gaia")
   fallback could recursively launch the Electron app instead of
   the Python backend. gaia-desktop is unambiguous.

2. Remove misleading UV_PINNED_VERSION / UV_ASSET_SHA256 constants
   that claimed SHA256 verification was happening but were never
   called by ensureUv(). Replace with a TODO comment. The actual
   pinned-download implementation is a follow-up.

3. Linux prerm: pkill target updated from "gaia-agent-ui" to
   "gaia-desktop" (matching new executableName). Also kills the
   old "gaia-agent-ui" name for upgrade-from-old-install safety.

4. Linux StartupWMClass: gaia-agent-ui → gaia-desktop so the
   .desktop entry matches the Electron process's X11 WM_CLASS
   and taskbar icon grouping works correctly.

5. NSIS customInstall: delete the old "GAIA Agent UI" autostart
   Run key before writing the new "GAIA" key, so users upgrading
   from the old product name don't end up with an orphaned
   registry entry pointing at a dead binary path.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Naming consistency — "GAIA Agent UI" → "GAIA" everywhere:
- main.cjs APP_NAME
- install.mdx (guide), install-troubleshooting.mdx, faq.mdx
- electron-builder.yml Linux .desktop entry Name
- electron-builder.yml stale comments referencing old names

Doc fixes:
- cli.mdx: rewrite `gaia uninstall` section for the new tiered
  flag set (--venv, --purge, --purge-lemonade, --purge-models,
  --purge-hf-cache, --dry-run). The old --lemonade and --models
  flags were removed in Phase D but the docs still referenced them.
- cli.py: fix stale `gaia uninstall --lemonade` hint in the
  install command handler → `gaia uninstall --purge --purge-lemonade`
- faq.mdx: fix wrong deb package name `gaia-ui` → `gaia-desktop`
- install-troubleshooting.mdx: fix disk space 3 GB → 5 GB to
  match MIN_DISK_SPACE_BYTES, fix binary paths to gaia-desktop,
  fix xattr path to GAIA.app
- install.mdx: fix terminal launch command to gaia-desktop, fix
  apt remove/purge package name, fix Electron app install path

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ass 3

- install-troubleshooting.mdx: fix macOS quarantine xattr command
  from GAIA\ Agent\ UI.app → GAIA.app (the escaped-space variant
  was missed by the previous bulk replace)
- electron-builder.yml: update two comments still referencing
  "GAIA Agent UI" as the productName

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Aligns in-app UI text with the new productName "GAIA" set in
electron-builder.yml. Previously the OS surfaces (dock, Start Menu,
title bar) said "GAIA" while the web UI content said "GAIA Agent UI".

Updated:
- index.html <title>
- WelcomeScreen title text
- ConnectionBanner + ChatView error messages
- SettingsModal version display
- tray-manager tooltip
- auto-updater download notification
- logger console banner

Also: Black-format test_uninstall_command.py (CI was failing on this).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The C++ Windows benchmark was failing against a stale baseline
cached from March 30. The baseline cache was deleted and a fresh
dispatch run established new measurements. This empty commit
triggers a pull_request run so the PR checks pick up the new
baseline.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add a Yes/No MessageBox to the NSIS customUnInstall macro that offers
to remove ~/.gaia/ (chats, documents, Python venv, config, logs)
during uninstall. Default is No so users keep their data unless they
explicitly opt in. Silent uninstalls (/SD IDNO) also default to
keeping data.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@kovtcharov
kovtcharov force-pushed the kalin/desktop-installer branch from 07b6153 to 513f0b5 Compare April 10, 2026 17:39
@kovtcharov
kovtcharov added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit f5b0d39 Apr 10, 2026
53 checks passed
@kovtcharov
kovtcharov deleted the kalin/desktop-installer branch April 10, 2026 19:02
github-merge-queue Bot pushed a commit that referenced this pull request Apr 10, 2026
)

Fixes two critical bugs found during end-to-end install testing on
Ubuntu 24.04 (amd64), testing against PR #731.

## Bug 1: chrome-sandbox missing SUID bit

**Symptom:** App crashes immediately after `apt install` with:
```
FATAL: The SUID sandbox helper binary was found, but is not configured correctly.
Rather than run without sandboxing I'm aborting now. You need to make sure that
/opt/GAIA/chrome-sandbox is owned by root and has mode 4755.
```

**Root cause:** `electron-builder` packages `chrome-sandbox` with mode
`755`. Chromium's sandbox helper requires `4755` (setuid root) to
function. Without it, no user can launch the app after a clean install.

**Fix:** `installer/debian/postinst` now sets `chown root:root` + `chmod
4755` on `/opt/GAIA/chrome-sandbox` during package configuration, which
runs as root via `apt`.

## Bug 2: Model download silently skipped — app crashes when user types

**Symptom:** Bootstrap completes and reports `ready`, but Qwen3-0.6B is
never downloaded. Lemonade has no model loaded, so the app crashes when
the user sends their first message.

**Root cause:** `backend-installer.cjs` runs `gaia init --profile
minimal` with piped stdio (for log streaming). With no TTY attached,
`gaia init`'s interactive prompts ("Continue? [Y/n]:" and "Run model
verification? [Y/n]:") receive EOF and answer themselves as "Skipping".
The non-zero-ish exit is treated as non-fatal, so state reaches `ready`
despite no model existing.

**Fix:** Pass `--yes` to `gaia init` so prompts are auto-answered. The
flag already exists for this purpose.

## Testing

Both bugs reproduced on Ubuntu 24.04.4 LTS (x86_64, kernel 6.17) with
the `.deb` from CI run
[24255947495](https://github.com/amd/gaia/actions/runs/24255947495).
Verified manually:
- Before fix: immediate crash on launch (Bug 1), silent model skip +
crash on chat (Bug 2)
- After applying patches locally: app launches, bootstrap downloads
model, chat works

Closes part of #530.
@itomek itomek mentioned this pull request Apr 10, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Apr 10, 2026
Release notes for v0.17.2. See
[docs/releases/v0.17.2.mdx](https://github.com/amd/gaia/blob/v0.17.2-release/docs/releases/v0.17.2.mdx)
for the full body.

**Headline features:**
- One-click desktop installers for Windows, macOS, and Linux (#731 +
#743)
- Customizable agents and Builder Agent (#720)
- MCP tool execution visibility in Agent Activity panel (#717)

**Security:** RAG cache integrity verification (#722, closes #447)

**Bug fixes:** drag-and-drop upload in any browser (#729), Linux install
fixes (#743)

**Release & CI:** unified publish workflow (#715), Claude review on fork
PRs (#685), npm OIDC fix (#683), webui package.json sync (#682)

Full changelog: v0.17.1...v0.17.2

---------

Co-authored-by: Tomasz Iniewicz <[email protected]>
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Jun 1, 2026
…r/ (amd#1326)

## Summary
Fix repo-root resolution in the two PowerShell scripts under
`installer/scripts/` - both climbed one parent directory too few after
the R097 rename in amd#731, causing downstream paths (`$WebUIDir`,
`$WEBUI_DIR`) to point one level short at `installer/src/...` instead of
the real `<repo>/src/...`.

## Why
On a fresh Windows checkout:
- `start-agent-ui.ps1 -FrontendOnly` invokes `npm install` / `npm run
dev` against the non-existent `installer\src\gaia\apps\webui` instead of
`src\gaia\apps\webui`.
- `build-ui-installer.ps1` runs its `npm ci`, `npm run build`,
`electron-forge package`/`make` against the same wrong tree, silently
producing a broken installer or failing prerequisite checks at lines 77,
97, 106-108, 132, 149, 158, 166.

Both files live at `installer/scripts/`, so the correct traversal is
`$PSScriptRoot\..\..` (two levels up -> repo root), not
`$PSScriptRoot\..` (one level -> `installer/`).

**Scope note:** The bash counterparts (`start-agent-ui.sh`,
`build-ui-installer.sh`) have the identical off-by-one bug on
Linux/macOS. They are deliberately out of scope for this PR (separate
platform) and will be addressed in a follow-up.

## Linked issue
Closes amd#1325

## Changes
- `installer/scripts/start-agent-ui.ps1`: replace the two-line
`Split-Path -Parent` chain (plus the intermediate `$ScriptDir` variable)
with `(Resolve-Path "$PSScriptRoot\..\..").Path`. `$ProjectRoot` name is
preserved.
- `installer/scripts/build-ui-installer.ps1`: change `$REPO_ROOT =
(Resolve-Path "$PSScriptRoot\..").Path` to use `..\..` (same
one-character fix). `$WEBUI_DIR` / `$ELECTRON_DIR` derive from it, so
they get corrected transitively.

## Test plan
Automated (cross-platform, no Windows required):
- [ ] PowerShell parser:
`[System.Management.Automation.Language.Parser]::ParseFile(...)` returns
no errors for both files.
- [ ] Path resolution sanity check - write a temp script containing the
fixed line and confirm it resolves to the repo root:
  ```powershell
  `$PSScriptRoot = "`$PWD/installer/scripts"
  `$RepoRoot = (Resolve-Path "`$PSScriptRoot\..\..").Path
Test-Path (Join-Path `$RepoRoot "src/gaia/apps/webui/package.json") #
expect True
  ```
- [ ] `git diff` is scope-clean: only the two `.ps1` files, 3 insertions
/ 3 deletions.

Manual (Windows reviewer, optional):
- [ ] On a fresh clone, run `.\installer\scripts\start-agent-ui.ps1
-FrontendOnly` and confirm `npm install` runs in the correct directory
and `npm run dev` starts.
- [ ] Run `.\installer\scripts\build-ui-installer.ps1 -Mode browser` and
confirm the build completes against the real `src\gaia\apps\webui`.


## Checklist
- [x] I have linked a GitHub issue above (Closes amd#1325).
- [x] I have described **why** this change is being made, not just what
changed.
- [ ] I have run linting and tests locally. (N/A for PowerShell: python
util/lint.py and pytest tests/unit/ don't cover .ps1. Lint equivalents
ran: AST parse + path resolution test above.)
- [ ] I have updated documentation if user-visible behavior changed.
(N/A - bug fix; behavior now matches documented path expectations.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI changes cpp dependencies Dependency updates devops DevOps/infrastructure changes documentation Documentation changes electron Electron app changes installer Installer changes ready_for_ci Run CI workflows on draft PR without requesting review tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop installer: one-click install with NSIS, DMG, AppImage + auto-update

2 participants