Skip to content

chore(deps): bump Lemonade Server to v2026.39.1 - #4303

Merged
kovtcharov-amd merged 3 commits into
amd:mainfrom
kovtcharov:stack/2-lemonade-bump
Sep 25, 2026
Merged

kovtcharov-amd merged 3 commits into
amd:mainfrom
kovtcharov:stack/2-lemonade-bump

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Stack 3/7. Merge after #4304. GitHub will not let a PR here base on a fork branch, so all seven target main and this diff includes its parents' until they merge — this PR's own change is its top commit.

# PR What
1 #4302 CalVer parsing across every version gate
2 #4304 The doc gate learns pin vs floor
3 ← this PR The pin bump to v2026.39.1
4 #4305 Auto-bump workflow refreshes the digests
5 #4306 Candidate prereleases get smoke-tested
6 #4307 Request budget follows the window
7 #4308 Eviction policy is stated, not inherited

Moves the pin GAIA installs and tests against from v11.8.1, past v11.9.0, to the first CalVer release. #4302 taught the version gates to read that format; this moves the pin onto it.

The embeddable SHA-256 pins are keyed by a filename containing the version, so they go stale on every bump. Refreshed here, and verified two ways — hashed locally, and cross-checked against the digest GitHub publishes for each asset.

Minimum-version floors are deliberately untouched. "through Lemonade 11.8.1+" and "requires Lemonade 11.8.1 or later" name the release a feature first shipped in, not the pin, and git log -L confirms neither has moved since #3672 added them. Bumping one would turn a true statement into a false one.

Test plan

  • Cold embedded install end-to-end into an isolated GAIA_HOME — download URL, SHA-256 verification, unpack, server start, and a real generation through LemonadeClient on Gemma-4-E4B-it-GGUF
  • /api/v1/health reports 2026.39.1 and still carries all_models_loaded, the field GAIA reads
  • pytest tests/integration/test_lemonade_release_assets.py tests/integration/test_lemonade_embeddable_assets.py — live upstream checks against the new pin: all platform installers resolve, all four digests match
  • python util/check_doc_versions.py clean
  • CI green on the Windows/Linux runners, where gaia init actually installs
🔍 Two claims re-verified rather than bumped on faith

The macOS uninstall provenance and the TUI preflight launchd label both say they track the pin, so both were checked against the real v2026.39.1 .pkg rather than having a number swapped: every path and pkgutil identifier they name is unchanged (ai.lemonadeserver.server.*, /Library/LaunchDaemons/ai.lemonadeserver.server.plist, /usr/local/bin/{lemonade,lemond,lemonade-tray}).

Two stale pins here were invisible to util/check_doc_versions.py — it scanned only docs/ and cpp/, and only matched a v-prefixed version. They are fixed by hand in this PR; #4304 teaches the gate to see both classes so the next bump cannot repeat it.

@github-actions github-actions Bot added documentation Documentation changes llm LLM backend changes tests Test changes performance Performance-critical changes cpp agents agent::email Email agent changes tui Go terminal UI (gaia-tui) labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

The Lemonade pin moves to the first CalVer release, the embeddable download hashes are refreshed, and the version-comparison code learns to read the new format. I independently re-verified the risky parts of this bump and they hold up: all four SHA-256 digests match what GitHub publishes for the release byte-for-byte, the Ubuntu PPA has already published the new version for the series CI runs on, and the doc-version consistency gate passes clean. The parsing change is a real improvement — dev builds used to make the version check quietly give up and stop enforcing anything; now they compare properly.

One thing worth fixing before merge, and it's documentation rather than code: the C++ setup page and the C++ README give the same install instructions for the same demo, this PR edits both, and they now disagree with each other. The README correctly explains that there is no serve command any more and tells you how each platform actually starts the server. The site page, right below the freshly-bumped version number, still tells users to run that removed command — and uses it again in the requirements table as the way to check the version. So the rendered page now reads "install this brand-new release, then run a command that has been gone for nineteen releases." Copy the README's wording over.

Two smaller things I'd like considered, neither blocking:

  • The same six-line version parser now exists in six places, and this PR had to go back and fix a copy that was missed the first time. Two of those copies are frozen sidecars that genuinely cannot share code, but the other four can. Collapsing them onto one helper means the next upstream format change is a one-line fix instead of a six-file hunt with a test to prove nobody was forgotten.
  • The new parser is slightly less forgiving than the old one about stray leading whitespace. One of the six copies already guards against that; the other five don't. It's very unlikely to bite anyone, but the fix is free and makes all six behave the same.

Real-world evidence

No evidence-bundle.md was produced for this PR, so the automated evidence stage did not run here. This is a version-pin bump whose risk is concentrated in three verifiable facts, so I checked those three directly against upstream rather than resting on static review alone:

1. All four embeddable SHA-256 pins match the digests GitHub publishes for the release. Queried the release assets API for tag v2026.39.1:

lemonade-embeddable-2026.39.1-windows-x64.zip   | sha256:235c2361be3a9729a06b92c97e40a9530ebb8e5088bd3334524472d6da7fbbca
lemonade-embeddable-2026.39.1-ubuntu-x64.tar.gz | sha256:d93c8c726a2c27aa7dee92db9d26f8042cf4e93a67b9c6ca8def094da15bf92a
lemonade-embeddable-2026.39.1-ubuntu-arm64.tar.gz | sha256:4787c5a09dbf98b1e7d44fa7f499bbf57861e13539c78b0bab9bd0adb247acff
lemonade-embeddable-2026.39.1-macos-arm64.tar.gz | sha256:36c84d7805aa716d2c0cf88112ee88bdaded2ac86a905232c219fd5be4a96b65

All four are identical to the values in the diff. lemonade-server-minimal.msi and lemonade.msi are both present on the tag, so the Windows installer-build and CI-pin download URLs resolve.

2. The Ubuntu PPA has published the new version, so the Linux CI gate that refuses a pin users can't install will pass:

lemonade-server  2026.39.1~26.04  (resolute)
lemonade-server  2026.39.1~24.04  (noble)
lemonade-server  11.0.0~25.10     (questing)

CI runs on ubuntu-latest (noble), which is covered. Heads-up only: the 25.10 series is still on 11.0.0, so that gate would fail on a runner pinned to questing.

3. The doc-version consistency gate is clean:

[CHECK] Lemonade Server (expected: 2026.39.1)
  [OK] All references match
[OK] All documentation version references are consistent!

4. Parser behaviour, exercised directly. pytest isn't installed in this reviewer environment, so I could not run the new test file. Instead I compiled the four tuple-returning parsers out of their real source files and fed them the real version strings. All four agree on every case: 2026.39.1 → (2026, 39, 1), 2026.39.0~12.abc1234 → (2026, 39, 0), 11.9.0 → (11, 9, 0), not-a-version → None. The dev-build case is the one that used to return None and switch the gate off, so the fix does what it claims.

What I could not exercise here: gaia init actually installing on Windows/Linux, and the embedded install end-to-end. Those need the real runners, and the PR's own test plan leaves that box unchecked. My verdict on those rests on static review plus the upstream asset checks above.

🔍 Technical details

Issues

🟡 docs/cpp/setup.mdx and cpp/README.md now contradict each other on starting the server

Both files are edited in this PR and give the same install flow for the same C++ demo. cpp/README.md:49-51 is correct:

How the server starts depends on the install, and there is no cross-platform serve command — Lemonade removed the lemonade-server CLI in 10.7.

But docs/cpp/setup.mdx:93 (Windows) and :183 (Linux) still instruct lemonade-server serve, directly under the line this PR bumped to v2026.39.1. docs/cpp/setup.mdx:222 compounds it, listing lemonade-server --version as the way to verify the requirement. That binary doesn't exist on a current install, and CLAUDE.md calls this out by name ("Never tell anyone to run lemonade-server serve"), with describe_start_hint() in src/gaia/llm/lemonade_launcher.py as the runtime source of truth.

For the table row:

| [Lemonade Server](https://lemonade-server.ai) | 2026.39.1 | Windows: tray icon · Linux: `systemctl --user status lemond` |

For the two serve blocks, the cleanest fix is to replace each with the README's own paragraph (tray/Start menu on Windows, lemond systemd unit on Linux, LaunchDaemon on macOS) rather than a command — I've left those as prose rather than a suggestion because the fenced block nests.

Worth noting as a pattern, not per-line: lemonade-server serve also survives in docs/integrations/mcp.mdx, docs/integrations/vscode.mdx, src/gaia/apps/webui/README.md, and two hub SKILL.md/SCORECARD.md files. That's pre-existing debt and out of scope for a version bump — but it's a wide enough surface to deserve its own sweep, and a lint rule would stop it recurring.

🟡 Six copies of one parser, and the PR had to chase a missed one

src/gaia/agents/base/readiness.py:384, src/gaia/installer/init_command.py:1035, src/gaia/installer/lemonade_installer.py:137 and :307, src/gaia/llm/lemonade_client.py:4837 are all the identical expression, applied five times by hand. The new test file's own docstring admits the flagship copy "was missed on the first pass of exactly this change," and the test's structure — parametrizing over every copy so a partial fix fails — is a workaround for the duplication rather than a fix for it.

hub/agents/email/.../api_routes.py:394 and hub/agents/gaia/.../server.py:433 genuinely can't share code (frozen sidecars, no gaia.installer import). The four in-core copies can. gaia.llm.lemonade_launcher is already imported by lemonade_installer and is dependency-light, which makes it a natural home for one parse_version() the other three delegate to. Not blocking this bump; raising it so the next format change isn't a six-file hunt.

🟢 Whitespace tolerance regressed in five of the six copies

int(" 2026") succeeds; re.match(r"\d+", " 2026") returns None, so a leading-space version now yields None (indeterminate) where it used to parse. hub/agents/gaia/.../server.py:433 already does .strip(); the other five don't. Verified directly: " 2026.39.1" → None in all four tuple-returning copies, "2026.39.1\n" → (2026, 39, 1).

Reachability is low (the health endpoint returns clean JSON and _VERSION_RE yields clean digits), but parity is a one-word change:

        parts = version.strip().lstrip("v").split(".")[:3]

Same for init_command.py:1035, lemonade_installer.py:137/:307, lemonade_client.py:4837, api_routes.py:394.

🟢 A seventh copy of the parser, in CI, wasn't updated

.github/workflows/test_gaia_cli_linux.yml:126 still does tuple(int(p) for p in v.split(".")[:3]). It's safe today only by accident: dpkg_version is ~-split before it reaches parse(), and get_installed_version goes through _VERSION_RE, so neither ever hands it a suffix. But the new test's docstring claims "seven independent places" are covered and this is an eighth — giving it the same treatment keeps that claim true, and avoids a bare ValueError traceback replacing the step's carefully-worded error messages if a probe ever does surface a dev string.

🟢 _check_version_compatibility's catch-all still reports "compatible" on any parse failure

src/gaia/llm/lemonade_client.py:4870 — except Exception: return True. The new test test_client_gate_rejects_an_old_dev_build documents precisely why this mattered: the pre-fix code hit this branch and waved an old dev build through "for the wrong reason." The CalVer fix closes the dev-build case but the blanket handler remains for anything else malformed. CLAUDE.md's no-silent-fallbacks rule asks for these to be fixed when the file is touched — narrowing it to the parse call and logging the unparseable string would be enough.

Strengths

  • The hashes and the PPA were actually checked, not assumed. Both are the classic way a version bump breaks users days later, and both are verifiably correct here — I reproduced both independently.
  • The new test file targets the right failure mode. "A gate that returns None and therefore stops enforcing" is exactly the kind of regression that leaves a green suite behind, and pinning real observed version strings (rather than synthetic ones) is what makes it hold. Refusing importorskip for the sidecar copies — on the grounds that a silent skip is the bug being guarded against — is the right instinct, and the AST-compile workaround is correctly reasoned: conftest.py:38-46 does only add a hub agent to sys.path when it already resolves, so a plain import genuinely would fail in the unit-test job. It's unusual machinery, so the docstring explaining why it exists is doing necessary work.
  • Floors were distinguished from the pin rather than bulk-replaced. The three "11.8.1 or later" statements in tui/README.md, tui/internal/lemonade/cloud.go and docs/guides/ai-providers.mdx correctly stayed put, while docs/guides/npu.mdx moved — and git log -L confirms that line has tracked the pin on every previous bump (10.9 → 10.10 → 11.0 → 11.5 → 11.8.1), so bumping it is the established convention, not an oversight. Re-verifying the macOS pkgutil identifiers and the TUI launchd label against the real .pkg instead of swapping a number is the same discipline.

@kovtcharov

Copy link
Copy Markdown
Contributor Author

Fixed, and thank you for catching the serve contradiction — it was worse than inconsistent.

docs/cpp/setup.mdx told users to run lemonade-server serve directly under the version it had just told them to install, and again in the requirements table. CLAUDE.md names that command specifically as one never to print, and Lemonade removed it in 10.7. The page now carries the README's wording: how the server starts depends on the install, and there is no cross-platform serve command.

That page is in scope because this PR edits it. The same string survives in 77 other places under docs/ — playbooks, integrations, the glossary, a spec — which is a sweep of its own rather than something to bury in a version bump. I started fixing two of them and backed the changes out for that reason; filing it separately.

The parser consolidation happened — four in-core copies are now one in gaia.version, and leading whitespace parses again in all six. Both were raised by three reviewers independently, which was the argument.

🔍 One correction to this PR since your review

docs/guides/npu.mdx now goes the other way — v11.8.1+ back to v10.2.0+. That line is a minimum-version floor, but the doc gate could not tell a floor from a pin, so every previous bump marched it forward; it had drifted to claiming NPU support needs a release nine versions newer than the npu profile actually enforces. #4304 teaches the gate the difference, which is why it now sorts ahead of this PR in the stack.

Also useful, thank you: the note that the 25.10 PPA series is still on 11.0.0. CI runs noble, which is published, so this is unblocked — but it is the kind of thing that bites a runner pinned elsewhere.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 The prior review's main ask is only half-done: the Linux section of the C++ setup page still tells users to run lemonade-server serve. The Windows block was fixed (replaced with the PowerShell script), but the Linux equivalent at line 187–189 was left unchanged.

docs/cpp/setup.mdx:189 still reads:

lemonade-server serve

That binary hasn't existed since 10.7. On a current Lemonade install the Linux user should start the lemond systemd unit (systemctl --user start lemond), consistent with what cpp/README.md already says and what CLAUDE.md requires.

🔍 Technical details

docs/cpp/setup.mdx:187-191 (Linux tab, unchanged by this push):

    After installation, start the server:
    ```bash
    systemctl --user start lemond
    ```

The requirements table was updated from lemonade-server --version to lemonade --version — if lemonade also does not exist on a current install (the agent description says only LemonadeServer.exe, lemond, and the macOS LaunchDaemon), the table's How-to-verify column needs a different approach (e.g. systemctl --user status lemond on Linux, or checking the tray icon/service status on Windows). Worth confirming before merge.

@kovtcharov

Copy link
Copy Markdown
Contributor Author

Right on both counts — the Linux tab still had it, and I claimed otherwise. Fixed in 6cafd5c8.

I only replaced the Windows block and then ran a grep whose output I misread as empty, so "any lemonade-server serve left? → none" was wrong when I said it. There were two occurrences in that file. There are now zero.

The Linux block starts the systemd unit, matching cpp/README.md and describe_start_hint():

systemctl --user start lemond

On the verify column — lemonade --version is correct, so no change needed there. lemonade is the modern client; lemond is the daemon. GAIA reads the installed version with exactly that command (get_installed_version, "Modern: lemonade --version, real output: lemonade version 10.7.0"), and the launcher's own notes describe Linux as shipping /usr/bin/lemonade alongside /usr/bin/lemond. What no longer exists is lemonade-server — both its serve subcommand and, on a modern install, the binary.

🔍 Scope

This file is fixed because this PR edits it. The same string survives in 77 other places across docs/ — vscode, mcp, playbooks, glossary, specs — which is tracked separately as #4331 rather than folded into a version bump. I'd started fixing two of those and backed them out for that reason.

The four downstream PRs were rebased onto the corrected commit; the diff between the old and new bump tip is those two lines and nothing else.

@kovtcharov
kovtcharov force-pushed the stack/2-lemonade-bump branch from 6cafd5c to 207f7ac Compare September 25, 2026 07:54
Kalin Ovtcharov added 2 commits September 25, 2026 01:00
… gate

Lemonade v2026.39.1 changes the version format from X.Y.Z to YYYY.WW.N,
with development builds shaped YYYY.WW.0~<count>.<hash>, and its release
notes call out that anything parsing or comparing version strings has to
be updated.

A release CalVer already compared correctly by accident, since 2026 > 11.
Development builds do not: int("0~12") raises, and every one of GAIA's
version parsers turned that into None. Callers read None as "cannot
tell" and deliberately do not block on it, so the gates went quiet on
candidate builds with nothing saying so.

The Lemonade client was worse than quiet. Its handler returns
"compatible" when parsing fails, so an old development build such as
9.1.0~4.deadbee was waved through as passing rather than reported
unknown — the gate did not stop checking, it answered wrong.

There were six copies of the parser, and the first attempt at this
change missed one. The four in core are now one implementation in
gaia.version, which is where the constants they compare against already
live; the other two are vendored in the flagship agent and the frozen
email sidecar, which bundle only what is statically reachable and cannot
afford gaia.version's import-time metadata lookup. The tests read those
two out of their own source, and assert they still import re themselves
— the AST loader supplies it, so a deleted import would otherwise leave
every test green and the running server raising NameError.

Leading whitespace parses again too: int(" 2026") was valid where
re.match(r"\d+", " 2026") is not, which quietly narrowed what the old
code accepted.

This lands ahead of the version bump on purpose: the parsers have to
understand the new format before the pin moves to a release using it.
…lone

The v2026.39.1 bump had to hand-fix stale Lemonade pins the gate could
not reach: it scanned only docs/ and cpp/, and matched only a version
written with a "v" prefix. One of those pins lives in a Go source
comment in the TUI, so Markdown-only globs would miss it again.

Both halves are fixed. tui/ is scanned including its Go sources, and a
bare "Lemonade <semver>" is checked in the files that opt into
BARE_VERSION_PIN_FILES.

The gate also stops marching FLOORS forward, which it had been doing.
"v11.8.1+" means "that release or newer" — it names where a feature
first shipped — while a bare "v11.8.1" is the pin. The text pattern now
requires the absence of a floor marker, so the two stop being treated
alike.

src/**/*.py is deliberately not scanned. Source comments about Lemonade
are history or justification rather than pins: scanning src/ flags
exactly "Lemonade v10.1.0 changed its default port" and "EmbeddingGemma
is validated on Lemonade v10.9.0", both of which a bump must leave
alone, and nothing that needs to move.

The opt-in for bare versions is the same argument. Applied repo-wide the
pattern matches six things it must not touch for every two it should,
including the 127.0.0 inside an IP address, so the pattern carries its
own guards and the list is a second line of defence rather than the only
one.

The reachability test now asserts the stale FILES are scanned rather
than that their directories are listed — the earlier version passed
while the Go pin it described sat behind a Markdown-only glob.
@kovtcharov
kovtcharov force-pushed the stack/2-lemonade-bump branch from 207f7ac to 7665625 Compare September 25, 2026 08:00
@github-actions

Copy link
Copy Markdown
Contributor

🟡 The fix to the lemonade-server serve documentation swapped one broken command for another. docs/cpp/setup.mdx now tells Windows users to run .\installer\scripts\start-lemonade.ps1 -Port 13305 -NoModel "from the repo," but that script does not exist anywhere in cpp/ — there is no cpp/installer/ directory. A user following these steps would hit a missing-file error instead of a missing-binary error, which is no better than before.

The prose just above the code block already explains the correct Windows start path ("tray icon or the Start menu"). Drop the Start one from the repo paragraph and the code block that follows it — the tray/Start menu sentence is sufficient, and matches what cpp/README.md says.

🔍 Technical details

docs/cpp/setup.mdx:94-99 (added in this push):

On Windows you can also start one from the repo (this
restarts the server and frees its port first):

```powershell
.\installer\scripts\start-lemonade.ps1 -Port 13305 -NoModel

ls cpp/ contains CMakeLists.txt, README.md, agents/, benchmarks/, cmake/, examples/, include/, packaging/, src/, tests/, third_party/, triplets/, vcpkg.json — no installer/ directory.

The Linux fix on the same page (systemctl --user start lemond) is correct and needs no change. The Windows section just needs the dead PS1 block removed; the tray/Start-menu sentence above it is already the right instruction.

Moves the pin GAIA installs and tests against from v11.8.1, past
v11.9.0, to the first CalVer release. The version gates learned that
format first; this moves the pin onto it.

The embeddable SHA-256 pins are keyed by a filename containing the
version, so they go stale on every bump. Refreshed here, and verified
two ways — hashed locally, and cross-checked against the digest GitHub
publishes for each asset.

docs/guides/npu.mdx goes the OTHER way, from v11.8.1+ back to v10.2.0+.
That line is a minimum-version floor in a requirements list, but the doc
gate could not tell a floor from a pin, so every previous bump marched
it forward. It had drifted to claiming NPU support needs a release nine
versions newer than the one the npu profile actually enforces. The gate
now leaves floors alone, so this is the last time that number moves on
its own.

The C++ setup page told users to start the server with a command
Lemonade deleted in 10.7, directly under the version it had just told
them to install, and gave the same command again in the requirements
table. It now says what the README already said: how the server starts
depends on the install, and there is no cross-platform serve command.
That page is in scope because this change edits it; the same string
survives in 77 other places, which needs its own sweep.

The macOS uninstall provenance and the TUI preflight launchd label both
say they track the pin, so both were re-verified against the real
v2026.39.1 .pkg rather than bumped on faith: every path and pkgutil
identifier they name is unchanged. The preflight comment is now written
v-prefixed so the gate holds it to the pin instead of relying on someone
noticing.
@kovtcharov
kovtcharov force-pushed the stack/2-lemonade-bump branch from 7665625 to 8ba8a1c Compare September 25, 2026 08:06
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Removed — you're right that it doesn't belong on this page, though the premise needs one correction.

The script does exist, at installer/scripts/start-lemonade.ps1 in the repo root. What makes it wrong here is the relative path: this is a standalone setup guide, and its reader is working in cpp/ or may not have the GAIA repo cloned at all. Pointing them at a repo-root script is a dead end either way, so the block is gone and the tray/Start-menu sentence stands on its own — which is what cpp/README.md leads with too.

I brought that paragraph over from the README without noticing it carried an assumption about where you're standing. Fixed in 8ba8a1c4.

docs/cpp/setup.mdx now contains no lemonade-server serve and no path that doesn't resolve for its reader; the Linux systemctl --user start lemond is unchanged.

🔍 Note for cpp/README.md

The same relative path sits in cpp/README.md:56, which lives in cpp/ and says "from the repo". It resolves only from the repo root, so it has the same latent problem. Not touched here — this PR doesn't otherwise edit that block, and #4331 is already open for the wider docs sweep of Lemonade start instructions. Worth folding in there.

The four downstream PRs were rebased; the diff against the previous bump tip is this removal and nothing else.

kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Sep 25, 2026
… gate (amd#4302)

**Stack 1/7.** Merge this first. GitHub will not let a PR here base on a
fork branch, so all seven target `main` and this diff includes its
parents' until they merge — **this PR's own change is its top commit**.

| # | PR | What |
|---|----|------|
| 1 | **← this PR** | CalVer parsing across every version gate |
| 2 | amd#4304 | The doc gate learns pin vs floor |
| 3 | amd#4303 | The pin bump to v2026.39.1 |
| 4 | amd#4305 | Auto-bump workflow refreshes the digests |
| 5 | amd#4306 | Candidate prereleases get smoke-tested |
| 6 | amd#4307 | Request budget follows the window |
| 7 | amd#4308 | Eviction policy is stated, not inherited |

---

Lemonade v2026.39.1 changes the version format from `X.Y.Z` to
`YYYY.WW.N`, and its release notes say outright that anything parsing or
comparing version strings has to be updated. GAIA does that in **seven**
independent places.

A release CalVer already compared correctly by accident — `2026 > 11`.
Development builds do not: they are shaped `2026.39.0~12.abc1234`,
`int("0~12")` raises, and every parser turned that into `None`. Callers
read `None` as "cannot tell" and deliberately do not block on it, so the
gates went quiet on candidate builds with nothing saying so.

The Lemonade client was worse than quiet. Its handler returns
*compatible* when parsing fails, so an old development build like
`9.1.0~4.deadbee` was **waved through as passing** rather than reported
unknown — the gate did not stop checking, it answered wrong.

This lands ahead of the version bump on purpose: the parsers have to
understand the new format before the pin moves to a release that uses
it.

## Test plan

- [x] `pytest tests/unit/test_lemonade_calver.py` — 35 pass, and they
fail on the pre-fix tree (8 cases), so they are a regression gate rather
than a restatement of the implementation
- [x] Every copy is covered: the five tuple parsers by parametrization,
plus the two that compare instead of returning a tuple (the client's
gate and the flagship agent's) by their own cases
- [x] Passes with the pin still at 11.8.1, which is what makes this
mergeable on its own
- [x] `pytest tests/unit/test_init_command.py
tests/unit/test_lemonade_version_check.py
tests/unit/test_agent_readiness.py
tests/unit/agents/email/test_init_endpoint.py` — 254 pass
- [x] `black`, `isort`, `pylint` (CI's exact invocation) clean

<details>
<summary>🔍 Why seven, and why the hub agents are read from
source</summary>

The parsers: the base agent readiness probe, the Lemonade client's
compatibility gate, `InitCommand._parse_version`,
`LemonadeInstaller._parse_version`, `LemonadeInfo.version_tuple`, the
flagship GAIA agent's readiness server, and the frozen email sidecar.
The last two keep their own copies because neither can import
`gaia.installer`.

`LemonadeInfo.version_tuple` is shielded today — `check_installation`
fills `version` from `get_installed_version`, which already strips the
suffix — but that invariant lives two files away and callers construct
`LemonadeInfo` directly, so it is fixed too.

The tests compile the two hub-agent parsers out of their source with
`ast` rather than importing them. `gaia_agent` is not installed in the
unit-test CI job (the root `conftest` only puts a hub agent on
`sys.path` when its package already resolves), and the usual answer —
`importorskip` — would turn this file into a silent skip in CI, which is
the exact failure it exists to catch.
</details>

Co-authored-by: Kalin Ovtcharov <[email protected]>
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 25, 2026
Merged via the queue into amd:main with commit c5db215 Sep 25, 2026
102 of 104 checks passed
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Sep 25, 2026
…md#4304)

**Stack 2/7.** Merge after amd#4302. GitHub will not let a PR here base on
a fork branch, so all seven target `main` and this diff includes its
parents' until they merge — **this PR's own change is its top commit**.

| # | PR | What |
|---|----|------|
| 1 | amd#4302 | CalVer parsing across every version gate |
| 2 | **← this PR** | The doc gate learns pin vs floor |
| 3 | amd#4303 | The pin bump to v2026.39.1 |
| 4 | amd#4305 | Auto-bump workflow refreshes the digests |
| 5 | amd#4306 | Candidate prereleases get smoke-tested |
| 6 | amd#4307 | Request budget follows the window |
| 7 | amd#4308 | Eviction policy is stated, not inherited |

---

The v2026.39.1 bump had to fix two stale pins by hand because no gate
could see them: `util/check_doc_versions.py` scanned only `docs/` and
`cpp/`, and only matched a version written with a `v` prefix. A bump is
only as complete as the paths that gate can reach.

Both halves are fixed — `tui/` and `.claude/` are now scanned, and a
bare `Lemonade <semver>` is checked in files that opt in.

**The opt-in is the point.** A bare version is ambiguous in a way a
`v`-prefixed one is not. Applied repo-wide the pattern matches six
things it must not touch for every two it should: minimum-version
floors, the per-agent floor in a YAML example, a recorded observation in
an eval scorecard, and the `127.0.0` inside an IP address. Marching a
floor forward turns a true statement into a false one — worse than the
staleness this is meant to catch.

## Test plan

- [x] `pytest tests/unit/test_doc_version_gate.py` — 13 pass, covering
both directions
- [x] Planting a stale bare pin in each opt-in file is **caught** (exit
1, named correctly); the `tui` floor is **untouched**
- [x] Planting a `v`-prefixed stale pin in `tui/README.md` is caught —
the new scan path works
- [x] `python util/check_doc_versions.py` clean on the real tree
- [x] `black`, `isort`, `flake8` clean

<details>
<summary>🔍 The measurement behind the design</summary>

Running a naive bare-version pattern across the scanned corpus produced
8 matches, of which **6 were false positives**:

```
min_lemonade_version: "10.2.0"              # a per-agent floor in a YAML example
Lemonade **10.2.0** or newer                # a floor
against the 10.2.0 floor                    # a floor, in prose
lemonade_version: 10.8.0                    # a recorded eval-scorecard value
http://127.0.0.1:9099/api/v1                # not a version at all
```

So the pattern carries its own guards — whole-word anchor, no `:` or `=`
between the word and the number, not an IP octet, not followed by a
floor marker — and the opt-in list is the second line of defence rather
than the only one. The tests assert each of those shapes stays
unmatched.

One gap is deliberately left open: a bare `Lemonade <semver>` is still
invisible outside the opt-in files, even inside `docs/`. Closing it
properly needs a real pin-vs-floor marker, not a looser regex.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Sep 25, 2026
…#4305)

**Stack 4/7.** Merge after amd#4303. GitHub will not let a PR here base on
a fork branch, so all seven target `main` and this diff includes its
parents' until they merge — **this PR's own change is its top commit**.

| # | PR | What |
|---|----|------|
| 1 | amd#4302 | CalVer parsing across every version gate |
| 2 | amd#4304 | The doc gate learns pin vs floor |
| 3 | amd#4303 | The pin bump to v2026.39.1 |
| 4 | **← this PR** | Auto-bump workflow refreshes the digests |
| 5 | amd#4306 | Candidate prereleases get smoke-tested |
| 6 | amd#4307 | Request budget follows the window |
| 7 | amd#4308 | Eviction policy is stated, not inherited |

---

The scheduled Lemonade bump workflow edited `version.py` and the docs
but never touched `EMBEDDABLE_SHA256`, whose keys contain the version.
Every future run would therefore have opened a PR with four stale
digests — a broken `gaia lemonade embedded install` for anyone who took
it, and a guaranteed-red CI job on the PR itself.

The bump now rewrites those pins from the release API's own `digest`
field, with an instruction never to carry a value over or invent one,
and to stop rather than open a PR when an embeddable asset has no digest
published.

The cheap shell gate grew to match: it checks the four embeddable
archives alongside the two installers, and that each carries a `sha256:`
digest, *before* the paid model step runs. Catching a partial upload
there costs nothing.

## Test plan

- [x] Both new guards run against the real v2026.39.1 release under
`bash` (not zsh — `echo` mangles the JSON there and `jq` fails
misleadingly): all six assets present, all four digests published
- [x] `sort -V` still ranks the CalVer release above the last semver
one, so the "is it newer" guard survives the format change
- [x] YAML parses
- [ ] Next scheduled run, or a manual `workflow_dispatch`, opens a PR
whose digests match the release

<details>
<summary>🔍 Also corrected in the prompt</summary>

The agent is told the doc gate now reaches `tui/` and `.claude/`
(amd#4304), and — explicitly — that a minimum-version **floor** is never
bumped. The checker is built to skip those, so an agent "fixing" one the
gate stayed silent on would be introducing the exact error this stack
avoided by hand.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Sep 26, 2026
…ins (amd#4307)

**Stack 6/7.** Merge after amd#4306. GitHub will not let a PR here base on
a fork branch, so all seven target `main` and this diff includes its
parents' until they merge — **this PR's own change is its top commit**.

| # | PR | What |
|---|----|------|
| 1 | amd#4302 | CalVer parsing across every version gate |
| 2 | amd#4304 | The doc gate learns pin vs floor |
| 3 | amd#4303 | The pin bump to v2026.39.1 |
| 4 | amd#4305 | Auto-bump workflow refreshes the digests |
| 5 | amd#4306 | Candidate prereleases get smoke-tested |
| 6 | **← this PR** | Request budget follows the window |
| 7 | amd#4308 | Eviction policy is stated, not inherited |

---

Lemonade 11.9.0 replaced a fixed 120s prefill ceiling with a
configurable `global_timeout`, defaulting to 600s. GAIA took the
default, and at the window it pins the default is not enough: a long PDF
arrives as one large prefill, and 65536 tokens on a slow machine does
not finish inside ten minutes. The request dies and the answer comes
back truncated — the shape of amd#1030.

The budget is now derived from the context size rather than being a
second number that can drift from it. `GPU_CTX_SIZE`, `NPU_CTX_SIZE` and
`GAIA_CTX_SIZE` all move it: 32K gets 1024s, 64K gets 2048s, a short
window keeps upstream's 600s floor, and everything is capped at 3600s so
a wedged request still ends.

`GAIA_LEMONADE_GLOBAL_TIMEOUT` overrides it for a machine slower than
the assumed floor. An unusable value **raises** instead of falling back
to the derived number — a timeout that is quietly not the one you set is
worse than being told to fix it.

This applies to the embedded instance GAIA owns and writes config for. A
system-wide Lemonade install keeps its own settings.

## Test plan

- [x] **Verified against a real `lemond`**: it accepts the key, and
feeding it a non-number makes the server exit with `type must be number,
but is string` — so the value is genuinely parsed, not ignored as an
unknown field
- [x] GAIA's own restart writes `"global_timeout": 2048` on this
machine's GPU profile and the server comes up clean, with no complaint
in the log
- [x] `pytest tests/unit/test_lemond_request_budget.py
tests/unit/test_lemonade_embedded.py` — 68 pass
- [x] Covers the derived value at both pinned windows, the 600s floor,
the 3600s cap, a nonsense window, and every override shape including the
ones that must raise
- [x] `black`, `isort`, `pylint` clean

<details>
<summary>🔍 Where the divisor comes from</summary>

The budget is `ctx_size` over an assumed **floor** for prefill
throughput of 32 tokens/second, clamped to [600, 3600]. Deliberately
pessimistic: overshooting costs wall-clock only on a request that was
already failing, while undershooting truncates a real answer.

`write_config()` runs on every `start()`, so a device-profile or
`GAIA_CTX_SIZE` change moves the budget with it rather than leaving a
stale number in the file.
</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
…ses (amd#4306)

**Stack 5/7.** Merge after amd#4305. GitHub will not let a PR here base on
a fork branch, so all seven target `main` and this diff includes its
parents' until they merge — **this PR's own change is its top commit**.

| # | PR | What |
|---|----|------|
| 1 | amd#4302 | CalVer parsing across every version gate |
| 2 | amd#4304 | The doc gate learns pin vs floor |
| 3 | amd#4303 | The pin bump to v2026.39.1 |
| 4 | amd#4305 | Auto-bump workflow refreshes the digests |
| 5 | **← this PR** | Candidate prereleases get smoke-tested |
| 6 | amd#4307 | Request budget follows the window |
| 7 | amd#4308 | Eviction policy is stated, not inherited |

---

Lemonade v2026.39.1 started publishing candidate builds as GitHub
prereleases about a week ahead of the matching stable release. That same
release changed the version format to CalVer and silently switched off
GAIA's version gates — found by hand, after the fact, by reading the
release notes. `candidate-v2026.39.1` had existed for seven days.

A scheduled job now installs the current candidate's embeddable build —
a ~6 MB archive that runs as a plain subprocess, no installer and no
machine-wide state — and checks the contract GAIA actually depends on:
the reported version still reaches a real verdict through GAIA's gates,
and `/health` still carries the fields GAIA reads. Both are regressions
that already happened; `ctx_size` moved out of the top level in 9.1.4.

It **reports, it does not gate**. It runs on its own schedule, never on
a pull request, and a break files one rolling issue instead of one issue
per Friday. What GAIA pins is untouched — the bump workflow still tracks
`releases/latest` and still ignores prereleases.

## Test plan

- [x] **Run against the real `candidate-v2026.40.0`** — the next
Lemonade release, which exists now. It reports `2026.40.0`, the health
schema is intact, and the contract holds, so the next release does not
break GAIA
- [x] Candidate detection verified against the live API: resolves the
newest `candidate-v*` prerelease and its `ubuntu-x64` asset URL
- [x] `pytest tests/unit/test_lemonade_contract_check.py` — 11 pass, and
the suite **fails when the checker is gutted**, so it cannot launder a
break into a green job
- [x] Failure paths covered: an unparseable version, a missing version,
a version below the floor, and each dropped health key
- [x] `black`, `isort`, `flake8` clean; YAML parses

<details>
<summary>🔍 Two deliberate choices</summary>

**The check is a script, not inline YAML**, so it is testable and
runnable by hand: `python util/check_lemonade_contract.py
http://localhost:8000/api/v1`.

**An unparseable version is a FAILURE here**, even though every other
caller in GAIA treats it as non-blocking. Catching exactly that is the
entire job — a checker that shrugged at it would have passed the CalVer
switch.

It also grew `--api-key` / `$LEMONADE_API_KEY` support, because pointing
it at GAIA's own embedded instance returned 401 — found only by running
it against a live server rather than a fixture.
</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
…amd#4308)

**Stack 7/7.** Merge after amd#4307. GitHub will not let a PR here base on
a fork branch, so all seven target `main` and this diff includes its
parents' until they merge — **this PR's own change is its top commit**.

| # | PR | What |
|---|----|------|
| 1 | amd#4302 | CalVer parsing across every version gate |
| 2 | amd#4304 | The doc gate learns pin vs floor |
| 3 | amd#4303 | The pin bump to v2026.39.1 |
| 4 | amd#4305 | Auto-bump workflow refreshes the digests |
| 5 | amd#4306 | Candidate prereleases get smoke-tested |
| 6 | amd#4307 | Request budget follows the window |
| 7 | **← this PR** | Eviction policy is stated, not inherited |

---

Lemonade v2026.39.1 added VRAM auto-eviction. Its default today is off,
but it is a new knob and GAIA's residency model rests on which way it
points — so the value is now written into the config GAIA controls
rather than inherited from a release nobody has read yet.

**The policy is off, and that is a decision rather than caution.** GAIA
assumes a chat model and an embedder stay co-resident: `RAGSDK` scopes
its embedder unload so a global `/unload` cannot take the chat model
with it (amd#1544), the non-streaming path regained a reload check after an
embedder warm-up evicted the model (amd#1030), and `ModelSlotBroker`
serialises sidecar loads so they do not race the slot. Eviction under
VRAM pressure is that same failure arriving from underneath.

It is also the wrong trade here. Under pressure the choice is a loud
load failure or a silent eviction that resurfaces later as a cold reload
or a truncated answer — fail-loudly picks the loud one.

**Turning it on stays open**, and is a real option for VRAM-constrained
machines. amd#4170 asks for measurement on AMD GPU hardware first, and this
machine has none, so enabling it is not part of this change.

## Test plan

- [x] **Verified against a real `lemond`**: it accepts the boolean, and
a string makes the server exit with `type must be boolean, but is
string` — so the key is genuinely parsed rather than ignored
- [x] `pytest tests/unit/test_lemond_eviction_policy.py
tests/unit/test_lemond_request_budget.py
tests/unit/test_lemonade_embedded.py` — 72 pass
- [x] Tests assert the policy is *stated* (not merely
absent-and-defaulting), that it survives into the file lemond reads, and
that the private-instance settings are not clobbered
- [x] `black`, `isort`, `pylint` clean
- [ ] Revisit with VRAM-pressure measurement on AMD GPU hardware before
considering turning it on

<details>
<summary>🔍 Why the threshold is left unset</summary>

`auto_evict_threshold_pct` (0.9 upstream) is inert while eviction is
off, and writing it next to `auto_evict=false` reads as if it applies. A
test asserts it stays unset for exactly as long as the policy is off.

`tests/integration/test_lemonade_model_residency.py` already pins the
capacity accounting this depends on — `max_models` is per model type, so
an LLM plus an embedder need no tuning — and is the right place to
extend when enabling eviction is measured.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes agents cpp documentation Documentation changes llm LLM backend changes performance Performance-critical changes tests Test changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants