Skip to content

test(agent): replay recorded turns through the answer checks - #7328

Merged
kovtcharov-amd merged 7 commits into
amd:mainfrom
kovtcharov:kalin/ci-answer-check-corpus
Nov 12, 2026
Merged

kovtcharov-amd merged 7 commits into
amd:mainfrom
kovtcharov:kalin/ci-answer-check-corpus

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

The rc18 release test found seven cases where GAIA's own answer checks got a turn wrong: a correct read-only answer ended with "I couldn't confirm all of this", a plan the user asked for was thrown away, an unanswered question became the user's answer. Each check had unit tests and none caught these, because every case needed the request, the tool results and the answer together. This adds a corpus of recorded turns and one test that replays each through the real loop with no model, so a misfire seen once in a release test becomes a file that guards it for good.

Seeded with 16 turns: a "must not fire" and a "must fire" case for each of F8, F10, F11, F12, F36, F80 and F81. Adding a case is adding a JSON file; the README beside the cases says how to make one from a transcript.

Bugs it found (a bug still open is a strict expected failure, so the fix has to delete the marker):

Case Issue Fix
Read-only answer that says "I wrote no file" gets the unsaved-file note #7178 #7276 (merged, marker removed)
Answer quoting an edit's own backup path gets the note #7179 #7277 (merged, marker removed)
A plan the user asked for is sent back as unfinished work #7180 #7278 (merged, marker removed)
"Do NOT run anything" is answered with GAIA's own "look first" message #7181 #7278 (merged, marker removed)
A native tool call is shown as answer text #7205 #7248 (merged, marker removed)
A fixed test's rerun with a different tail reads as an unpassed check #7293 #7319 (merged, marker removed)
A file a script wrote beside its input is called unwritten #7293 #7321 (merged, marker removed)
Silence after a question is handed to the model as the user's answer #7294 #7322 (merged, marker removed)
New: "I also saved it to X" with no write gets no note #7326 none yet

I replayed the corpus on each fix branch: every case passes there, so the markers come off as those PRs land.

Test plan

  • python -m pytest tests/unit/agents/test_answer_check_corpus.py -q reports 17 passed, 1 xfailed
  • Delete the "xfail" line from any case and the test fails with the note or nudge the tester saw
  • Runs in the existing unit job (test_unit.yml runs tests/unit/), no workflow change needed
🔍 Technical details
  • kind: "turn" builds a bare Agent whose tools are stand-ins returning the recorded results (and writing the files the real call wrote, since the checks stat the disk), scripts the model's replies, and runs process_query.
  • kind: "stream" feeds recorded provider chunks to AgentSDK.send_messages_stream (F36 lives below the loop).
  • kind: "question" calls the flagship's real request_user_input with a console that answers or stays silent (F81 is the tool's contract, not a check).
  • Unknown keys in a case are an error, so a typo cannot turn an assertion off.

The release test of rc18 found seven cases where GAIA's own checks added a
false note or nudge to a correct answer, and unit tests of each check had not
caught any of them: every one needed the real loop, the request, the tool
results and the answer together.

Each file in tests/fixtures/answer_check_corpus is one such turn. One
parametrized test replays them with no model and asserts the note, the nudge,
or their absence. Seeded with a must-fire and a must-not-fire turn per finding.
Turns that fail today are strict expected failures naming the issue and the
open fix, so the fix has to delete the marker.

The corpus also found a made-up save that gets no note ("I also saved it to
X"), filed as amd#7326.
@github-actions github-actions Bot added the tests Test changes label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This adds 18 recorded turns that replay through GAIA's real answer checks with no model, so each answer-check misfire from the rc18 release test becomes a lasting test. The nine known bugs are strict expected failures, so each fix PR has to remove its marker, which keeps the corpus honest. Nothing blocks merge. The two suggestions below are small accuracy fixes: one in the test plan, one in the test's stand-in for the chat window.

Real-world evidence

N/A: this PR only adds tests and fixtures, and no evidence bundle was produced. I couldn't run the suite either, because this runner has no Python env with pytest, so the verdict rests on static review alone. For F81, I checked open fix PR #7322's diff against the fixture. Its unanswered-question result starts with __NO_RESPONSE__ and no longer hands back the default, so that strict-xfail marker will flip as the PR description says.

🔍 Technical details

Issues

🟢 The test plan's pass count is off. There are 18 case files, 9 with "xfail", plus the two corpus-hygiene tests (test_every_case_file_is_collected, test_a_path_in_a_recording_is_portable). The run should report 11 passed, 9 xfailed, not "9 passed, 9 xfailed". A reviewer checking the first box will see a mismatch.

🟢 The stand-in console handles an empty-string default differently from the real one (tests/unit/agents/test_answer_check_corpus.py, _Console.request_user_input_blocking). The real transport (src/gaia/ui/sse_handler.py:2478-2482) returns the default whenever it is not None. The stub uses or, so "" becomes __NO_RESPONSE__. No current fixture hits this, but a future "question" case with an empty default would replay something the product never does.

        if self.reply is None:
            # Nobody answered: the window hands back the default, or the marker.
            if default_if_no_response is not None:
                return default_if_no_response
            return "__NO_RESPONSE__"
        return self.reply

🟢 The time.sleep(0.05) calls around creates depend on how precisely the filesystem records modification times. Write evidence compares st_mtime_ns and ctime against time.time_ns() taken at executor start (completion.py _stamp/snapshot). That works on ext4 and NTFS, but on a filesystem that records times only to the second it could misread a created file. It's acceptable for CI. If it ever flakes, the one-line comment is the place to say why.

Checks run

  • Sibling paths: under the 200 changed-code-line threshold for test logic. Fixtures only. No production code touched.
  • Known bug classes: the "Model output handling" (F36) and "Dishonest status" (F8/F10/F80) classes are exactly what this corpus guards, which is a good fit.
  • Doc drift: no docs describe this test, and nothing old was removed.

Strengths

  • Strict xfail with the issue and fix PR in the reason means a fix can't land without deleting its marker, and the marker can't go stale silently.
  • Schema validation in _load (unknown keys fail loudly) and the stray-extension and portable-path guards stop a malformed or machine-specific recording from quietly never running.
  • Each finding has a paired "must fire" and "must not fire" case, which pins both sides of every check instead of only the regression.

kovtcharov and others added 4 commits November 11, 2026 23:10
The unit job does not install the flagship package, so the case that calls
its real request_user_input failed there with ModuleNotFoundError. That case
now skips when the package is absent, and test_gaia_agent.yml, the lane that
installs it, runs the corpus so the case is still enforced.
amd#7276, amd#7277, amd#7278, amd#7248, amd#7319 and amd#7322 merged, so their seven strict
expected failures now pass and would turn the unit job red. The two left
(amd#7321 open, amd#7326 unfixed) still fail as recorded.

The stand-in console now returns an empty-string default the way the real
transport does, instead of reading it as no default.
@github-actions github-actions Bot added the devops DevOps/infrastructure changes label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

🟡 The F80 "script output saved beside its input" case will turn the unit job red as soon as this PR meets current main. Its fix, #7321, merged at 09:30 UTC today, after this branch last merged main. The case is still marked as a strict expected failure, so once the fix is in, the case passes and pytest reports that unexpected pass as a failure. The pull-request CI run tests the merge with main, so it hits this too.

Please merge main again, drop that case's xfail marker, and re-run the corpus test. Only save-claim-with-also-is-noted (#7326, no fix yet) should still be an expected failure.

🔍 Technical details

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 12, 2026
Merged via the queue into amd:main with commit eb374cb Nov 12, 2026
24 of 27 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/ci-answer-check-corpus branch November 12, 2026 10:58
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