Repository navigation
test: cover every starting state against a recording model server - #7331
Conversation
In rc18 a cloud-only user had a 5 GB local model downloaded and loaded behind their back by the start-up warm-up, by Memory > Run Inference and by a scheduled run. Each bug fired only from one starting state, and every test had been written from a PC that was already set up. tests/fixtures/fake_lemonade.py is a model server that answers like Lemonade over real HTTP and writes down every request. The matrix crosses five starting states with three entry points and asserts what reached the server: no local chat model touched on a cloud setup, nothing downloaded unasked, and the local default used where that is right. Three cells fail on the open fixes for amd#7217 and amd#7218. Two fail on a bug the matrix found: a scheduled run ignores a cloud model picked in the app (amd#7329). All five are strict expected failures.
|
Verdict: Approve with suggestions This adds a fake Lemonade server that records every request, plus a test matrix that runs three entry points (start-up warm-up, Memory › Run Inference, scheduled run) from five starting states. It catches models being downloaded or loaded when the user never asked. It changes tests only, and I reproduced the claimed result: 10 passed, 5 xfailed. One thing worth fixing before merge: the five expected-failure cells count any exception as the expected failure. A broken import or a renamed function would still show as "known bug, still failing", so the cell would stop testing the bug without anyone noticing. Limiting them to assertion failures closes that gap. Merge order: #7270 and #7271 must land after this PR or edit its known-bugs list. Otherwise their fixed cells pass unexpectedly and turn the unit job red. Real-world evidenceN/A: tests-only PR. No user-facing surface changed, so the verdict rests on static review plus a local run of the new file: 🔍 Technical details🟢 Strict xfail also absorbs crashes, not just the bug ( Before I installed the flagship hub package, 🟢 Server thread leaks if saving the custom model fails ( The server is appended to Notes (no action needed)
Strengths
|
The unit job does not install the flagship package, so the start-up warm-up cells failed there with ModuleNotFoundError. They now skip when the package is absent, and test_gaia_agent.yml, the lane that installs it, runs the matrix so the column is still enforced.
installer/headless/fake_model_server.py already answers like Lemonade and logs every request, so the fixture now starts that server and reads its log instead of carrying a second one. It plays a PC whose only downloaded models are the ones a state names, and refuses a model that is not downloaded, so a request for one is counted as the download it would be on a user's PC.
The matrix's fixture starts installer/headless/fake_model_server.py, so a change to that file has to run the lane that runs the matrix.
…bug cells The fake server logs a stderr line per request into a pipe nobody read, so it stalled once the pipe filled: after 77 requests on Windows, ~700 on Linux. It now logs to a file in its own folder, and a test drives 200 KB of log through it. A known-bug cell now only passes as expected on an assertion failure, so a broken import or a renamed entry point fails loudly instead of reading as the bug. The scheduled run's refused load is the request the cell judges, so that refusal no longer ends the run before the assertion. The server is registered for teardown as soon as it starts.
# Conflicts: # .github/workflows/test_gaia_agent.yml
Every unit test indexes three files and stores five memories, and rc18 fell over at 300 of each: a folder index reloaded the embedder once per file, so 300 small files took 15 minutes, and a memory search over a few hundred rows ended the turn on a JSON error. This adds a scale run that does both at a real user's size on every release tag, with no model: the installer journeys' fake model server answers, and the test asserts counts of what GAIA asked it for. What it asserts: | At scale | Assertion | Today | |---|---|---| | large folder index | every file indexed, exactly one library row each | ✅ | | large folder index | the embedder is loaded at most twice, within a time budget | ✅ (fixed by amd#7310 while this was in review; it caught amd#7288, a reload per file, before that) | | search over 500 memories | the result can be sent as JSON | ✅ (fixed by amd#7308 while this was in review; the test caught it before that) | | 500 memories | the memory API reaches every one, page by page | ✅ | **Size:** 300 files, the size rc18 failed at. With amd#7310 in, they index in about 25 s against the fake server, well inside the 240 s budget; before it, 300 ran past 45 minutes on a hosted runner (that slowness was the bug). **Not built here, and why:** the 60-turn chat with the context meter compared to what the model is sent (F59) needs a real flagship turn loop behind the relay, and the memory page showing only 200 of 500 (F63) and duplicate rows from a re-add during indexing (F65) are a frontend bug and a race. Each has its own focused test in its fix PR (amd#7309, amd#7312, amd#7311); a scale version belongs with the Electron journey proposed in amd#7343. Stacked on amd#7331 (it uses that PR's `tests/fixtures/fake_lemonade.py`); the commits before "test: run GAIA at a real user's size ..." are that PR. ## Test plan - [ ] The new **Scale Run** workflow on this PR passes (4 passed) - [ ] Locally: `GAIA_SCALE_FILES=8 python -m pytest tests/integration/test_scale_run.py -q` passes - [ ] Runs on every `v*` tag (each RC and final) and on PRs that touch the test, its fixture or the workflow <details> <summary>🔍 Technical details</summary> - The folder is indexed once per run through `POST /api/documents/index-folder` with the real RAG code; the embedder's load and unload requests are read from the fake server's log. - The time budget (240 s) sits in the same expected-failure test as the load count, since the reloads are what make it slow. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
…d#7342) rc18 shipped four CLI bugs that one table could have caught: `gaia download --list` exited 0 with the model server down and listed every model as "not downloaded", `gaia prompt` printed its answer twice, and `gaia talk --index` and `gaia api start` sent requests to the default server instead of the one `--base-url` named. This adds that table. It reads every command from the CLI's own parser and runs each one for real, so a command or a `--base-url` flag added tomorrow is covered with no edit. What every command is held to: - **No traceback**, for all commands the parser registers, run with the model server down. - For every command that takes `--base-url`, plus a short list of flag variants the walk cannot reach (`download --list`, `prompt`, `llm`, `-p`): - with `--base-url X`, **every request goes to X** and none to the server the environment names; - the model's **answer is printed once**; - with the server down, a command that uses it **exits non-zero and says why**. **What its first run found** (155 cases, under three minutes in the new workflow): | Command | What happens | Issue | |---|---|---| | `gaia api start`, model server down | prints the error, exits 0 | **new: amd#7344** | | `gaia chat --base-url X`, `gaia -p ... --base-url X` | embedder, health and hardware calls still go to the default server | **new: amd#7345** | | `schedule show / remove / pause / resume / run <unknown>` | traceback | amd#7333 | | `connectors connect <unknown>` | traceback | amd#7334 | | `mcp engineering`, `mcp code-index` | refusal shown as a traceback | amd#7335 | | `gateway auth` with no terminal | traceback | amd#7336 | All twelve are strict expected failures naming the issue, so each fix has to delete its line. Stacked on amd#7331 (it uses that PR's `tests/fixtures/fake_lemonade.py`); the commits before "test(cli): ..." are that PR. ## Test plan - [ ] The new **CLI Contract** workflow on this PR passes - [ ] `python -m pytest tests/integration/test_cli_contract.py -k "download or prompt" -q` passes locally - [ ] Delete a `KNOWN_BUGS` line and the workflow fails with that command's own output in the message <details> <summary>🔍 Technical details</summary> - Each command runs as `python -m gaia.cli ...` in a throwaway home with stdin closed and a 25 s limit; one still running then (a server, a prompt) is ended with its children. A daemon a command starts in that home is stopped after the run. - Nine command groups are never started (`kill`, `uninstall`, `init`, `daemon`, `lemonade embedded`, `eval`, `test`, `telegram`, `slack`), each with the reason in `NEVER_STARTED`; a test fails if that table names a command that no longer exists. - `gaia gateway install` is outside the `--base-url` rule: its flag is the gateway's address, not the model server's. - It has its own workflow instead of joining the unit job: about 150 subprocess runs, on Linux only, and only when `src/gaia` changes. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
In rc18 a cloud-only user had a 5 GB local model downloaded and loaded without being asked: by the start-up warm-up, by Memory > Run Inference, and by a scheduled run. Each bug fired only from one starting state, and every existing test started from a PC that was already set up, with the client mocked. This adds a matrix that crosses five starting states with three entry points, runs each against the installer journeys' stand-in Lemonade over real HTTP, and asserts what actually reached that server.
A new starting state or entry point is one row; every combination is then covered, and a combination with no rule is an error.
default_modelThe two ❌ cells are strict expected failures naming the issue, so the fix has to delete its line. Three more cells failed when this PR opened (#7217, #7218); their fixes, #7270 and #7271, merged since, the strict markers tripped as designed, and those lines are gone.
New bug it found: #7184 made
gaia schedule runhonourdefault_model, but a cloud model picked in the desktop app is saved elsewhere, so a scheduled run for that user still loads (and downloads) local Gemma. Filed as #7329.Test plan
python -m pytest tests/unit/test_starting_state_matrix.py -qreports 14 passed, 2 xfailedKNOWN_BUGSand the failure prints the requests the server saw, ending inPOST /api/v1/load Gemma-4-E4B-it-GGUFtest_gaia_agent.yml, which now names this file🔍 Technical details
tests/fixtures/fake_lemonade.pystartsinstaller/headless/fake_model_server.py(the server the setup and installer journeys already use) and reads its request log intopulls,loads,chatsanddownloads. No second fake server. A load or chat asked of a model that is not downloaded counts as a download, because real Lemonade fetches it by itself.