Skip to content

feat(init): set up GAIA's embedded Lemonade Server - #4192

Closed
kovtcharov wants to merge 28 commits into
amd:mainfrom
kovtcharov:claude/embedded-lemonade-onboarding
Closed

kovtcharov wants to merge 28 commits into
amd:mainfrom
kovtcharov:claude/embedded-lemonade-onboarding

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

gaia init no longer installs Lemonade system-wide. Before, it ran an MSI, PPA or .pkg install (with an admin prompt on macOS), offered to uninstall and upgrade whatever Lemonade it found, and then tried to start it. Now it downloads GAIA's own Lemonade Server into ~/.gaia/lemonade (checksum-verified, no admin rights), starts it on a private port, and leaves any Lemonade app on the machine alone. Re-running init restarts a stopped server, replaces an older one, and recovers one that stopped answering.

gaia init --check now reports that server's real state and asks it directly. It can no longer call a profile ready because some other Lemonade happened to answer on the default port. LEMONADE_BASE_URL still points GAIA at a server you run yourself, and init then only checks that server.

This is the first of three PRs from docs/plans/embedded-onboarding.mdx:

  • This PR: gaia init uses embedded Lemonade.
  • Next: the daemon starts and stops it, so nobody has to run init after a reboot.
  • Then: CI moves off system Lemonade, and the system installer, the default-port fallback and gaia install --lemonade are removed.

Also cleaned up: --skip-lemonade is removed (nothing used it); --remote without LEMONADE_BASE_URL is now an error instead of a guess; catch-all handlers in the touched steps now catch Lemonade's own error type; setup no longer suggests a lemonade CLI that isn't on PATH.

Test plan

  • pytest tests/unit/test_init_command.py tests/unit/installer tests/unit/test_lemonade_embedded.py tests/unit/test_webui_build.py (new tests cover install, reuse, version replacement, recovering an unresponsive server, --force-reinstall, a configured server that is unreachable or too old, and every --check state)
  • From an empty GAIA_HOME on Apple Silicon: gaia init --check --profile minimal says not installed, then gaia init --profile minimal --yes installs and starts the server, verifies Gemma at 32K context, and --check says ready
  • Stop the server: --check reports "installed but not running", and re-running gaia init restarts it in seconds without downloading anything again
  • gaia init --yes from an empty GAIA_HOME on Windows and on Linux (Strix Halo)
  • gaia init --profile npu --yes on a Ryzen AI machine installs flm:npu into the embedded server
Terminal output: empty GAIA_HOME on Apple Silicon (progress bar and log lines trimmed)
$ gaia init --check --profile minimal
NOT READY: profile 'minimal' needs setup
  - GAIA's Lemonade Server is not installed
(exit 1)

$ gaia init --profile minimal --yes --skip-webui-build
Step 1/3: Starting Lemonade Server...
   Downloading Lemonade Server v11.8.1...
   [====================] 100% (5.4 MB/5.4 MB)
   ✓ Installed Lemonade Server v11.8.1 in ~/.gaia/lemonade/dist/11.8.1
   ✓ Lemonade Server v11.8.1 running on port 54781

Step 2/3: Downloading models for 'minimal' profile...
   ✓ Downloaded Gemma-4-E4B-it-GGUF

Step 3/3: Verifying setup...
   ✓ Server health: OK
   ✓ Context size verified: 32768 tokens
   ✓  Gemma-4-E4B-it-GGUF - OK (ctx: 32768)
   ✓ All 1 model(s) verified

  GAIA initialization complete!
(exit 0)

$ gaia init --check --profile minimal
READY: profile 'minimal' is already set up
(exit 0)

Kalin Ovtcharov added 6 commits September 24, 2026 16:51
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.
@github-actions github-actions Bot added documentation Documentation changes llm LLM backend changes cli CLI changes tests Test changes performance Performance-critical changes labels Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Request changes

gaia init now downloads and runs GAIA's own Lemonade Server under ~/.gaia instead of installing one system-wide, and the old MSI/PPA/pkg install, upgrade and auto-start code is gone. The shape of the change is good — one step replaces four, the error paths caught Exception before and now catch Lemonade's own error type, and the test suite was genuinely rewritten rather than patched up.

One thing should be fixed before merge:

  • gaia init --check can say "ready" for a server that gaia init would then refuse. When you point GAIA at your own Lemonade Server, init rejects it if it's older than the profile needs — but the --check path doesn't apply that same rule. The terminal UI uses --check to decide whether to run setup at all, so it will skip setup and then hit the version error later. Apply the same minimum-version check on both paths.

Two smaller things worth a look:

  • A stale Linux troubleshooting page. The docs still explain a gaia init failure caused by the Lemonade PPA being unreachable — a failure this PR makes impossible, since init no longer touches the PPA. Someone hitting a real Linux setup problem now lands on advice for a path that doesn't exist.
  • Sourcing GAIA's own credentials file turns init's management off. gaia lemonade embedded start tells you to source a file that exports LEMONADE_BASE_URL pointing at the embedded server. In that shell, init now treats GAIA's own server as someone else's: if it's stopped, init reports "not reachable, unset LEMONADE_BASE_URL" instead of restarting the server it owns. Intentional under the new rule, but it's a footgun GAIA itself sets up — worth recognising GAIA's own recorded port as its own.

Real-world evidence

N/A — no evidence-bundle.md was produced for this run, and the PR description asserts the macOS runs happened without pasting what they printed. This is a CLI change, so the evidence that matches it is the real terminal output: gaia init --check on an empty GAIA_HOME, gaia init --profile minimal --yes installing and starting the server, and --check afterwards. Please paste those three. The Windows and Strix Halo items are still unchecked, so the verdict here rests on static review plus reading the embedded-server code this PR now depends on.

🔍 Technical details

🟡 --check skips the minimum-version gate for a configured server (src/gaia/installer/init_command.py:239)

check_setup_status resolves LEMONADE_BASE_URL and goes straight to health_check() — it never reads INIT_PROFILES[profile]["min_lemonade_version"]. _check_configured_server (init_command.py:825) does, and fails the step. The embedded branch does compare versions (status.version != embedded.version), so the asymmetry is only on the configured path.

This breaks the invariant the docstring states outright: "Checks the SAME real state run() itself acts on … so this can never disagree with what gaia init would actually do." Failure: LEMONADE_BASE_URL points at Lemonade v9 with the npu profile → gaia init --check exits 0 (READY) → the Go TUI's first-boot check skips setup → the first model load fails against a server init would have rejected up front.

Reusing version_meets_min from gaia.agents.base.readiness here keeps both paths on one rule.

🟡 Troubleshooting doc describes a failure path that no longer exists (docs/reference/troubleshooting.mdx:89)

The "gaia init reports a Launchpad outage (Linux)" accordion attributes a gaia init failure to ppa:lemonade-team/stable. After this PR init never adds the PPA, so the accordion is unreachable advice. CLAUDE.md's rule is that a functional change updates every doc describing it in the same change — cli.mdx was updated, this one wasn't. Replace it with the embedded-download failure modes (checksum mismatch, unpublished asset for the arch, lemond.log).

🟡 GAIA's own env file opts the user out of init's management (src/gaia/cli.py:7527, init_command.py:821)

gaia lemonade embedded start prints source ~/.gaia/lemonade/gaia-lemonade.env, which exports LEMONADE_BASE_URL=http://localhost:<embedded-port>/api/v1. _ensure_lemonade_ready branches on self._lemonade_base_url alone, so in that shell init only probes. Stop the server and re-run init: you get "not reachable … unset LEMONADE_BASE_URL" for a server GAIA installed and can restart.

EmbeddedLemonade().status() already carries port/base_url — matching the configured URL against the recorded instance and falling into _start_embedded_server would close this without weakening the "a configured server is someone else's" rule.

🟢 Nits

  1. version_meets_min(version, minimum) is False (init_command.py:847) lets a server that advertises no version, or an unparseable one, through silently. A one-line warning naming what couldn't be determined keeps it fail-loud.
  2. client.get_required_models(...) (init_command.py:291) sits outside the LemonadeClientError guard three lines above it, so gaia init --check can still exit with a traceback. Pre-existing, but the neighbouring handler was just tightened.
  3. hub/agents/email/python/gaia_agent_email/api_routes.py:384 says it mirrors gaia.installer.init_command.InitCommand._parse_version — a symbol this PR deletes.
  4. tests/unit/test_init_command.py:1109 — TestNeedsInstallConsistency's docstring still promises agreement with the removed _check_version_compatibility.
  5. The server no longer starts with the profile's min_context_size (bug(installer): GAIA installs lemonade but does not set context size #839's LEMONADE_CTX_SIZE); _verify_setup covers it via the per-load ctx instead. Worth one line in the module docstring so the next reader doesn't re-add the env var.

Strengths

  • The catch-alls in the touched steps went from except Exception to LemonadeClientError / EmbeddedLemonadeError, and check_setup_status now reports a failed model probe instead of scoring it as "not downloaded" — that second one silently mislabelled a server-side 500 as a missing model.
  • --remote without LEMONADE_BASE_URL raising instead of guessing, and blank/whitespace treated as unset, both have tests. Good instinct.
  • The test rewrite deletes the mocked-system-installer suites rather than leaving them asserting against dead code, and the new TestLemonadeReady covers the states that actually matter: fresh install, reuse, version replacement, unresponsive pid, --force-reinstall, and both configured-server failure modes.
  • _server_problem_hint() is a small, good idea — every post-start failure now points at lemond.log or the configured URL instead of a start command that may not exist.

Kalin Ovtcharov added 2 commits September 24, 2026 17:12
…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.
@github-actions github-actions Bot added the agent::email Email agent changes label Sep 25, 2026
Kalin Ovtcharov added 2 commits September 24, 2026 22:48
…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.
@github-actions github-actions Bot added installer Installer changes devops DevOps/infrastructure changes labels Sep 25, 2026
Kalin Ovtcharov added 6 commits September 25, 2026 10:12
…ade-onboarding

# Conflicts:
#	hub/agents/email/python/gaia_agent_email/api_routes.py
#	src/gaia/installer/init_command.py
…ade-onboarding

# Conflicts:
#	src/gaia/installer/init_command.py
…ade-onboarding

# Conflicts:
#	src/gaia/installer/init_command.py
With the system installer gone nothing imports gaia.llm.lemonade_embedded at
collection time, so pyfakefs unloaded it after the first purge-guard case and
the second case patched an orphaned class.
@github-actions

Copy link
Copy Markdown
Contributor

🟡 The three issues the first review flagged are fixed — the --check minimum-version gate, the stale Linux troubleshooting page, and GAIA's own credentials file opting init out of management (the GAIA_LEMONADE_EMBEDDED marker is a clean solution). One correctness bug is still present.

gaia init says "Replacing Lemonade Server" but starts the old binary. When the embedded server is running at the wrong version, _start_embedded_server stops it, then checks if self.force_reinstall or not embedded.is_installed(). Since force_reinstall is False and the old binary is still on disk, is_installed() returns True and install() is skipped. start(install_if_missing=False) then launches the old binary. The user sees "Replacing … with vX" but the old version runs again. --check will keep reporting not-ready, and the TUI's first-boot check will loop. The only escape is gaia init --force-reinstall.

The fix is to set needs_install = True in the version-mismatch branch, or include the version-mismatch in the install condition.

🔍 Technical details

src/gaia/installer/init_command.py — _start_embedded_server:

elif current.running and current.version != embedded.version:
    self._print(f"   Replacing ... v{current.version} with v{embedded.version}...")
    embedded.stop()
# …
if self.force_reinstall or not embedded.is_installed():   # ← binary still on disk → skipped
    embedded.install(force=self.force_reinstall)
status = embedded.start(install_if_missing=False)          # ← old binary starts

is_installed() checks only that daemon_path.is_file() exists, not the version. After stop(), the old file is still there, so the guard is False and the new binary is never downloaded.

Suggested fix (two options — either is fine):

# Option A: widen the guard
needs_new_binary = self.force_reinstall or not embedded.is_installed() or \
    (current.version != embedded.version and not current.running)
if needs_new_binary:
    embedded.install(force=True)
# Option B: set a flag in the mismatch branch
version_mismatch = current.running and current.version != embedded.version
if version_mismatch:
    embedded.stop()

if self.force_reinstall or not embedded.is_installed() or version_mismatch:
    embedded.install(force=self.force_reinstall or version_mismatch)

test_older_running_version_is_replaced asserts stop and start were called but does not assert install was called — that gap hides this bug.

…sion

Each version unpacks into its own directory, so the old binary on disk does not
count as installed and init downloads the new one before starting it. The
existing test mocked the install check and could not show that.
Kalin Ovtcharov added 4 commits September 25, 2026 18:32
…r test

A client launched by an earlier test keeps a fake server handle, so when the
collector finalizes it mid-test its __del__ runs the port cleanup against that
test's patched listener list and trips the "kills nothing" assertion. Collect
before each test and keep the fake-launched clients alive.
On Windows the system temp dir lives under the user's home, so the "outside"
target was inside home, nothing escaped, and the 403 never fired. Use a private
home with the outside dir beside it.
Same Windows trap as the home-escape test: tmp_path sits inside the user's
profile, so the outside dir was readable on home's account and nothing escaped.
The message formats the path with %r, which doubles every backslash on Windows,
so a substring check against sys.executable could never match there.
@github-actions

Copy link
Copy Markdown
Contributor

🟡 The version-mismatch install bug flagged in the last re-review is still unresolved.

When gaia init detects a running embedded server at the wrong version, it stops the server but then skips the install() call because force_reinstall is False and the old binary is still on disk — so is_installed() returns True. The user sees "Replacing … with vX" but the old version starts again. gaia init --check keeps reporting not-ready; the only escape is --force-reinstall.

🔍 Technical details

src/gaia/installer/init_command.py:921–931 — _start_embedded_server:

elif current.running and current.version != embedded.version:
    embedded.stop()                     # old binary still on disk
# …
if self.force_reinstall or not embedded.is_installed():   # ← skipped: file exists
    embedded.install(...)
status = embedded.start(install_if_missing=False)          # ← old binary starts

Suggested fix (Option B from the previous review):

version_mismatch = current.running and current.version != embedded.version
if version_mismatch:
    embedded.stop()

if self.force_reinstall or not embedded.is_installed() or version_mismatch:
    embedded.install(force=self.force_reinstall or version_mismatch)

test_older_running_version_is_replaced still does not assert that install was called in the version-mismatch branch, which is why the bug survives CI.

Kalin Ovtcharov added 6 commits September 25, 2026 19:26
Each version unpacks into its own dist dir, so is_installed() is false for a
new version even with the old binary on disk.
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.
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.
The expected substrings use "/" but Windows prints "\", so the dry-run
test could never pass there.
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Sep 26, 2026
amd#4309)

**Stacked on amd#4193 (which is stacked on amd#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_URL` if 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
- [x] `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 path
- [x] New tests: the Agent UI's system and onboarding lookups follow
GAIA's recorded server, and a configured URL still wins. The API server
and email agent health probes send that server's key. The flagship's
health report names the URL the client would really have used.
- [x] With only GAIA's own Lemonade running (scratch `GAIA_HOME`, no
`LEMONADE_BASE_URL`): `gaia api start`, then `curl
localhost:8611/health` reports the model backend ready at GAIA's server
(output below)
- [ ] On a PC with only GAIA's own Lemonade (no system install): the
Agent UI's system status shows the model server as running, and the
email agent's `GET /v1/email/init` reports the server's version

<details>
<summary>🔍 Technical details</summary>

- Removing the fallback to the default port, which the self-hosted CI
runners still rely on, is a separate change.
- Several email-agent messages still say `lemonade-server serve`, and
two tests assert them. They are left for a repo-wide sweep of that
command's mentions.
- Two tests that assumed the default port (flagship `test_stdio`, email
`test_model_select`) now pin an empty `GAIA_HOME`, so they no longer
depend on whether the developer's machine has GAIA set up.
</details>



<details>
<summary>API server health with only GAIA's own Lemonade running (Apple
Silicon)</summary>

```
$ gaia lemonade embedded status
Running:   yes on http://localhost:52461/api/v1 (pid 9670)
$ gaia api start --port 8611 &
$ curl -s localhost:8611/health
{"status":"ok","service":"gaia-api","components":{"api":{"status":"ready"},"llm":{"status":"ready","backend":"lemonade","model":"Gemma-4-E4B-it-GGUF","url":"http://localhost:52461/api/v1"},"rag":{"status":"not_configured"}}}
HTTP 200
```
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Sep 26, 2026
**Stacked on amd#4192. Land after amd#4301**, which stops unit tests from
spawning real daemons. With this PR a daemon starts GAIA's Lemonade
Server in the real `~/.gaia`, so a test-spawned one would start and stop
the developer's server. Until that merges, this diff includes its
commit; review only the last commit here.

After a reboot, GAIA's own Lemonade Server is stopped, and every entry
point said "Lemonade not running" until you re-ran `gaia init`. Now the
daemon starts it when the daemon comes up, and again whenever a GAIA
command finds it stopped. Agents, the TUI's first-launch check (`gaia
init --check`) and the Agent UI just work after a restart.

The daemon is careful about what it stops. `gaia daemon stop` stops the
server only if that daemon started it, so one started by `gaia init`, by
hand, or by another daemon (a second one used for testing, say) keeps
running. It never kills a server that is slow to answer (it may be
loading a large model) and never replaces one running a different
version: it reports both and points at `gaia init`. With
`LEMONADE_BASE_URL` set it leaves Lemonade alone, and it never installs
anything.

A daemon from before this change doesn't have the new endpoint. Instead
of a bare 404, clients get "restart it with `gaia daemon restart`" (host
API bumped to 1.2).

## Test plan
- [x] `pytest tests/unit/test_daemon_lemonade.py
tests/unit/test_daemon_clock_wiring.py tests/unit/test_init_command.py
tests/unit/test_daemon_agents_routes.py`; `go test ./internal/gaiainit/
./internal/daemon/`
- [x] With `GAIA_HOME`, `GAIA_DAEMON_HOME` and `GAIA_CONFIG_DIR` in a
scratch dir and the server stopped: `gaia init --check` has a new daemon
start it and prints READY (1.4 s); `gaia daemon stop` then stops it
- [x] Server started with `gaia lemonade embedded start`, then `gaia
daemon start` / `gaia daemon stop`: the server keeps running
- [x] Server stopped: `LemonadeManager.ensure_ready()` gets it started
through the daemon, loads Gemma and returns True
- [ ] Windows and Linux: reboot, then launch `gaia-tui` without running
`gaia init`; it should go straight to chat



<details>
<summary>Terminal output: the reboot case on Apple Silicon (GAIA set up,
no daemon or server running)</summary>

```
$ gaia daemon status
GAIA daemon: not running
$ gaia lemonade embedded status
Running:   no

$ time gaia init --check --profile minimal
READY: profile 'minimal' is already set up
(exit 0, 1 s)
$ gaia lemonade embedded status
Running:   yes on http://localhost:59768/api/v1 (pid 88967)

$ time gaia daemon stop
✅ GAIA daemon stopped (pid 88966)
(5 s)
$ gaia lemonade embedded status
Running:   no
```
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…ade-onboarding

# Conflicts:
#	docs/plans/embedded-onboarding.mdx
#	src/gaia/installer/init_command.py
#	tests/unit/test_init_command.py
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

This PR is now empty — its branch tip is byte-identical to a commit already on main, so merging it would change nothing. The embedded-Lemonade init work it describes has already shipped, and PR 2 of the three-PR series (#4193) merged on top of it. Recommend closing as superseded.

The one finding left open from the last two reviews is a false positive and needs no follow-up anywhere.

🔍 Technical details

Empty diff, verified at the tree level. git diff origin/main...claude/embedded-lemonade-onboarding produces nothing. Branch tip d6f16ca8 has tree 9d8be0b1…, which is exactly the tree of the merge-base 4e28784ef ("feat(lemonade): scale the request budget…") — a commit already on main. The "28 commits ahead" are the repeated Merge origin/main commits plus feature commits whose content main now carries independently. GitHub's 0-files-changed is correct, not a data glitch.

Evidence the feature landed by another route: docs/plans/embedded-onboarding.mdx exists on main; src/gaia/installer/init_command.py on main has 33 embedded references and a complete _start_embedded_server; and #4193 ("feat(daemon): start GAIA's Lemonade Server on demand") — this PR body's "Next" item — is merged.

The version-mismatch install bug does not exist. The finding rested on is_installed() being version-blind: "checks only that daemon_path.is_file() exists, not the version." But daemon_path is itself version-scoped:

@property
def dist_dir(self) -> Path:
    return self.root / "dist" / self.version      # lemonade_embedded.py:361

@property
def daemon_path(self) -> Path:
    suffix = ".exe" if platform.system() == "Windows" else ""
    return self.dist_dir / f"lemond{suffix}"      # :396

After a version change, embedded.version is the new version, so dist_dir names a directory that does not exist yet, is_installed() returns False, and install() runs. main carries the rebuttal inline:

# is_installed() checks this version's own dist dir, so an older
# binary left on disk after a version change does not count.
if self.force_reinstall or not embedded.is_installed():

Both suggested fixes (Option A / Option B) would have forced a redundant re-download on every version change.

One part of that review does still hold and belongs on main, not here: test_older_running_version_is_replaced asserts stop and start but never asserts install was called, so it would not catch a genuine regression in this branch.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Closing as superseded — this branch is empty relative to main.

Verified: branch tip `d6f16ca8`'s tree hash is byte-identical to the merge-base with `origin/main` (`4e28784ef`), so there's no diff to land. The feature itself is already live on main — `src/gaia/installer/init_command.py` has a full `_start_embedded_server`, version-scoped via `dist_dir = root/"dist"/self.version` in `src/gaia/llm/lemonade_embedded.py` (so `is_installed()` is not version-blind, contrary to what the bot review assumed twice) — and this PR's own stated "Next" item, #4193, is merged.

Reopen if there's content here that genuinely isn't on main yet.

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

Labels

agent::email Email agent changes cli CLI changes devops DevOps/infrastructure changes documentation Documentation changes installer Installer changes llm LLM backend changes performance Performance-critical changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants