Skip to content

fix(llm): stop telling users to run gaia download <model> - #4293

Merged
kovtcharov-amd merged 6 commits into
amd:mainfrom
kovtcharov:claude/lemonade-start-hint-runtime
Sep 26, 2026
Merged

kovtcharov-amd merged 6 commits into
amd:mainfrom
kovtcharov:claude/lemonade-start-hint-runtime

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

When a model was missing, GAIA told users to run gaia download <model>. The CLI rejects that with exit 2, so the only fix it offered couldn't work. The model-not-found and agent-builder errors now give the pull command for the user's actual Lemonade install, and the image-gen skill no longer tells the model to suggest the removed lemonade-server pull. A new guard test fails CI on any runtime string that names lemonade-server serve/pull, so these can't come back.

This covers the part of #4216 that no other PR does. The lemonade-server serve strings are fixed in #3122 (email agent, readiness, provider timeout, TUI, webui README, tests) and #4181 (hub gaia agent). The guard lists those files as pending. It fails whichever of those PRs merges second until its entries are removed from the list, which keeps the list from going stale.

Test plan

  • python -m pytest tests/unit/test_remedy_commands_are_runnable.py tests/unit/test_no_removed_lemonade_cli.py tests/unit/test_lemonade_error_classification.py tests/unit/agents/test_builder_model_selection.py -q: 7 failed on main before the fix, 107 passed after
  • Neighbouring tests (test_lemonade_launcher.py, test_sd_error_messages.py, test_llamacpp_backend.py, test_amd_gaia_urls.py): 197 passed in total
  • black, isort, and pylint (errors only) are clean on the changed files
  • gaia eval agent: the model-not-found text is returned as the agent's answer, and the image-gen skill text is shown to the LLM

Part of #4216

A missing model told users to run `gaia download <model>`, which argparse
rejects (exit 2), so the one remedy offered could never work. The model-not-found
and builder "no usable model" errors now name the pull command for the host's
Lemonade install via describe_client_hint(), and the image-gen skill no longer
tells the model to suggest the removed `lemonade-server pull`.

A new guard test fails on any runtime string in src/, hub/ or tui/ that names
`lemonade-server serve`/`pull`. Files whose fix is already in flight (amd#3122,
amd#4181) are listed as pending and must be removed from the list when those land.

Part of amd#4216
@github-actions github-actions Bot added llm LLM backend changes tests Test changes performance Performance-critical changes agents labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Request changes

This replaces the dead gaia download <model> advice with a pull command that matches whatever Lemonade the user actually has installed, and adds a guard test so the removed lemonade-server serve/pull commands can't creep back in. The change itself is correct and well-tested — two things to settle before merge.

The same dead command still reaches users from the flagship agent. The readiness endpoint of the hub gaia agent still tells people to run gaia download <model>, and its integration doc repeats it. The new guard can't catch either one, because the gaia download check only scans the core source tree while the new lemonade-server check scans core, hub and the TUI. Either fix those two sites here, or widen the older guard to the same roots and add them as pending entries — otherwise the PR's own stated goal is half-done and unprotected.

The project's eval gate hasn't run. This edits a LemonadeError subclass's user-facing text and a skill file the model reads, which CLAUDE.md lists as requiring a gaia eval agent run before merge. That box is unchecked in the test plan. Please run it (or say explicitly why it doesn't apply) rather than leaving it open.

Worth a look but not blocking: the builder's message now reads "For example: Run: …", and the pending-file check will crash rather than explain itself if one of the listed files gets renamed.

Real-world evidence

No evidence-bundle.md was produced for this PR. The changed surface is error text returned by the CLI and by agents, so the missing artifact is the rendered message and the eval run — the PR's test plan covers the unit layer and shows the eval item unchecked. I did independently re-run the new guard's scan logic against this checkout: 0 unlisted offenders, and all 15 pending entries still contain the removed CLI, so both new tests pass as written. Everything else here rests on static review.

🔍 Technical details

🟡 Important

1. gaia download <model> survives outside the guard's reach

Two live sites remain after this PR:

  • hub/agents/gaia/python/gaia_agent/server.py:546 — returned to the caller as the readiness hint when the model isn't present.
  • hub/agents/gaia/npm/SKILL.md:131.

_DEAD_DOWNLOAD in tests/unit/test_remedy_commands_are_runnable.py:268 walks only src/gaia, so neither is covered. The PR description attributes the hub gaia agent to #4181, but that's scoped to lemonade-server serve — gaia download isn't claimed by any of the linked PRs.

The new _SCAN_ROOTS = ("src/gaia", "hub", "tui") in test_no_removed_lemonade_cli.py:129 is the right shape; reusing it for the download guard closes the gap. server.py:546 can use the same helper this PR adopts elsewhere:

from gaia.llm.lemonade_launcher import describe_client_hint

hint = (
    f"The model {probe['model_id']} is not downloaded. "
    f"{describe_client_hint('pull', probe['model_id']).instruction.rstrip('.')}, "
    "then re-check."
)

2. gaia eval agent gate not satisfied

src/gaia/llm/providers/lemonade.py:189-206 changes LemonadeModelNotFoundError.user_message, which agents/base/agent.py hands back verbatim as the agent's answer, and hub/skills/image-gen/SKILL.md:96 changes text the model reads. CLAUDE.md lists both "Error classification (LemonadeError subclasses …)" and prompt/skill text as eval-gated. The deleted KNOWN_EVAL_GATED_SITES comment named this requirement explicitly for these exact two files — the allow-list is now gone, so the eval is the only thing left standing behind them.

🟢 Minor

3. Double colon in the builder remedy (src/gaia/agents/builder/agent.py:144)

describe_client_hint(...).instruction already starts with Run: , so the rendered string is … For example: Run: /usr/bin/lemonade pull <model>. And when no client resolves, the instruction is a full sentence ("<model> is not downloaded, and no Lemonade client CLI was found …"), which reads oddly after "For example:".

                f"one of: {candidates}. {pull.rstrip('.')}. Or run "

4. Pending-file check crashes on a rename (tests/unit/test_no_removed_lemonade_cli.py:224-230)

(_REPO / rel).read_text() raises FileNotFoundError if a listed file is moved or deleted by one of the in-flight PRs, hiding the actionable message.

def test_pending_entries_still_need_their_fix():
    """Once a pending file is fixed, its entry must go, or it hides a regression."""
    for rel in _PENDING:
        path = _REPO / rel
        assert path.exists(), f"{rel} no longer exists — remove it from _PENDING."
        assert _REMOVED_CLI.search(
            path.read_text(encoding="utf-8")
        ), f"{rel} no longer names the removed CLI — remove it from _PENDING."

5. _is_comment skips markdown bullets and headings (test_no_removed_lemonade_cli.py:185)

* and # are treated as comment markers, so in the .md files the guard scans — the majority of the hub surface — a * Run \lemonade-server pull x`bullet or a heading slips through. No current file uses that bullet style, so this is latent, not broken. Narrowing to("//", "/*")for.md, or matching #only for.py/.go`, would close it.

Note on merge ordering

_PENDING deliberately turns red when #3122 or #4181 lands without pruning its entries. That's a defensible tripwire and the docstring says so — just be aware it means main goes red on the other PR's merge, not on its PR CI, since the entry list lives on this branch. A line in each of those PRs' descriptions would save someone a confusing bisect.

Strengths

  • The guard pair is the right design: a scan test plus a check that every exemption still earns its place, so the allow-list can't silently rot. That's the same pattern this PR is retiring for gaia download, applied to the broader problem.
  • Routing every remedy through describe_client_hint means the message adapts to modern vs. legacy vs. no-client installs instead of hard-coding a binary — and the no-client branch degrades to a URL rather than inventing a command.
  • test_missing_model_remedy_pulls_with_the_resolved_client is parametrized across all three tooling states and asserts every emitted gaia … command parses against the real CLI parser — exactly the check that would have caught the original bug.

The flagship agent's readiness probe still told users to run `gaia
download <model>` when the model was missing — the exact dead command
this branch set out to remove — and its SKILL.md and two doc pages
repeated it. The guard could not see any of them: it scanned only
src/gaia/**/*.py, while the string that reaches the TUI's preflight
screen lives in hub/.

The hint now routes through describe_client_hint('pull', model) like
every other remedy, so it names the Lemonade client the machine has. The
guard scans src/gaia, hub, tui and docs, over every extension a
user-facing string ships in, and a second test asserts it actually
reaches those roots — a guard that scans the wrong tree passes while the
bug ships.

Also from review: the builder's remedy no longer reads "For example:
Run: ...", the pending-file check explains a rename instead of raising
FileNotFoundError, and markdown bullets/headings are no longer mistaken
for comments in the removed-CLI scan.
@github-actions github-actions Bot added the documentation Documentation changes label Sep 25, 2026
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Confirmed the finding and closed it: the flagship agent really did still hand users gaia download <model> when the model was missing — the same dead command this branch removes everywhere else — and its SKILL.md plus two doc pages repeated it.

The guard could not have caught any of them. It scanned src/gaia/**/*.py only, so the string that reaches the TUI preflight screen was outside its reach the whole time. It now scans src/gaia, hub, tui and docs across every extension a user-facing string ships in, and a second test asserts it actually reaches those roots — a guard aimed at the wrong tree passes while the bug ships.

On the eval gate: not needed for this round. These are error/doc strings, not agent-facing prompts or tool registration, and the previous round's LemonadeError and skill-text edits are unchanged here.

🔍 Technical details

Important 1 — remaining gaia download <model> sites (fixed).

  • hub/agents/gaia/python/gaia_agent/server.py — the readiness hint now routes through describe_client_hint("pull", model_id), so it names whichever Lemonade client the machine has.
  • hub/agents/gaia/npm/SKILL.md — points at gaia init and tells the assistant to repeat the command GET /v1/gaia/init returns rather than invent one.
  • docs/guides/gaia.mdx is the troubleshooting page for that exact hint, and docs/cpp/bash-agent.mdx carried the same dead form — both corrected in the same change, per the "update every doc that describes it" rule.

_PENDING in the removed-CLI guard is untouched: both hub files still name lemonade-server serve on other lines, which is #4181 / #3122 scope.

Minors 3, 4, 5 — all applied. The builder remedy drops the For example: Run: stutter; test_pending_entries_still_need_their_fix asserts existence first so a rename explains itself instead of raising FileNotFoundError; _is_comment no longer treats #/* as comment markers in .md, so a heading or bullet naming the removed CLI is caught.

Added test_flagship_readiness_hint_pulls_with_the_resolved_client (parametrized over modern / legacy / no-client) driving the real init() endpoint, and test_the_download_guard_actually_reaches_the_hub_and_the_docs.

Fail-without-the-fix check — reverting only the server.py hint:

4 failed, 28 passed   ← 3 readiness params + the static guard
restored → 32 passed
test_remedy_commands_are_runnable  test_no_removed_lemonade_cli
test_lemonade_error_classification  agents/test_builder_model_selection
test_sd_error_messages  test_amd_gaia_urls  test_agent_readiness  test_agent_server
→ 191 passed, 3 skipped
black + isort clean

tests/unit/test_lemonade_launcher.py has 7 macOS-path failures on this Windows host; identical set on unmodified main, so environmental.

Merged origin/main (clean) so the widened guard was validated against the current tree.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

CI note: the one red unit-test job is not from this branch. test_lemonade_server_process_lifecycle.py::test_launch_server_leaves_a_non_gaia_listener_running fails identically on main itself (run for 3e82b2b4a, all three OS lanes), and this branch inherited it by merging main. Nothing to fix here — it needs fixing on main.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 26, 2026
# Conflicts:
#	hub/agents/gaia/npm/SKILL.md
#	src/gaia/agents/builder/agent.py
hub/agents/gaia/npm/SKILL.md, SCORECARD.md, server.py, stdio.py and
gen_scorecard.py no longer name the removed lemonade-server CLI --
their fixes landed via amd#4181/amd#4293/amd#3122. Only the email-side entries
are still genuinely pending.
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 26, 2026
Merged via the queue into amd:main with commit 02b9eae Sep 26, 2026
44 of 45 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the claude/lemonade-start-hint-runtime branch September 26, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents documentation Documentation 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