Skip to content

fix(agents): check saves to Windows paths after a 'would have' clause - #8051

Merged
kovtcharov-amd merged 1 commit into
mainfrom
autofix/issue-8029
Nov 13, 2026
Merged

kovtcharov-amd merged 1 commit into
mainfrom
autofix/issue-8029

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

When an answer said "I would have written it to C:/…/a.txt, but saved the totals to C:/…/b.txt" and nothing was written, GAIA showed no "No successful write … is recorded" note. On Windows almost every path the model writes is absolute, so #7540's check missed the common case. Now the save to b.txt is flagged with C:/ and C:\ paths, just as it already was with bare file names.

Closes #8029

Test plan

🔍 Technical details
  • Root cause: in _COUNTERFACTUAL (src/gaia/agents/base/completion.py), the clause body was [^,;:—–]*. That class stopped matching at the : in C:, so the join group never matched and _drop_counterfactual never put the I back in front of saved. _FIRST_PERSON then found no claim.
  • Fix: the body is now (?:[^,;:—–]|(?<=\b[A-Za-z]):(?=[\\/]))*. A colon stays in the clause only when it follows a single letter and comes before a slash. Any other colon still ends the clause: "I would have written the report: then saved b.txt." still stops at the :.
  • Tests: test_a_save_to_a_windows_path_after_a_would_have_clause_is_a_claim runs with both separators and covers the ", but saved", "but … instead" and plain "I saved" forms. In each case b.txt must be flagged and a.txt must not.

A drive letter's colon (C:/, C:\) ended the 'would have written' clause
early, so the ', but saved ...' that followed lost its subject and the
claimed save to an absolute Windows path was never checked. The clause
now continues past a drive-letter colon; any other colon still ends it.

Closes #8029
@github-actions

Copy link
Copy Markdown
Contributor Author

Verdict: Approve

When an answer said it "would have written" a file to one Windows path but then saved to another, GAIA skipped checking that second save. Paths like C:/… and C:\… are what models usually write on Windows, so most of these claims went unchecked. This PR fixes that with a narrow change: only a colon right after a single drive letter and right before a slash stays inside the "would have" clause. Every other colon still ends the clause. Nothing blocks the merge.

Real-world evidence

N/A: no CLI, API or MCP surface changed, so this rests on code review alone. The Windows packaged-app step in the test plan is still unchecked.

🔍 Technical details

How I checked it. pytest isn't installed on this runner, so I pulled _COUNTERFACTUAL out of completion.py and ran it on its own:

'I would have written it to C:/U/a.txt, but saved the totals to C:/U/b.txt.'  -> 'I I saved the totals to C:/U/b.txt.'
'I would have written it to C:\U\a.txt but saved it to C:\U\b.txt instead.'   -> 'I I saved it to C:\U\b.txt instead.'
'I would have written the report: then saved b.txt.'                          -> 'I : then saved b.txt.'   (other colons still end the clause)
'I would have saved it to http://x/a.txt, but saved b.txt.'                   -> 'I ://x/a.txt, but saved b.txt.'

Issues

  • 🟢 A URL's colon still ends the clause, as it did before this PR (src/gaia/agents/base/completion.py:155). The \b in the lookbehind correctly stops http: from counting as a drive letter. But "would have saved it to http://…/a.txt, but saved b.txt" still leaves the save to b.txt unchecked. This isn't a regression, and URLs are rare as save targets, so it doesn't need fixing here.

Strengths

  • The lookbehind (?<=\b[A-Za-z]) plus lookahead (?=[\\/]) matches only a real drive letter. The report: case shows ordinary colons still end the clause.
  • Each new test case checks both directions, with both separators: the real save is flagged and the "would have" path is not. The PR also confirms the tests fail without the fix.
  • The changed code is a single regex line in one module. The other [,;:] patterns in the file (lines 103 and 268) do different jobs and aren't affected.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 37e6e11 Nov 13, 2026
61 of 87 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the autofix/issue-8029 branch November 13, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A made-up save after 'would have ..., but' still goes unchecked when the paths are Windows absolute paths (C:/...)

1 participant