Repository navigation
fix(lemonade): find GAIA's own server everywhere, not the default port - #4309
Conversation
A new user should install with npx, optionally run gaia init, and start GAIA from the TUI, web UI, desktop app or Claude Code. Scopes GAIA's embedded Lemonade replacing a system-wide install, start on demand from every entry point, the removal of the system-Lemonade code, and the follow-on PRs for npx install, TUI /init and the Claude Code plugin.
gaia opens the terminal UI, gaia web the web app and gaia app the desktop app; gaia chat --ui and the top-level --ui/--cli flags are removed as legacy. Adds this as its own PR in the sequence.
Records the decisions: the GAIA daemon starts and stops embedded Lemonade, GAIA never falls back to another Lemonade on the default port and reports the Lemonade app when it holds memory or the NPU, and a second PR removes gaia chat and every command that is neither useful nor exercised by CI, collapsing init profiles to gaia, npu and sd.
gaia init used to install Lemonade system-wide (MSI, PPA or .pkg, with an admin prompt on macOS), upgrade or uninstall existing installs, and try to start whatever it found. It now downloads GAIA's own Lemonade Server into ~/.gaia/lemonade (checksum-verified, no admin rights) and starts it on a private port. Re-running init restarts a stopped server, replaces an older one, and recovers one that stopped answering. LEMONADE_BASE_URL still names another server; init then only checks that it answers and meets the profile's minimum version. --remote now requires it. gaia init --check reports the embedded server's real state and targets it explicitly, so it can no longer call a profile ready because some other Lemonade answered on the default port. Removes --skip-lemonade (nothing used it), init's system install, upgrade and auto-start paths, and catch-all handlers in the steps touched.
…aged gaia init --check could call a user-chosen Lemonade Server ready that gaia init then refused as too old, so the TUI skipped setup and failed later. Both now share one minimum-version rule, and a server that reports no readable version is logged rather than silently passed. A shell that sourced GAIA's own credentials file set LEMONADE_BASE_URL to GAIA's server, which turned off init's management of it and kept a dead port and key after a restart. The file now also exports GAIA_LEMONADE_EMBEDDED=1, and GAIA follows its live state instead of those values. Also: --check reports a failure to list profile models instead of a traceback, the Linux troubleshooting entry about the Lemonade PPA is replaced with the embedded download's failure modes, and stale references to removed init helpers are fixed.
After a reboot, GAIA's own Lemonade Server was stopped and every entry point reported "Lemonade not running" until the user re-ran gaia init. The daemon now starts it when it comes up and whenever a GAIA command finds it stopped: LemonadeManager.ensure_ready() and gaia init --check ask the daemon through a new POST /daemon/v1/lemonade/ensure (host API 1.2). The daemon stops only a server it started itself, so one started by gaia init, by hand, or by another daemon keeps running. It never kills a server that is slow to answer (it may be loading a model) or replaces one running a different version; it reports those and points at gaia init. With LEMONADE_BASE_URL set it leaves Lemonade alone. It never installs anything.
…aits `gaia daemon stop` waited 10 s, but the daemon's shutdown now also stops the Lemonade Server it started (up to 20 s) and could wait up to 60 s behind a start still in flight, so a normal stop printed "did not exit; terminating" and killed the daemon before its custody store closed. Shutdown now waits at most 5 s for an in-flight start and leaves that server running, and the stop command waits 45 s. The TUI's setup check allowed 90 s while the Python side could spend over two minutes starting the daemon and the server after a reboot, so a successful start read as "could not be checked". The ensure timeout drops to 80 s (it never stops a stalled server) and the TUI allows 150 s, with a comment tying the two together. Also: a server this daemon started that has since exited is forgotten instead of logged as "pid None" on every stop, and --check's help and docs say it may start the daemon.
Unit tests block the network, so on a developer machine with GAIA set up the real ~/.gaia Lemonade Server looked stopped, and every test that called LemonadeManager.ensure_ready() asked a real daemon to start it: tests failed on start-lock timeouts and left daemons running. CI never saw it because nothing is installed there. An autouse fixture now stubs the start; tests of the start itself opt back in with @pytest.mark.embedded_start.
…ade-onboarding # Conflicts: # tests/unit/test_init_command.py
Windows CI failed to reach Lemonade on a port GAIA's own server had used: test_sd's `gaia init` now starts that server on a shared self-hosted runner, the job ended without stopping it, and its state file stayed in the runner's home. Every later client on that runner, in any job, followed the record to a dead port instead of the system Lemonade the job had started. The resolver now ignores a record whose process no longer exists (a standard-library check, cheap enough for every lookup). In CI, the scripts that start the system Lemonade name it through LEMONADE_BASE_URL for the rest of the job, and test_sd stops GAIA's server when it ends.
…-owns-embedded-lemonade
About 20 places read LEMONADE_BASE_URL directly and fell back to localhost:13305, so on a PC set up by `gaia init` they looked for Lemonade on an empty port: the Agent UI's system status and onboarding, the OpenAI-compatible API server's health check, the builder and connectors-demo agents, and the email agent's model choice. They now go through the one resolver: LEMONADE_BASE_URL, else GAIA's own running server, else the old default. The email agent's readiness probe also called GAIA's server without its API key, got a 401, and reported the server's version as unknown; it now sends the key, and every email probe resolves the key for the server it actually calls. The API server's health probe sends it too. With no GAIA server recorded nothing changes.
|
Verdict: Request changes — one blocking break, everything else is solid. This PR routes every "where is Lemonade?" lookup through the single resolver so GAIA's own server (which binds a private port) is actually found, and makes the email agent send that server's API key. The consolidation is the right call and the new tests pin The one thing to fix before merge: the email agent's scorecard generator now asks the model server for its version at an address with the API path in it twice, so the lookup fails and the nightly scorecard-refresh job stops with an error. The workflow that runs it has a comment warning about exactly this doubling — the resolver's normalized URL now trips it. Strip the API suffix before handing the URL to that version query. Reviewed the last commit only, per the PR description. Real-world evidenceN/A — no evidence bundle was produced for this run, so the verdict rests on static review plus reading the tests (I could not execute them; pytest isn't installed in this environment). Worth noting as a 🟡 on its own: this change moves user-visible surfaces — the Agent UI's system-status and onboarding screens, the OpenAI-compatible API server's 🔍 Technical detailsIssues🔴 Version probe gets
|
…-owns-embedded-lemonade
A Windows checkout converted install.sh to CRLF, and dash then rejected `case ... in\r` as a syntax error, failing the Windows parse test and breaking the script for anyone running it from such a checkout.
…-owns-embedded-lemonade
On Windows the models and Hugging Face caches resolve from LOCALAPPDATA/HF_HOME before the home dir, so the purge-models test got the runner's real cache path instead of the fake home's. Clear both in the fixture.
…-owns-embedded-lemonade
…-owns-embedded-lemonade
…ade-one-resolver # Conflicts: # hub/agents/email/npm/CHANGELOG.md
…-owns-embedded-lemonade
…ade-one-resolver # Conflicts: # hub/agents/email/npm/CHANGELOG.md
The expected substrings use "/" but Windows prints "\", so the dry-run test could never pass there.
…-owns-embedded-lemonade
Main landed the provider half of this change independently (amd#4309's ttft hooks plus Claude/Lemonade finish-reason capture), so the merge kept main's version and dropped this branch's duplicate assignment in ClaudeProvider._stream_chat. What remains here is the agent-loop cut-off guard the PR is actually about.
amd#4325) Agent UI Settings showed a red "Processor: darwin" on every Mac and flagged Linux machines and most Ryzen AI laptops as unsupported. The check still required a Ryzen AI Max or a 24 GB Radeon, the bar for the old Qwen3.5-35B default, but the default model is now the 4B Gemma. Nothing acts on that verdict, and memory fit is already covered by the Memory row and the per-agent memory warning. So the verdict is removed, and the Processor row now just names the real CPU (e.g. "Apple M4" instead of "darwin"). The silent `except Exception: pass` around the check is gone too. Overlap: amd#4176, amd#4265 and amd#4309 also edit `src/gaia/ui/routers/system.py`, but not the device block, so any conflict is textual only. ## Test plan - [x] Backend tests fail before the fix and pass after: all 7 new `tests/unit/test_device_check.py` tests and the new `test_system_status_names_the_processor_without_a_support_verdict` failed on `main`, and all pass with the fix. - [x] `GAIA_HOME=<tmp> GAIA_DAEMON_HOME=<tmp> python -m pytest tests/unit/chat/ui/ tests/unit/test_device_check.py -q`: 1038 passed. - [x] Agent UI, run with Node 22 from `src/gaia/apps/webui`: `npx tsc --noEmit -p .` is clean and `npx vitest run` passes 398/398. - [x] On a Mac, `GET /api/system/status` against a real `create_app()` returns `processor_name: "Apple M4"` and no `device_supported` field. On `main` it returned `"darwin"` / `false`. - [x] black, isort, and pylint (errors-only config) pass on the changed Python files. - [ ] Open Settings in the Agent UI on Windows and Linux and confirm the Processor row shows the CPU name without the warning colour. Fixes amd#4230 --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
Stacked on #4193 (which is stacked on #4192). Until those merge, this diff includes their commits; review only the last commit here.
On a PC set up by
gaia init, GAIA's own Lemonade Server runs on a private port, but about 20 places still looked for Lemonade on the old default port and found nothing. The Agent UI's status and onboarding screens, the OpenAI-compatible API server's health check, the builder agent and the email agent all reported the model server as missing. Now every lookup goes through one resolver:LEMONADE_BASE_URLif set, otherwise GAIA's own running server, otherwise the old default. With no GAIA server recorded, nothing changes.The email agent had a second problem on the same path: its readiness check called GAIA's server without the API key, got a 401, and reported the server's version as unknown. It now sends the key, as does the API server's health check.
Test plan
pytest tests/unit(14,472 passed; the one failure needs a live transcription server) plus the email and flagship agents' own tests with those packages on the pathGAIA_HOME, noLEMONADE_BASE_URL):gaia api start, thencurl localhost:8611/healthreports the model backend ready at GAIA's server (output below)GET /v1/email/initreports the server's version🔍 Technical details
lemonade-server serve, and two tests assert them. They are left for a repo-wide sweep of that command's mentions.test_stdio, emailtest_model_select) now pin an emptyGAIA_HOME, so they no longer depend on whether the developer's machine has GAIA set up.API server health with only GAIA's own Lemonade running (Apple Silicon)