Skip to content

fix(eval): give gaia_* scenarios their staged files, keep answers out of reach - #4641

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/eval-backend-cwd-fixtures
Oct 4, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/eval-backend-cwd-fixtures

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

In the nightly eval, the agent could not read the files the gaia_* scenarios point it at, but it could read the scenarios' expected answers. Those lanes started the Agent UI backend from the repo checkout, and a session with nothing attached gets the backend's working directory as its file scope. So ~/gaia-eval/mini_repo and ~/gaia-eval/csv/sales.csv were "not in allowed paths": a user would approve the access prompt, but the eval can't. Meanwhile, every scenario YAML under eval/scenarios was in scope. After this change the backend runs from the staged ~/gaia-eval folder, and only the files a user would actually have are staged there.

Evidence from run 37110051697:

  • All of gaia_code (0/4) failed on access, e.g. code_find_class_method: "the path … mini_repo is outside allowed_paths, causing Access denied". Backend log: Not granting …\gaia-eval\mini_repo: tools are pre-approved, nobody asked.
  • data_region_breakdown, select_data_bundle, select_memory_vs_data, task_dataexplore_*, task_coding_mini_repo, voice_t2_code_plain_then_technical, mcp_builtin_fits_better: same access denial on ~/gaia-eval.
  • data_total_revenue: with the staged file blocked, the agent searched the checkout and answered from sales_data_2025.csv ($340,000 vs $18,600).
  • email_t1_read_offsite_details: "obtained this by reading the eval scenario YAML file (email_t1_read_offsite_details.yaml) via filesystem tools — not by reading Priya's email."
🔍 Technical details
  • _compute_allowed_paths (ui/_chat_helpers.py) returns {managed documents, cwd} when nothing is attached. Since feat(security): ask before denying a path outside the session's scope #4579, a pre-approved run denies every out-of-scope path without asking. test_gaia_agent_eval.yml's comment ("GaiaAgent pins allowed_paths=[home]") described a scope that no longer exists.
  • Backend -WorkingDirectory changes:
    • eval_flagship.yml: ~/gaia-eval for GAIA_FIXTURES=1 lanes only. The other lanes keep the checkout because their scenarios name eval/corpus/....
    • test_gaia_agent_eval.yml and gaia_scorecard_refresh.yml: ~/gaia-eval.
  • stage_eval_env.py now stages an allowlist: csv, mini_repo, media, capture (without _gen_*, ground_truth.json, __pycache__), plus documents/meeting_notes_q3.txt. GAIA_FIXTURE_VALUES.md lists that last file as staged, but nothing staged it; files_find_read_summarize only passed because the agent found the corpus copy in the checkout.
  • Not staged any more: email/ (the mailbox is read through GAIA_EVAL_MAILBOX), fake_gh/, fixture_hub/, web/, rss/, mcp_stub/, thresholds, README. Each of those is used from the checkout already.
  • gaia_scorecard_refresh.yml now calls stage_eval_env.py instead of its own copy of the steps. That copy also pre-installed rss-digest, which the contract says must start uninstalled.
  • Still failing by design: scenarios that write to the home folder itself (files_write_then_read, files_sandbox_refusal_system turn 3, web_download_file). feat(security): ask before denying a path outside the session's scope #4579 never offers the home folder as a grant, so those scenarios need re-pointing in a separate change.
  • Overlaps fix(eval): run the github-triage scenarios against the fake gh, not the runner's #4636 in stage_eval_env.py, eval_flagship.yml and test_gaia_agent_eval.yml. The conflicts are small; whichever merges second needs a rebase.

Test plan

  • pytest tests/unit/eval/test_stage_eval_env.py tests/unit/test_gaia_eval_fixtures.py: staging includes the agent-facing files and excludes anything that holds an answer.
  • Re-run eval_flagship.yml and confirm no Not granting …\gaia-eval\… lines in the gaia-* lanes' backend.out.log.
  • Categories to re-score: gaia_code, gaia_data, gaia_tool_selection, gaia_skills_tasks, gaia_mcp, gaia_voice, gaia_files, gaia_email, gaia_media, gaia_skills_capture.

…ers out of reach

A UI session's file scope, when nothing is attached, is GAIA's documents
folder plus the backend's working directory. The gaia_* lanes started the
backend from the repo checkout, so the files scenarios name under ~/gaia-eval
were "not in allowed paths" (and the eval cannot answer the approval prompt),
while every scenario's expected answer under eval/scenarios was readable.

The backend now runs from ~/gaia-eval in all three gaia_* workflows, and
staging copies only what a user would have there: sales.csv, mini_repo,
media, capture and the meeting-notes doc the contract lists. Ground truth,
generators, the fixture README and harness data are no longer staged. The
scorecard-refresh workflow now stages through the same script instead of its
own copy of the steps.
@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

In the nightly eval, the agent couldn't reach the fixture files the gaia_* scenarios point it at, but it could read the scenario files that hold the expected answers. This PR fixes both: the eval backend now starts inside the staged ~/gaia-eval folder, and only the files a real user would have are staged there. The change is small and well targeted. I checked the obvious ways a working-directory move could break things and found no problems.

  • Every ~/gaia-eval/... path the scenarios name (csv, mini_repo, media, capture, documents/meeting_notes_q3.txt) is still staged.
  • The scenarios that attach repo corpus documents (gaia_rag, select_rag_vs_raw_files) aren't affected. The runner indexes those documents by absolute path, and attached files get their own scope that doesn't depend on the working directory.
  • The mailbox, the MCP stub and the fixture server all use absolute paths, so moving the backend doesn't break them.

The real proof is the nightly re-run listed in the test plan. That item and the re-score are still unchecked, so check the gaia-* lanes' backend.out.log for Not granting …gaia-eval… lines before you trust the new scores.

Real-world evidence

N/A: this PR only changes CI workflows and test fixtures, and no evidence bundle was produced. The verdict rests on static review alone. The PR description cites the failing run (37110051697) that shows the bug, but no run after the fix has happened yet.

🔍 Technical details

Issues

🟢 Tests weren't run here. pytest isn't installed in the review sandbox, so this review didn't run tests/unit/eval/test_stage_eval_env.py. The author reports them passing, and CI will confirm.

🟢 The "nothing that holds an answer" test only checks the top level for stray .py and .json files (tests/unit/eval/test_stage_eval_env.py, staged.glob("*.py")). That's enough for today's allowlist. The _gen_* and ground_truth.json checks use rglob, so they already cover subfolders, which is where answers would actually leak.

Checked and fine

  • _compute_allowed_paths (src/gaia/ui/_chat_helpers.py) falls back to Path.cwd() only when no documents are attached, which matches the PR's reasoning. ~/gaia-eval is neither the home folder nor a root, so _unsafe_directory_grant_reason won't reject it.
  • eval_flagship.yml only moves the working directory for GAIA_FIXTURES=1 lanes. The non-fixture lanes still run from the checkout, which their eval/corpus/... scenarios need.
  • gaia_scorecard_refresh.yml now calls stage_eval_env.py. This also stops it pre-installing rss-digest, which matches the NOT_PRE_INSTALLED contract.
  • load_dotenv() only runs in cli.py, and the backend starts through python -m gaia.ui.server, so no .env lookup depends on the working directory.

Strengths

  • The allowlist plus the negative test turns "the agent can read the answers" from a convention into a regression test.
  • Folding the scorecard-refresh workflow onto the shared staging script removes a copy that had already drifted.
  • The PR description ties every claim to a specific failing scenario and log line.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 4, 2026
Merged via the queue into amd:main with commit 6620d5d Oct 4, 2026
@kovtcharov-amd
kovtcharov-amd deleted the kalin/eval-backend-cwd-fixtures branch October 4, 2026 11:24
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