Repository navigation
fix(setup): plan against the server setup will use; plain error when Lemonade isn't answering - #5542
Conversation
A fresh setup said the chat and embedding models were "already downloaded" whenever another Lemonade ran on the default port, because the plan asked that server, not GAIA's own; choosing "Use GAIA's own" then changed nothing on screen and the run downloaded both. The plan now asks the user's server only when they chose it, GAIA's own only while it runs, and otherwise reads sizes from the registry, so re-planning after the choice shows the truth. - A failed or stopped run no longer hides "Choose where GAIA runs", so a Lemonade already running is still offered on the next launch. - The download step shows its percentage and size, e.g. "45% · 1.20 GB of 2.50 GB".
First-run setup against an unreachable Lemonade showed the raw HTTPConnectionPool exception and offered only "Try again" or the same failing command for a terminal. It now says "Your Lemonade Server at 127.0.0.1:9 isn't answering.", says how to start it (from describe_start_hint, never a hard-coded command), and offers "Use GAIA's own instead", which re-runs setup with --gaia-lemonade. When LEMONADE_BASE_URL picks the server it says to unset it instead, since the variable outranks any saved choice. The raw error stays under Details. - The Chat model step is no longer checked off when setup never picked a model. - A retry after a failed switch keeps switching, and a failure of GAIA's own server is reported as itself, not as the user's server being down.
Running the unit suite wrote edit backups, the file audit log, goals.db, the RAG HMAC key, scratch databases and log lines into the developer's own ~/.gaia. Tests now resolve GAIA's home to a per-session tmp dir unless they set GAIA_HOME, GAIA_CONFIG_DIR or a home of their own, and the log goes to the session's tmp dir through a new GAIA_LOG_FILE override. - GAIA_HOME is not set suite-wide: it outranks the Path.home patches and GAIA_CONFIG_DIR that many tests rely on. Only the ~/.gaia fallback moves. - goals.db and the RAG HMAC key now follow gaia_home(), so GAIA_HOME moves them too; the hard-coded-path allowlist drops both. - The refusal-exit-code test forwards GAIA_LOG_FILE to its hand-built child environment.
|
Verdict: Approve with suggestions First-run setup now plans its downloads against the server it will actually use. Before, another Lemonade on the default port could make setup say "already downloaded". When the user's own server isn't answering, setup now shows a plain message with a way to start it and a one-click switch to GAIA's own. Unit tests also stop writing into the developer's real Real-world evidenceN/A: no evidence bundle was produced for this run. The PR description embeds three Agent UI screenshots: the plan against the chosen server, the plan after switching to GAIA's own, and setup finished. These cover the main flow. The new "server isn't answering" screen has unit and Vitest coverage only. Beyond those screenshots, this verdict rests on static review. 🔍 Technical detailsIssues found 🟢 A crash in the failure probe would leave setup stuck on "running" ( 🟢 A wildcard bind address gets the "remote computer" hint ( Strengths
|
…he start hint fails A Lemonade bound to 0.0.0.0 or :: is on this PC, so it gets the local start hint instead of 'start it on the computer at 0.0.0.0'. If working out the start hint raises an OSError, setup still reports that the user's server isn't answering and logs why the hint is missing.
|
Both suggestions are in, and CI is green. A Lemonade bound to
🔍 Technical details
|
# Conflicts: # src/gaia/apps/webui/src/components/SetupScreen.tsx
Brings in amd#5542, amd#5598 and amd#5633 alongside the installer that downloads no model and the setup screen that names and downloads the model that fits. Kept from this branch: the installer never runs `gaia init`, so main.cjs no longer asks the install-time Lemonade question and backend-installer keeps no init record; the setup screen starts the server first (`server_only`), pins the planned model (`--chat-model`), reads `--progress-json` progress, and shows the memory and disk warnings. Kept from main: the plan asks the server setup will use and an unanswering Lemonade gets plain words with "Use GAIA's own instead" (amd#5542), now passed through every run shape as a fourth `gaia_lemonade` flag; the greyed AMD gateway, its re-check button and the disabled start button (amd#5633); and the new-chat "setup didn't finish" notice (amd#5598). That notice read the installer's failed-init record, which no longer exists. Its source is now the setup screen's own last failed run, kept in ~/.gaia/chat/setup-error and cleared by a run that succeeds, so a run whose models download but fail to load still warns before the first message. The installer test for recording init's failure and the source test for the removed Lemonade dialog are dropped with the code they covered. API types are regenerated from the merged models.
…reach (amd#5653) Of the last 150 bug fixes, 147 shipped a regression test, yet CI caught only about 7 of those bugs before users or RC testing did. Each test guards the one call site that broke, and the next site with the same flaw ships untested. Meanwhile every PR ran all ~27k unit tests on three operating systems, even for a docs edit, and most main-branch runs were cancelled before they finished. This PR guards the recurring bug shapes everywhere, fixes a real bug the new tests found, and makes a PR run only the tests it can affect. - **Guards for the shapes behind most recent fixes.** A ratchet counts subprocess and HTTP calls with no timeout, kill-by-image-name, and `except Exception` bodies that only pass or return a placeholder. Existing sites are grandfathered, new ones fail CI, and fixing one lowers the count. - **Folder grants were lost when several GAIA processes saved at once.** A four-process test lost 96–98 of 100: the read-modify-write had no lock, and a torn read "rebuilt" the file from empty. It is now locked and atomic. Six runtime calls that could hang forever now time out, with actionable errors. - **PRs run only the reachable tests.** `util/select_tests.py` combines a nightly per-test coverage map with static rules for what coverage can't see. Windows and macOS run the OS-touching subset of that. The median PR runs about a quarter of the suite. On ~1,150 recent commits, it selected every bug fix's own regression test from the fix's source changes alone. - **Full coverage moves to main and nightly.** Every push to main runs the full suite on Linux and now finishes instead of being cancelled. The nightly run covers all three operating systems and rebuilds the map. The frozen flagship binary also builds on packaging PRs and weekly, not only at an RC. - **Duplicates trimmed.** The email unit lane no longer re-runs ~90 files `test_unit.yml` already covers, and the warning-only C++ benchmarks run on main instead of every PR. Also unbreaks main's TUI build: amd#5464 documented the desktop app's `gaia` shim in backticks, and the TUI doc check only exempted it before a space, so every PR's TUI checks went red. The shim is the Python CLI's, so the exemption now accepts any punctuation after it. Trade-offs to know: a Windows- or macOS-only bug outside the OS-touching subset surfaces at the nightly run, not on the PR, and PRs no longer upload partial coverage to Codecov. To run the full suite on a branch, dispatch `test_unit.yml` on it. ## Test plan - [x] `pytest tests/unit/test_select_tests.py tests/unit/test_process_safety_ratchet.py tests/unit/test_allowed_paths_concurrency.py`: 26 + 33 + 1 passed; the concurrency test fails on the old code (96–98 of 100 grants lost) - [x] Full `tests/unit` locally: 27,501 passed; 26 failures that fail identically on main in this environment (PATH-installed `gaia`, real wheel installs) - [x] `python util/lint.py --all` passes, including the lane-coverage, path-coverage, trigger and ancestor-skip checks - [x] Selector replayed over ~1,150 recent commits with a map built from a real `--cov-context=test` run - [ ] After merge: the first nightly run saves `unit-test-map-*`, and the next PR's "Select unit tests" summary reports a map-based selection <details> <summary>🔍 Technical details</summary> - Static rules: module-level imports (transitive); every import and module-naming string in tests and tooling (transitive); filename strings and directory scans (one hop); nested `conftest.py`; top-level fixtures by requested name, through fixture chains; autouse isolation fixtures (one hop); CLIs run with `python -m`, whose lazy imports coverage can't see. A package `__init__` reaches everything below it when it changes, but the walk never continues through one. - Full-run triggers: any `conftest.py`, packaging or pytest config, the selector or `test_unit.yml`, and any deleted or renamed file (`git diff --no-renames`). So does a selection over 70% of the suite. - With no map (a cache miss), function-level imports are followed too and the job summary says so; a map over 3 days old raises a warning. - A push diffs against the last commit a successful main run tested, so merges whose runs were dropped while pending still reach Windows and macOS. The event name is in the concurrency group, so a push can't drop the nightly. - Known blind spot, documented in `docs/reference/dev.mdx`: code behind a cache or shared fixture is credited in coverage only to the first test that ran it. - Open PRs touching the same files (amd#5453, amd#5417, amd#5511, amd#5600, amd#5475, amd#5542, amd#5558) test-merge cleanly against this branch; none gains a conflict from it. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: v <v@x>
First-run setup said the models were "already downloaded" whenever another Lemonade happened to run on the default port, and choosing "Use GAIA's own" changed nothing on screen before downloading both anyway. A Lemonade that wasn't answering showed a raw
HTTPConnectionPoolexception. Now the plan reflects the server setup will really use, the download step shows progress and size, and an unreachable server gets a plain message with a working way out. The unit suite also stops writing into the developer's real~/.gaia.Test plan
pytest tests/unit: 27235 passed; the 27 failures also fail on clean main except test_windows_system32_is_blocked, which passes alone and in three parallel reruns (order-dependent)npx vitest runinsrc/gaia/apps/webui: 1532 passedLEMONADE_BASE_URLset it says to unset ittests/unit/test_gaia_home_isolation.pyfails if a unit test resolves GAIA's home to the real~/.gaia🔍 Technical details
describe_start_hint(); whenLEMONADE_BASE_URLpicks the server it says to unset it, since it outranks any saved choice.GAIA_HOMEsuite-wide, which would outrank tests' ownPath.homepatches);GAIA_LOG_FILEmoves the log; goals.db and the RAG HMAC key now followgaia_home().