Skip to content

fix(gaia-agent): stop pointing users at the removed lemonade-server CLI - #4181

Merged
kovtcharov-amd merged 5 commits into
amd:mainfrom
kovtcharov:kalin/gaia-agent-lemonade-start-hint
Sep 26, 2026
Merged

kovtcharov-amd merged 5 commits into
amd:mainfrom
kovtcharov:kalin/gaia-agent-lemonade-start-hint

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

When Lemonade was down, the flagship agent told users to run lemonade-server serve, a command current Lemonade installs don't have (10.7/10.8 removed it), so the fix it offered was a dead end. The readiness check (GET /v1/gaia/init), run errors, and /model errors now give the start step for the user's own install (tray app, macOS app, systemd service, or CLI). SKILL.md's sample response and the scorecard recipe match the new wording.

Test plan

  • pytest hub/agents/gaia/python/tests: 471 pass. 3 fail identically on unmodified main (tool-count checks affected by optional deps in the local venv).
  • New test_lemonade_start_hint.py checks the /v1/gaia/init hint and run errors use the resolved start instruction and never name lemonade-server serve.
  • python util/lint.py --all: black and flake8 pass. isort and pylint findings are all in src/gaia/tests, which this PR doesn't touch.
  • With Lemonade stopped, curl -s http://127.0.0.1:8141/v1/gaia/init | jq .hint shows this machine's start step.

…r CLI

When Lemonade was down, the flagship agent told users to run
`lemonade-server serve`, a command Lemonade 10.7/10.8 removed. The
`GET /v1/gaia/init` hint, run errors, and `/model` errors now use
describe_start_hint(), which gives the start step for the user's own
install (tray app, macOS app, systemd service, or CLI).

SKILL.md's sample /v1/gaia/init response and the scorecard reproduction
recipe are updated to match, and the CHANGELOG has an entry.
@github-actions github-actions Bot added the sidecar Agent sidecar contract / harness label Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Approve with suggestions

This replaces the hard-coded lemonade-server serve advice in the flagship agent's "Lemonade isn't reachable" messages with an instruction resolved from whatever Lemonade the user actually has installed. It's the right fix in the right place — it reuses the existing shared resolver instead of inventing new copy — and the docs and scorecard recipe were updated alongside it.

One thing to fix before merge: the /model command still sends users to a second removed command. The PR fixes the "Lemonade is unreachable" branch, but the "you asked for a model that isn't downloaded" branch right below it still tells users to run a Lemonade CLI that modern installs don't ship. There's already a resolver helper for the download case, the same way this PR used one for the start case.

Worth knowing: the same dead command is hard-coded in about six places in the email agent (its API errors, its playground page, its SKILL and scorecard). Out of scope for a fix(gaia-agent) change, but it's the identical bug and deserves a follow-up issue.

Real-world evidence

No evidence bundle was produced for this run, and the PR's own test plan leaves the one item that would prove the fix — checking the readiness hint with Lemonade stopped — unchecked. This change is user-visible copy on an HTTP endpoint and on CLI-facing error output, so the matching evidence is the real request and its response; unit tests gate the string assembly, not what a user sees. Please paste the actual output of that check into the description. My verdict otherwise rests on static review alone.

🔍 Technical details

Issues

🟡 /model still names a removed CLI in its unknown-model branch (hub/agents/gaia/python/gaia_agent/stdio.py:593)

The unreachable branch of _lemonade_models was fixed, but _apply_local_switch still emits "(none — run `lemonade-server pull <model>` first)". describe_client_hint() in lemonade_launcher.py:389 exists for exactly this and resolves the installed client (lemonade pull on modern, lemonade-server pull on legacy, prose + download URL when nothing is found). Not a regression — but the PR description claims /model errors now resolve for the host, and this branch doesn't.

                else f"(none — {describe_client_hint('pull', target).instruction})"

…with describe_client_hint added to the existing gaia.llm.lemonade_launcher import. Worth a test in the new file mirroring test_lemonade_models_unreachable_names_url_and_fix.

🟡 Missing endpoint evidence — see the visible section. curl -s http://127.0.0.1:8141/v1/gaia/init | jq .hint with Lemonade stopped, pasted into the description, closes it.

Nits

🟢 The appended period lands on a bare command (stdio.py:105-109). On modern Linux the hint is Run: systemctl --user start lemond, so the helper renders …start lemond. and a user double-clicking to copy takes the dot with them. StartHint already distinguishes the two cases via command, so punctuate only the prose form:

def lemonade_start_instruction() -> str:
    """How to start Lemonade on this host, as one complete sentence."""
    hint = describe_start_hint()
    instruction = hint.instruction.rstrip()
    # A trailing period after a bare command gets copy-pasted with it.
    if hint.command is not None or instruction.endswith((".", "!", "?")):
        return instruction
    return f"{instruction}."

🟢 Shared user-facing helper lives in the stdio transport module (stdio.py:90, imported at server.py:46). The HTTP server now depends on the stdio CLI module for a string. No cycle today, but a small neutral module (or entry.py) is a more durable home if a third caller appears.

🟢 Two env vars in one breath (server.py:535-538). When nothing is installed the hint reads …or set LEMONADE_SERVER_PATH to an existing install. Or set LEMONADE_BASE_URL to a running server. Two similarly-named knobs back to back is easy to misread; consider dropping the LEMONADE_BASE_URL clause when the resolver already reports "not installed".

Strengths

  • Reuses describe_start_hint() rather than adding another hard-coded string — exactly the pattern CLAUDE.md asks for, and it means Windows/macOS/systemd/legacy hosts each get a command that exists.
  • The new test asserts the resolved instruction and the absence of the removed CLI, and test_init_hint_never_names_the_removed_cli_unpatched guards the unmocked path — that's the boundary-validity check, not just "we called it".
  • Docs moved with the code: CHANGELOG, SKILL sample response, and the generated scorecard recipe all match the new wording, and gen_scorecard.py was updated so the next regeneration doesn't reintroduce the old line.

# Conflicts:
#	hub/agents/gaia/npm/CHANGELOG.md
#	hub/agents/gaia/python/gaia_agent/server.py
`/model <unknown>` with nothing downloaded still hard-coded
`lemonade-server pull <model>` — the other half of the CLI Lemonade
10.7/10.8 removed, and the same dead end this branch set out to delete.
It now goes through `describe_client_hint("pull", ...)`, which names the
client the host actually has and substitutes the real model id.

Two tests cover it: one pins the resolved wording, one asserts the
unpatched path still substitutes the model name (a legacy install
legitimately resolves to `lemonade-server pull`, so the literal
`<model>` placeholder is the tell, not that command's absence).
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Fixed the /model branch the review flagged, and merged main to clear the conflict.

/model <unknown> with nothing downloaded was still telling users to run lemonade-server pull <model> — the other half of the CLI Lemonade 10.7/10.8 removed, so the one branch this PR left behind pointed at exactly the kind of dead end it set out to delete. It now names the download command the host actually has.

🔍 Technical details

Fix — stdio.py:616 routes the empty-model-list branch through describe_client_hint("pull", target) (already imported alongside describe_start_hint), so a modern install gets lemonade pull <id>, a legacy one lemonade-server pull <id>, and a host with no client the prose + download URL. .rstrip(".") keeps the outer sentence from double-punctuating the prose form.

Tests — two new cases in test_lemonade_start_hint.py:

  • test_unknown_model_error_names_the_host_pull_instruction pins the resolved wording with a patched hint.
  • test_unknown_model_error_is_resolved_not_hard_coded runs unpatched. Note the assertion is not "lemonade-server pull is absent" — a legacy host legitimately resolves to that command, so that check would have been wrong. The tell is that the model id is substituted; the hard-coded copy emitted a literal <model>.

Both fail on the pre-fix line and pass after:

reverted to hard-coded string
FAILED test_unknown_model_error_names_the_host_pull_instruction
FAILED test_unknown_model_error_is_resolved_not_hard_coded
2 failed, 4 passed
$ pytest hub/agents/gaia/python/tests/
516 passed in 467.99s

The 3 failures the description noted as also failing on main are gone after the merge. python util/lint.py --black --isort --fix: clean.

Merge — origin/main merged in; two conflicts (npm/CHANGELOG.md, server.py imports), both purely additive, resolved by keeping both sides. Repo-wide grep for conflict markers is clean and all touched .py files AST-parse.

Not addressed here (unchanged from the review): the lemonade_start_instruction punctuation nit, the helper's home in the stdio module, and the double-env-var wording. The email agent's ~6 copies of the same dead command remain out of scope for a fix(gaia-agent) change.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 26, 2026
Merged via the queue into amd:main with commit 0cba774 Sep 26, 2026
29 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/gaia-agent-lemonade-start-hint branch September 26, 2026 03:44
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Sep 26, 2026
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 added a commit to kovtcharov/gaia that referenced this pull request Sep 26, 2026
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 amd#4216 that no other PR does. The
`lemonade-server serve` strings are fixed in amd#3122 (email agent,
readiness, provider timeout, TUI, webui README, tests) and amd#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
- [x] `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
- [x] Neighbouring tests (`test_lemonade_launcher.py`,
`test_sd_error_messages.py`, `test_llamacpp_backend.py`,
`test_amd_gaia_urls.py`): 197 passed in total
- [x] 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 amd#4216

---------

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

sidecar Agent sidecar contract / harness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants