Skip to content

fix(init): count the agent a terminal package ships beside the frozen gaia - #6946

Merged
kovtcharov-amd merged 1 commit into
mainfrom
kalin/fix-journey-frozen-gaia
Nov 7, 2026
Merged

kovtcharov-amd merged 1 commit into
mainfrom
kalin/fix-journey-frozen-gaia

Conversation

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Since v0.26.0-rc6 (#6783), a terminal-only install refuses to chat when the user's models are already on Lemonade. The TUI now asks the bundled frozen gaia whether setup is done. That check only looked for the agent in ~/.gaia/bin or the hub install, so it said "the GAIA agent needs installing" even though gaia-agent ships right beside gaia-tui. This is what turned the win-setup-tui, win-setup-both, *-tui-deb, fedora-tui-rpm and mac-*-tui-pkg journey rows red on rc6 and rc7. The check now also counts the agent beside the frozen gaia and, for a frozen gaia only, on PATH. The install-sh journey rows were also failing at uninstall because the harness still called ~/.gaia/venv/bin/gaia, which the frozen install no longer creates.

Test plan

  • pytest tests/unit/test_init_command.py: 198 passed. The two new "ready" tests fail without the fix. The adversarial cases still report the agent missing: an agent on a pip install's PATH, beside a source interpreter, a directory named gaia-agent, or a non-executable file.
  • Readiness-related suites (setup runner, init profiles and model choices, hub installer, daemon Lemonade): 605 passed. One failure is pre-existing and fails the same way on main when gaia-tui is on the dev machine's PATH.
  • Installer journeys on this PR: the win-setup-tui/win-setup-both, *-tui-deb, fedora-tui-rpm and mac-*-tui-pkg rows pass health, and the *-install-sh rows pass uninstall and leftovers.

… gaia

Since the terminal packages started shipping a frozen gaia (#6783), the
TUI asks that gaia whether setup is done. Its check only looked for the
flagship in ~/.gaia/bin or the hub install, so on a Windows setup, .deb,
.rpm or .pkg install it reported "the GAIA agent needs installing" even
though gaia-agent sits beside gaia-tui. With models already on the
server, the TUI halted before running any turn. The check now also
accepts the agent beside the frozen gaia and, for a frozen gaia, on PATH.

The headless journey's install.sh rows called ~/.gaia/venv/bin/gaia to
uninstall, which the frozen install no longer creates; they now use
~/.gaia/bin/gaia and check ~/.gaia/core is removed.
@kovtcharov-amd kovtcharov-amd self-assigned this Nov 7, 2026
@github-actions github-actions Bot added installer Installer changes tests Test changes labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve

Terminal-only installs (the Windows setup, .deb, .rpm and macOS .pkg) stopped refusing to chat once their models were already on Lemonade. The setup check now finds the agent these packages ship next to the frozen gaia or on PATH. It still ignores a stray gaia-agent on the PATH of a pip or source install. The install-script journey also gets the right gaia for uninstall now, and checks that the new core folder is removed. I found no blocking issues.

Real-world evidence

The evidence stage ran the real gaia init --check against a stub Lemonade with an empty GAIA_HOME. It used a simulated frozen gaia, not a real PyInstaller build. The two layouts this PR fixes went from not ready to ready, and the negative cases still report the agent missing:

### D. frozen gaia with gaia-agent beside it (Windows setup layout)
{"ready": true, "stage": null, "reasons": [], "models": [], "agent_missing": false, "warnings": [], "no_agent_build": false}
exit=0

### E. frozen gaia under lib/gaia, gaia-agent on PATH (.deb/.rpm/.pkg layout)
{"ready": true, "stage": null, "reasons": [], "models": [], "agent_missing": false, "warnings": [], "no_agent_build": false}
exit=0

### C. source gaia, gaia-agent only on PATH (pip install)
{"ready": false, "stage": "setup", "reasons": ["The GAIA agent is not installed -- run: gaia init"], "models": [], "agent_missing": true, "warnings": [], "no_agent_build": false}
exit=1

### F. frozen gaia, no agent anywhere
{"ready": false, "stage": "setup", "reasons": ["The GAIA agent is not installed -- run: gaia init"], "models": [], "agent_missing": true, "warnings": [], "no_agent_build": false}
exit=1

Before this PR (HEAD~1), the same D and E layouts gave "ready": false, exit 1. The journey script got only a syntax check (bash -n, exit 0), because a full install-and-uninstall journey can't run on this lane. The script change rests on static review and on the PR's pending journey item. Rendered TUI and Agent UI screens are pending the strix-halo lane.

🔍 Technical details

Issues found: none blocking, and no nits worth posting.

What I checked

  • _terminal_installer_agent (src/gaia/installer/init_command.py:920): is_frozen and shutil are already imported. The function's only caller is _agent_ready_for_check, so nothing else picks up the wider lookup. The exec-bit and is_file() checks still apply to every candidate.
  • The PATH lookup applies only when gaia is frozen. That matches what the TUI does, since it runs gaia-agent from PATH, so the check and the launch can't disagree.
  • posix-journey.sh: installer/scripts/install.sh:15-17,635-660 confirms the layout. It links $GAIA_HOME/bin/gaia to $GAIA_HOME/core/gaia and creates no venv, so both the new uninstall path and the core leftover assertion match what the installer writes.
  • Tests: setUp now pins PATH to an empty temp dir, so a gaia-agent on the dev machine can't make the "missing" tests pass by accident. The new tests cover both ready layouts and four negative cases (a pip-install PATH, beside a source interpreter, a directory named gaia-agent, a non-executable file). I couldn't run pytest here because the runner's Python has no pytest. The PR reports 198 passing.
  • Docs drift: no user-facing doc describes where --check looks for the agent, and none tells install-sh users to uninstall with ~/.gaia/venv/bin/gaia. The only mentions of that path are in docs/plans/desktop-installer.mdx, and they're about the DMG and AppImage rows, so they're out of scope.

Strengths

  • The fix stays small: one candidate list, and each rule (frozen only, executable, a real file) is backed by its own negative test.
  • The evidence includes before and after runs on the same layouts, so the claimed regression and its fix are both shown, not inferred.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 800729f Nov 7, 2026
84 of 93 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/fix-journey-frozen-gaia branch November 7, 2026 18:02
kovtcharov pushed a commit to kovtcharov/gaia that referenced this pull request Nov 7, 2026
Since v0.26.0-rc6 the frozen `gaia` shipped without the web UI build, so
`gaia chat --ui` served only its "This is the GAIA backend API"
placeholder. Anyone opening the Agent UI in a browser or on a phone over
the tunnel got no app, and every desktop journey row (win-agent-ui-exe,
win-setup-ui, the .deb, AppImage and dmg rows) timed out waiting for the
setup screen. Now the core build builds the UI first, the freeze bundles
it and refuses to build without it, and the smoke test fails if `/`
isn't the app. When setup fails, the journey rows now also upload
Playwright's screenshot, trace and report.

amd#6946 doesn't fix this one: it changes `gaia init`'s agent check, and
this failure is the missing UI files.

## Test plan
- [x] `pytest tests/unit/installer/test_core_freeze_webui.py
tests/unit/installer/test_installer_headless.py
tests/unit/installer/test_install_scripts_terminal_hub.py
tests/unit/installer/test_readme_matches_layout.py`
- [x] The smoke check accepts a real `npm run build` index.html and
rejects the server's placeholder page
- [x] `build_core.yml` dispatched on this branch
([run](https://github.com/amd/gaia/actions/runs/42398982613)): freeze
and smoke pass on win32-x64, darwin-arm64 and linux-x64, including
"serves the Agent UI at /"
- [ ] Next RC: the desktop journey rows pass the setup phase
kovtcharov pushed a commit to kovtcharov/gaia that referenced this pull request Nov 13, 2026
…/bin (amd#7847)

After `install.ps1` or `install.sh`, `gaia -p` failed with "no verified
sidecar binary" because the daemon would not start the `gaia-agent` the
installer had just downloaded and checksum-verified, while `gaia init
--check` counted that same copy as installed. The install scripts now
record the verified agent's version and SHA-256 beside it, and the
daemon starts that copy after re-hashing it against the record. A
replaced or corrupt copy is still refused, with a reinstall remedy.
`gaia init --check` uses the same lookup, so it stops counting a
`~/.gaia/bin` copy the daemon would refuse. The error also stops leading
with a lock-file path that only exists in a source checkout.

**Decision taken (the issue left it open):** Option B from the
maintainer's comment, narrowed to the two install scripts this issue is
about. The record sits in `~/.gaia/bin` beside the binary, the same
trust level as the hub's `.installed` sentinel. Anyone who can rewrite
it can also replace `gaia.exe` in that folder, so the daemon's
verification rule gets no wider. Option A (a digest built into `gaia`)
doesn't fit `install.ps1`: it takes the agent from the hub at install
time, not the one the core was built with.

**Known gap, unchanged by this PR:** the terminal packages (.deb, .rpm,
.pkg, Windows setup) write no record yet. The daemon still refuses their
copy, as it does on `main`, and now names the copy and the fix. `gaia
init --check` keeps counting those copies, because the TUI runs them
directly and dropping them would bring back the amd#6946 regression.
Closing that gap means each package build ships the record. That's a
follow-up.

## Test plan
- [x] Real `install.ps1` `Install-FlagshipAgent` (Windows PowerShell
5.1) into an empty temp profile against the live hub downloaded agent
0.3.5 plus its record. Then `gaia daemon start-agent gaia --mode user`
from this branch, with that profile as `HOME`/`GAIA_HOME`: the sidecar
came up from `~/.gaia/bin/gaia-agent.exe` (log: "using installer-placed
verified binary … (v0.3.5)").
- [x] Same profile with one byte appended to the agent: start refused,
"does not match the SHA-256 its installer recorded", with the `gaia
init` remedy. After the byte was removed, it started again.
- [x] `pytest tests/unit/test_daemon_sidecar_fetch.py
tests/unit/test_agent_sidecar_manager.py tests/unit/test_init_command.py
tests/unit/installer/test_install_scripts_terminal_hub.py`: 375 passed.
The new tests fail on `main`.
- [x] Adversarial cases: no record, a replaced copy, a truncated copy, a
corrupt or partial or non-hex record, a record with no binary, a
directory named like the agent, a recorded copy on a pip install's PATH,
and the email agent all stay refused. A hub install still wins over the
installer copy.
- [x] Wider daemon, init and installer suites: 2195 passed. 3
TUI-detection tests fail only on this dev box, which has GAIA's NSIS
install registered. They're unrelated.
- [ ] CI: the POSIX `install.sh` round-trip test
(`test_daemon_starts_the_agent_install_sh_placed`) runs on Linux.
- [ ] Next RC: `install-ps1` / `install-sh` journey rows, `gaia -p` on a
fresh profile.

Closes amd#7187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

installer Installer changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant