Repository navigation
fix(agent): don't count an edit's own backup as a claimed save - #7277
Conversation
Before: after a successful edit, an answer that repeated the edit tool's "a backup was written to ...\todo.txt.<stamp>.bak" line ended with "No successful write to \?\c:\...\.gaia\cache\backups\...bak is recorded for this turn", or the re-prompt behind it made the model warn the user about a "suspicious" message. After: the backup GAIA made is recognised as the tool's by-product and the answer goes out clean. The completion ledger now remembers each backup_path a write tool reports and drops those paths from the answer's claimed outputs, matching by file name too because answers shorten the backup folder. Any other path in the same sentence, and any .bak no tool reported, is still checked. Closes #ISSUE
|
Verdict: Approve After an edit, an answer that repeated the edit tool's own backup path got a false "No successful write to ...bak is recorded" footer and a suspicious-sounding re-prompt. This PR stops counting a backup that a write tool reported as an output the turn owed. Any other path in the same answer, and a The PR is a draft until the replay in the app is done. That's the right gate, because this changes the agent's turn-completion check. The eval categories it lists (gaia_honesty, gaia_files, gaia_resilience) are the right ones to watch on the next RC. Real-world evidenceN/A: no evidence bundle was produced for this run. This is a change to the agent's internal completion check, and testing it for real needs a live model. The verdict rests on static review alone. I couldn't run the unit tests here because pytest isn't installed on this runner. The PR reports 7220 passing in 🔍 Technical detailsIssues found: none blocking. Checked while reviewing:
Strengths
|
One turn after an edit, "A backup of todo.txt was written to <path>" was sent back to the model as an unbacked save, and the reply grew a disclaimer nobody asked for. Now the sentence goes out as written. The record of backups lived only for the turn that made them. The agent now carries it across turns, and a path that is a real file inside GAIA's own backup folder counts as a backup whichever turn or session made it. A backup path that no tool reported and that is not on disk is still checked.
… kalin/rc18-backup-path-claim-r2
|
Round 2 of the rc18 test found the backup was only recognised in the turn that made it: asked one turn later "where did the backup go?", the one-sentence answer was sent back to the model and came out with a disclaimer nobody asked for. The new commit recognises the backup in later turns too. A backup path no tool reported and that is not on disk is still checked. 🔍 Technical details
|
completion.py pulled gaia_home from gaia.config, which calls it while the module loads, so `import gaia` crashed on a machine with no resolvable home directory (test_logger_home_unresolvable, Linux and Windows unit tests). gaia.home provides the same function without the import-time call.
|
The cross-turn backup commit broke 🔍 Technical details
|
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.
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 | amd#7178 | amd#7276 (merged, marker removed) | | Answer quoting an edit's own backup path gets the note | amd#7179 | amd#7277 (merged, marker removed) | | A plan the user asked for is sent back as unfinished work | amd#7180 | amd#7278 (merged, marker removed) | | "Do NOT run anything" is answered with GAIA's own "look first" message | amd#7181 | amd#7278 (merged, marker removed) | | A native tool call is shown as answer text | amd#7205 | amd#7248 (merged, marker removed) | | A fixed test's rerun with a different `tail` reads as an unpassed check | amd#7293 | amd#7319 (merged, marker removed) | | A file a script wrote beside its input is called unwritten | amd#7293 | amd#7321 (merged, marker removed) | | Silence after a question is handed to the model as the user's answer | amd#7294 | amd#7322 (merged, marker removed) | | **New:** "I also saved it to X" with no write gets no note | amd#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 <details> <summary>🔍 Technical details</summary> - `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. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
After an edit, an answer that mentioned the edit tool's own backup file ended with "No successful write to ...bak is recorded", and the re-prompt behind it read to the model like a suspicious message. A backup path a write tool itself reported is no longer counted as an output the turn owed. Other paths in the same answer, and a .bak no tool reported, are still checked.
Closes #7179
Draft until it is replayed in the app: this is the agent's turn-completion check.
Test plan
python -m pytest tests/unit/agents(7220 pass); the backup cases and the loop test fail on main