Skip to content

test(eval): run a CI eval lane locally; stress corpus for hostile files - #4697

Merged
kovtcharov-amd merged 2 commits into
amd:mainfrom
kovtcharov:kalin/run-eval-lane-locally
Oct 4, 2026
Merged

kovtcharov-amd merged 2 commits into
amd:mainfrom
kovtcharov:kalin/run-eval-lane-locally

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

Running a gaia_* eval locally used to mean copying a few environment variables out of eval_flagship.yml, and it was easy to get it subtly wrong. Started from the checkout, the backend can't see the staged fixtures. Without the fake gh first on PATH, auto-approved triage scenarios send writes to real GitHub. The agent under test inherits the judge's credentials. util/run_eval_lane.py --lane <lane> reuses eval_lane_matrix.py's lane environment and repeats the workflow's setup, so a local score means what a CI score means.

util/stress_corpus.py generates the large and hostile files used to validate v0.25: a 1,667-page PDF with one buried fact, a 400k-row CSV, a 120 MB log, injection, UTF-16, a 5 MB single line, and hostile filenames. They found #4679, #4686 and #4688. Its answer key is refused if placed inside the corpus, because the agent's content search would otherwise find the answers there. CLAUDE.md and the testing skill point at both. CLAUDE.md also notes that worktrees share one stash list.

Test plan

  • pytest tests/unit/eval/test_run_eval_lane.py tests/unit/eval/test_eval_lane_matrix.py (67 passed)
  • python util/stress_corpus.py --out <dir> --answers <file> builds 110 MB, and refuses --answers inside --out
  • python util/check_doc_links.py, python util/lint.py --black --isort
  • python util/run_eval_lane.py --category gaia_honesty on a Strix Halo box produces a scorecard

…tile files

A hand-rolled local eval drifted from CI in ways that change scores or do
harm: the backend started from the checkout instead of the staged fixtures,
the real gh on PATH while gaia_* tool calls are auto-approved, the judge's
credentials inherited by the agent under test. util/run_eval_lane.py takes
the lane environment from eval_lane_matrix.py and repeats the workflow's
setup. util/stress_corpus.py builds the large and adversarial files that
found the v0.25 RAG, encoding and search bugs, with its answer key kept
outside the folder the agent searches. CLAUDE.md and the testing skill point
at both, and CLAUDE.md now warns that worktrees share one stash.
@github-actions github-actions Bot added devops DevOps/infrastructure changes tests Test changes labels Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This adds a script that runs a CI eval lane locally with CI's setup, plus a generator for large and hostile test files. Both are useful and the lane setup matches the workflow closely. One thing is worth fixing before people run it on their own machines: unlike CI, the lane script uses the developer's real GAIA profile.

  • Running a memory or gaia_* lane changes your own GAIA state. The script turns on the Agent UI memory switch and leaves it on, and the eval's memories go into your real store. CI does this on a dedicated runner, where it doesn't matter. On a dev box it does. Point the backend at a throwaway GAIA home under --out, or at least warn before it starts.
  • An interrupted gaia_mcp run leaves the test MCP servers registered in your real config. CI removes them in a cleanup step that always runs. The script removes them only after a normal finish, so Ctrl-C or a crash leaves them behind.

Real-world evidence

N/A: no evidence bundle for this PR. It adds dev tooling under util/, docs and unit tests, and changes no gaia CLI, API, MCP or Agent UI surface. The verdict rests on static review. The author's own Strix Halo item (run_eval_lane.py --category gaia_honesty produces a scorecard) is still unchecked.

🔍 Technical details

🟡 Lanes run against the developer's real ~/.gaia (util/run_eval_lane.py:189-227, 319-320)
plan() never sets GAIA_HOME, so the backend uses the user's real store: ui/database.py and agents/base/memory_store.py both resolve through gaia.config.gaia_home(). _enable_memory() then persists memory_enabled=true into that DB, and the memory and gaia_* lanes (GAIA_MEMORY_DISABLED=0, GAIA_MEMORY_ADMIN=1) write scenario memories into it. CI tolerates this because the runner's profile is disposable. Suggested fix: in plan(), set "GAIA_HOME": str(out / "gaia-home") (pass --out through) so a local run is hermetic. Note that stage_mcp_stub.py hard-codes Path.home() / ".gaia" (_config_path), so it would need to honor GAIA_HOME too. If isolation isn't wanted, document the side effect in the module docstring and print it at startup.

🟡 MCP stub isn't removed on an abnormal exit (util/run_eval_lane.py:324-338, 351-353)
eval_flagship.yml runs stage_mcp_stub.py remove in its finally for every fixtures lane ("never leave the stub registered"). Here remove runs only after the eval subprocess returns. A KeyboardInterrupt or exception in between leaves two entries in ~/.gaia/mcp_servers.json and connectors/activations.json, which widens the user's real flagship toolset.

    finally:
        if p["fixtures"]:
            subprocess.run([sys.executable, MCP_STUB, "remove"], cwd=REPO_ROOT, check=False)
        for child in children:
            _stop_tree(child)

🟢 No default-agent check, so a missing hub install exits 0 (util/run_eval_lane.py:319)
CI checks that DEFAULT_AGENT_TYPE appears in GET /api/agents before it spends the slot. Without that check, every scenario 422s into INFRA_ERROR, gaia eval agent still exits 0, and the script reports success. That undercuts "a local score means what a CI score means". Port the check after the health wait. CI's fixture-server readiness probe (/atlas.html) is missing as well.

🟢 _stop_tree doesn't stop the tree on POSIX, and can raise (util/run_eval_lane.py:356-368)
terminate() signals only the direct child. wait(timeout=30) raises TimeoutExpired with no kill() fallback, and inside the finally that also skips stopping the remaining children. Use start_new_session=True with os.killpg, or at least catch the timeout and kill().

🟢 Log file handles are never closed (util/run_eval_lane.py:296, 305)
stdout=open(...) is passed inline and never closed. Open the files in an ExitStack, or keep the handles and close them in finally.

🟢 40-level nesting exceeds Windows MAX_PATH (util/stress_corpus.py:502-506)
level00\ × 40 is about 320 characters before the base path. On a stock Windows install (long paths off), mkdir fails partway, the answer key is never written, and only a traceback is shown. Since the lanes and users are on Windows, use shorter segments (d00) or around 25 levels.

Strengths

  • The lane environment comes from eval_lane_matrix.lane_env, not a second copy, so the script can't silently drift from the CI matrix. The tests pin the two harmful drifts: fake gh first on PATH, and the backend cwd set to the staged fixtures.
  • Judge credentials are stripped from the backend's env, matching CI, and a backend already listening on the port is refused instead of reused. Both are good fail-loudly choices.
  • stress_corpus.py refuses an answer key inside the corpus. That's a non-obvious way for the test to prove nothing, and it's caught up front.

Two Lemonades on one machine share its GPU; a second eval on its own backend
still slows both and corrupts every timing. Never bypass the eval lock to run
beside another session's eval.
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 4, 2026
Merged via the queue into amd:main with commit fb70c19 Oct 4, 2026
@kovtcharov-amd
kovtcharov-amd deleted the kalin/run-eval-lane-locally branch October 4, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps/infrastructure changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants