Repository navigation
fix(eval): verify which agent answered each eval scenario - #4092
Conversation
A scenario result recorded the agent the runner asked for, never the one
that ran. The ask is prompt prose ("you MUST pass agent_type=..."), and a
driver that drops the kwarg gets the backend default — so a run could
score ChatAgent while every result claimed the flagship.
The driver now returns its session_id, the runner reads that session back
over HTTP, and the result carries agent_type_requested alongside
agent_type_observed. A disagreement forces INFRA_ERROR: a score measured
against the wrong agent is not a score. Statuses that never produced a
measurement keep their own status, since they never created a session.
Over HTTP a dropped kwarg reads back as the string "chat", never null —
so a scenario legitimately requesting chat is the one case this cannot
tell apart. Tests pin both layers that launder it.
Closes #4069
urllib.request.urlopen trips bandit B310, and a nosec needs a justification entry to pass lint. The rest of the eval harness already uses requests for its Agent UI calls.
The provenance check fired on every scenario and failed any result with
no session_id, which broke 8 payload-parsing tests in tests/test_eval.py
and would have mislabelled real runs the same way.
Resolving the contradiction the check shipped with: the schema declared
session_id optional while the runner treated its absence as fatal. It is
conditionally fatal, and the condition is the scenario, which a static
schema cannot see — so the schema stays optional (a driver that aborts
before create_session has no id to give) and the runner owns the rule:
- No agent requested: check nothing. The backend default is correct by
definition, and this is what the 8 tests were exercising.
- Mismatch: always fatal. The score belongs to an agent nobody asked
for, whatever status it carried.
- Cannot verify (no session_id, or the read-back failed): this only
discards a score, so it downgrades PASS/FAIL to INFRA_ERROR and
leaves any other status alone with a provenance_warning.
That last rule is why BLOCKED_BY_ARCHITECTURE survives an unverifiable
result: it says something INFRA_ERROR does not, and an unreadable session
is no reason to throw that away. A mismatch still overrides it, because
"the architecture blocks gaia" is false if chat answered.
|
Verdict: Approve The fix is correct and the problem is real: a driver that silently drops The code is well-structured — three small, testable helpers, one injection point in Two nits: 🟢 🟢 🔍 Technical detailsForward reference ( Parametrize gap ( Both are 🟢 nits; neither is a merge blocker. |
The provenance guard read _NO_MEASUREMENT_STATUSES ~370 lines before the frozenset was defined, so nothing near the early return said which statuses trigger it. Moving the definition above the guard also lets the unmeasured-status test parametrize every member instead of three of five.
|
Both review nits are fixed, and the branch is now synced with The status set the guard checks is defined right above it instead of ~370 lines below, and the unmeasured-status test now covers all five members of that set rather than three. Test plan
🔍 Technical detailsEvidence captured on Nit dispositions:
No |
|
Merging. All 29 checks green on Three other open PRs also touch the eval runner — #4096, #4056 (draft), #3982 — so noting the order deliberately: this one lands first as the smallest and only ready+green of the four, and the others pick it up on their next sync. 🔍 Technical details
Overlap detail: #4056's branch already carries this PR's |
Resolves src/gaia/eval/runner.py against #4092 (0816b01), which added the agent-provenance check while this branch was making the flagship the agent every scenario runs as. The two are complementary: #4092 verifies which agent answered, this branch decides which one is asked for. Resolution keeps #4092's mechanism whole. Its _resolve_scenario_agent_type is restored at both call sites, and each site passes the value that helper computed rather than self.agent_type directly - otherwise _stamp_agent_provenance would compare a requested agent against a session created with a different one and report a mismatch that never happened. That reinstates the per-scenario YAML override this branch had removed in code, which is the better of the two: an override that exists and is honoured beats one silently ignored, and tests/unit/eval/test_scenario_agent_types.py already fails CI loudly if any scenario carries an agent_type key. Enforcement moves from silent to loud, which is the direction the no-silent-fallbacks rule points. The constructor default stays at DEFAULT_AGENT_TYPE rather than None, and that is now load-bearing for #4092 rather than just tidiness: _stamp_agent_provenance returns early when no agent was requested, so a null default would disarm the provenance check for every programmatic runner. Noted in a comment at the default so it does not get "simplified" back.
An eval run could score the wrong agent and nobody would know. The runner asks for an agent in prompt prose ("you MUST pass
agent_type=..."), and a driver that drops that kwarg gets the backend default instead — while the result still carries the requested id. So a run labelled as the flagship could be measuring ChatAgent, and every "no regression" claim resting on it would be measuring the wrong thing.Now the driver hands back its session id, the runner reads that session back from the backend, and a scenario result records what was requested and what was observed. A disagreement is an
INFRA_ERROR: a score measured against the wrong agent is not a score. Statuses that never produced a measurement keep their own status, since they never created a session to check.One case this cannot see: over HTTP a dropped kwarg reads back as the string
chat, never null, so a scenario that legitimately asks forchatis indistinguishable from a drop. Harmless for every non-chatscenario, which is the case the guard exists for — pinned by a test so it's read rather than rediscovered.The eval itself was not run, and this PR does not claim it was. The judge credential is dead repo-wide (#4080, Anthropic org spend limit) and the flagship has no committed baseline yet (#2983). The change is proven by unit tests over the provenance path instead.
Closes #4069
Test plan
python -m pytest tests/unit/eval/→679 passed, 1 skipped(18 of them new, intest_scenario_agent_provenance.py)python util/lint.py --all→[SUCCESS] ALL QUALITY CHECKS PASSED!test_dropped_kwarg_is_caught_and_fails_the_scenario, which is the exact bug — requestedgaia, session ranchat, result becomesINFRA_ERRORnaming both.🔍 Technical details
Run output:
Three sites coerce a missing/unknown agent type to
chaton the create→read-back path, and all three are left alone deliberately — the UI depends on them, and the fix belongs in the eval harness, not in session storage:database.pycreate_session— storesagent_type or "chat"utils.pysession_to_response+models.pySessionResponse.agent_type: str = "chat"— serialises a missing value as"chat"_chat_helpers.py— the runtime picks the agent from the same stored value, so the HTTP read-back reflects what actually answeredThe last two are why a naive
observed is Nonetest would never exercise the branch real code takes. Two tests pin them.Alias resolution goes through
AgentRegistry.canonical_idon an undiscovered registry — alias-only, no hub wheels needed — sodoc-litevsdocis not reported as a mismatch.