Repository navigation
fix(agents): verify completion and preserve exhaustive inventories - #4145
kovtcharov wants to merge 26 commits into
Conversation
|
Verdict: Approve with suggestions — strong test coverage and the right architecture, but one correctness regression must be fixed before the extraction gap check ships. 🔴 Code-symbol queries falsely trigger extraction mode and return A query like "List all functions in app.py" or "Find every class in models.py" enables Fix: when computing 🟡 Both methods in 🟢 🟢 🟢 🔍 Technical details🔴 Extraction activation for code queries
self.enabled = exhaustive_request(query) and bool(
re.search(r"\b...\b|\.[a-zA-Z]{1,5}\b", query, re.I)
)
...
self.requested = {
self.key(p)
for p in destination_paths(source_clause)
...
}
Minimal fix: only populate The test that would catch this: add a case to 🟡 Broad exception handlers in new files
except Exception as error: # should be (OSError, ValueError, UnicodeDecodeError)
self.results.pop(path, None)
self.errors[path] = str(error)
🟢 Duplicate computation in
start = raw.get("offset", 0)
end = start + len(content)
total = None if raw.get("next_offset") is not None else endThe first set is unreachable for the 🟢
for label, records in (
("extracted", [e.text for e in items]),
("saved", ...),
):Shadows |
|
Tested on the original #4141 workshop, on Strix Halo with local Gemma-4-26B. The design is right and I can close your open validation item — local Gemma gets 40/40 on your fixture. But the same build fails on the real transcript that motivated the issue, and I think I have the root cause: your fixture has line breaks and GAIA's own transcripts have none. Your open item: local Gemma passes the synthetic benchmark
One qualification — the script still reports The real transcript still failsSame build, same model, the actual 77,361-char workshop: The agent fell back to reading manually and wrote 17 of ~40 — up from 15 before the PR, so roughly 43% recall, still far from exhaustive. The completion guard worked exactly as designed here, and it is the best part of this result: the turn refused to claim success, said the task was incomplete, and told the user to verify before relying on the output. That is the #3983 behaviour, and it held. Root cause: the fixture has line structure that real transcripts do not
This is not an unusual input. Every Two things worth considering, both cheap:
Adding an unlined variant of the fixture would catch both, and would have caught this before merge. Windows: three of the PR's own tests failOn Windows
Flagging because Strix Halo is largely a Windows target, so this suite will be red for the people most likely to run it. On my #3983 feedback
VerdictThe architecture answers #4141 — per-page extraction with verbatim-quote grounding and offset-keyed dedup is the right shape, and the quote-must-appear-in-page check is a real structural defence against fabrication. I would not merge on the synthetic result alone, though: the one real-world document I have still fails, and the failure is in a code path the fixture cannot reach. The empty-page fix looks small. 🔍 Technical detailsEnvironment. Real-transcript run. 17 steps, 15 tools, 1,489 s, 22,585 tokens. Tool sequence: Page 2 span. Synthetic run. 40/40 extracted and saved; Cost note for local models. 20 pages × 2 passes = 40 calls minimum, up to 80 with retries. At Gemma-4-26B's ~24 tok/s the synthetic run took ~17 min of the 1,800 s budget; a slower model or a longer document would exhaust it. Worth stating the practical ceiling in the guide. |
…g extraction Three real issues from review, one from a field report (amd-pworfolk, PR amd#4145): - A query like "list all functions in app.py" has no destination preposition for destination_paths to anchor on, so its no-anchor fallback scanned the whole clause and picked up the source file itself as an extraction destination that never resolves -- every such code query reported status: incomplete. Excludes common code extensions from ExtractionLedger.requested; a real destination is never source code, and code-index/read-file tools already own that file. - validate_sources/validate_outputs caught bare Exception on newly written code; narrowed to ValueError (read_snapshot's own signal) and OSError (the file operations it does not pre-validate). - extract_pages only snapped page boundaries to newlines, but transcribe_media's own output is a single unbroken line -- every GAIA-transcribed source opened pages mid-word, and a page landing on pure filler with a truncated opening made the extractor unable to confirm completion, aborting the whole extraction. Falls back to sentence-ending punctuation when no newline exists in the overlap window. Also fixes two Windows-only test failures the same field report flagged: two assertions compared normalized (Windows-lowercased) keys against raw mixed-case tmp_path strings, and a third symlink-based test needs elevated privilege Windows CI runners don't reliably have -- added a skip marker rather than leaving it permanently red.
A slower local model spent all 5 steps searching and never answered, reporting the script's own tight budget as a failed follow-up rather than a real one (amd-pworfolk field report, PR amd#4145).
|
🔴 The code-symbol query regression is not fully fixed — The previous review flagged that "List all functions in app.py" returns The new test ( Fix: either gate 🔍 Technical details
self.enabled = exhaustive_request(query) and bool(
re.search(
r"\b(?:document|file|...)|\.[a-zA-Z]{1,5}\b",
query, re.I,
)
)For
sources = self.sources | self.requested # {} | {} = {}
if not sources:
return ["Exhaustive extraction has no verified source..."]Still returns a non-empty list → Minimal fix — add to the from gaia.agents.base.extraction import _CODE_EXTENSIONS
self.enabled = exhaustive_request(query) and bool(
re.search(
r"\b(?:document|file|...)|\.[a-zA-Z]{1,5}\b",
query, re.I,
)
) and not all(
os.path.splitext(p)[1].lower() in _CODE_EXTENSIONS
for p in destination_paths(source_clause)
if os.path.splitext(p)[1]
)Or, simpler: in The test to add: |
|
A code query like "list all functions in app.py" no longer ends the turn as incomplete, and the four smaller review items are in. One of @amd-pworfolk's two suggestions is deliberately not taken. Fixed
Not taken: treating an incomplete page as empty A page the extractor declines to finish and a page with nothing in it are the same JSON, so accepting Your Windows findings and the |
|
Reran the original workshop on ResultThe agent fell back to manual reading and saved 8 of ~40 — down from 17 on the previous head, because the fallback started later. 1,181 s, 29,320 tokens. The completion guard held again and is still the best part of this: "I couldn't verify completion… The task is incomplete." Nothing was claimed that did not happen. Root cause: overlapping-but-not-contained spans cannot reconcileThe phrase sits at offset 7574, inside the region where pages 2 and 3 both cover the source (page 2
Two things make this expensive rather than merely wrong:
Worth considering: treat an unreconcilable overlap as one item with the earlier-page fields retained (the error text already says "do not discard stated values"), or record the conflict and continue, rather than failing the run. Either keeps a boundary disagreement proportionate to its cost. Why the fixture still does not catch itThe new 86K zero-newline fixture fixed the line-structure gap, and that fix is confirmed working here. But its items are distinct planted markers, so two pages quoting the same item pick the same distinctive string and land on identical spans — the contained case, which reconciles. Real prose has no such anchor: "slow down your march and start picking your feet up higher" can be quoted from several plausible starting points, and two of them overlap without containment. A fixture item whose natural quote boundary is genuinely ambiguous — a long sentence with no unique marker, placed deliberately at a page boundary — would exercise the path that is failing here. Still open from my last reviewThe VerdictThe two fixes I reported are real and verified. I cannot yet confirm #4141 is resolved: the one real-world document I have gets 8/40, and the abort is in reconciliation rather than in page splitting. The synthetic path is green and the prose path is not, which is the same shape as last time at one layer deeper. 🔍 Technical detailsEnvironment. PR 4145 at Sentence-boundary fix verified. Windows suite. Conflict site. Source context: Reconciliation boundary. Run shape. Tools: |
- extraction.py: render() unpacked a per-path (entries, pages, digest) tuple but never used digest -- unused-variable. - agent.py: _tool_overrides, _extraction_ledger, _completion_evidence were all first assigned outside __init__ (lazily, via hasattr guards or directly in process_query) -- attribute-defined-outside-init. Declared upfront: _tool_overrides as the empty dict every call site already assumed, the other two as Optional (they're only ever built fresh per turn).
…g extraction Three real issues from review, one from a field report (amd-pworfolk, PR amd#4145): - A query like "list all functions in app.py" has no destination preposition for destination_paths to anchor on, so its no-anchor fallback scanned the whole clause and picked up the source file itself as an extraction destination that never resolves -- every such code query reported status: incomplete. Excludes common code extensions from ExtractionLedger.requested; a real destination is never source code, and code-index/read-file tools already own that file. - validate_sources/validate_outputs caught bare Exception on newly written code; narrowed to ValueError (read_snapshot's own signal) and OSError (the file operations it does not pre-validate). - extract_pages only snapped page boundaries to newlines, but transcribe_media's own output is a single unbroken line -- every GAIA-transcribed source opened pages mid-word, and a page landing on pure filler with a truncated opening made the extractor unable to confirm completion, aborting the whole extraction. Falls back to sentence-ending punctuation when no newline exists in the overlap window. Also fixes two Windows-only test failures the same field report flagged: two assertions compared normalized (Windows-lowercased) keys against raw mixed-case tmp_path strings, and a third symlink-based test needs elevated privilege Windows CI runners don't reliably have -- added a skip marker rather than leaving it permanently red.
A slower local model spent all 5 steps searching and never answered, reporting the script's own tight budget as a failed follow-up rather than a real one (amd-pworfolk field report, PR amd#4145).
"List all functions in app.py" excluded app.py from the requested- destinations set but left the ledger enabled, so gaps() still demanded a verified source that code-index/read-file tools never produce, collapsing the turn to status: incomplete. Gate enabled on the query naming a real (non-code) destination or no destination token at all. Also folds duplicate offset/end/total computation out of completion.py's delivered(), shares one path-normalization helper between CompletionEvidence and ExtractionLedger instead of each constructing its own evidence object, and renames a shadowed loop variable in the extraction validation script.
gaps() == [] holds for two different reasons -- the ledger being off, and the ledger being on with nothing outstanding -- so the existing assertion passes even if activation regresses. Also pins that a document source still activates when the save target happens to be a code file.
…wo pages A real unbroken workshop transcript aborted on page 3 because pages 2 and 3 quoted the same sentence from slightly different start points. Their spans overlapped without either containing the other, so reconciliation treated identical fields as a conflict and discarded every page extracted so far. Field values are verbatim in their quotes, so partially overlapping quotes now merge when every value both sides state sits once, at the same source offset, in each quote. Repeated items that share context still stay separate, because their names sit at different offsets. Free-text entries keep the containment rule, since their text cannot be grounded.
"What time does the store close?" or "List every U.S. state capital" came back
as "I couldn't verify completion" because the save detector counted any
"store/save/export" word and the extraction ledger demanded a source that no
one asked for. Save requests now need the verb as an instruction, and a turn
that never read a document leaves no extraction gap.
- Correct saves no longer read as missing through a symlinked directory, a
named folder, or a relative path inside a repo subdirectory; paths resolve
against the working directory, as the file tools do.
- A Lemonade connection error keeps its message and failed status; unverified
work is listed beneath it rather than replacing it.
- Explaining deletion ("deleted files go to the bin") is not a cleanup claim.
- Extraction never merges two non-overlapping quotes into one entry, so a
broad quote can no longer absorb a repeated item. Ambiguous replies are
re-asked, and values repeated inside one quote still match their occurrence.
- An over-long extraction answer stores neither turn instead of an unanswered
question; loading document-extract keeps code-symbol queries off.
- Docs: tool signature, merge rule, memory limit, gaia-voice token count,
CHANGELOG entry; inline comments trimmed.
A second review round found ordinary requests still ending as incomplete
("Save me some time", "Store this in memory", "Write a guide to Node.js") and
extraction still able to lose or abort on realistic quotes.
- A save request now counts only when it names a file or disk; a pathless
"save it" is checked through the answer's own save claim. A destination path
must follow its preposition directly, so "to clean logs/app.log" is a topic.
- "Write X to Y" is a save only for "it", "this" or "the summary", not "a
guide to Node.js". Every save verb in a sentence is read, and a trailing ?
or ! no longer hides the path.
- The answer check reads only a claim's main clause, so "a function that
saves to x" and "Once saved, the file is at x" are not claims. A deletion
claim about a path that is absent and untouched is not flagged.
- Two overlapping extractions whose values sit at one source location, one
inside the other, merge into one entry spanning both quotes with the fuller
value of each field, so a value cut short at a page boundary no longer aborts.
- Two items from one reply never merge, and a candidate must reconcile with
every quote already merged, so a broad quote cannot chain two items into one.
Conflicts are re-asked with the conflicting quote named.
- Free-text entries with equal text merge when their quotes share most of
their text; repeats sharing only context stay separate.
…lysis
A third review round found the nested-value merge could let an omission-pass
"march in place" swallow an earlier "march", and several ordinary requests
still ending as incomplete.
- Identity fields (name, id, title) must match exactly; only descriptive
values may be cut short across a page boundary.
- Sources are the files a request reads from: "from meeting.txt into
actions.json" now extracts meeting.txt and lets the inventory be saved to
actions.json. Parenthesized paths and multiple sources are found.
- Extraction stays off for agents without a file permission validator, for
PDFs and other binary documents, and for analysis of code ("find all bugs in
main.py"); listing content such as TODOs still extracts from code.
- The inventory is appended to the model's answer instead of replacing it, so
requested analysis ("which one is hardest") survives.
- Save claims keep their relative clauses ("the summary that you asked for");
only code descriptions ("a function that saves to x") are ignored. A save
from an earlier session is not a claim about this turn.
- Only requested or claimed outputs need readback; fixing a typo does not.
- Removing a file from an index or list is not a deletion claim.
…cord
A fourth review round found wording-only checks still misfiring: "Downloads
are saved to ~/Downloads" ended incomplete, "Write a Node.js server" demanded a
file named Node.js, and "List all the features of Node.js" required extracting
a document that does not exist. The checks now lean on what actually happened.
- An answer's save claims are checked only when the user asked for a save or
a disk-writing tool ran this turn; a reused transcript still counts.
- A document source must exist on disk; data files (CSV, JSON, logs, YAML,
XML) are left to code tools.
- Without a field named for a name, id or title (exercise_name, ExerciseName
included), the first requested field identifies the item, so an omission
pass reporting "march in place" can no longer absorb "march".
- "extract/put/copy ... into x.json" names an output, "not to x" drops x, a
folder is a save target, and a bare name that modifies a noun ("a Three.js
scene") or sits past a dash is not a path.
- Malformed tool paths (NUL bytes, non-strings) end as normal results.
A fifth review round found the previous commit let "I saved it to notes.md"
pass after "Create notes.md", dropped "Save it to x.txt thanks" as a request,
and aborted extraction when two copies of an item both left the first field
"not stated".
- A first-person save claim is always checked; only impersonal statements
("downloads are saved to ~/Downloads") need a save instruction or a write.
- The modifier rule ("a Three.js scene") applies only when no destination
preposition names the path.
- With no identity value stated in both, any equal field identifies the item.
- A file a successful shell or Python run modified this turn counts as
written once it is read back, so "ls > listing.txt" can complete.
…ntories A sixth review round found the previous commit treated any "I" in a sentence as a save claim, so "I think downloads are saved to ~/Downloads" ended incomplete, and accepted files touched by a failed or unrelated shell run as the saved output. A live run also showed a turn that ran out of steps dropping its 40 extracted items from the answer and from memory. - A first-person claim needs I/we as the subject of the save verb. - A shell-written file counts only when its modification time falls inside a successful executor call and no failed one, and it never satisfies a pathless "saved it to a file" claim. - "Create/make/generate notes.md" names an output; "a Node.js app" does not. - A turn that ends without a final answer still shows the extracted inventory.
… speaker
A seventh review round found "create a summary of the errors in app.log"
treating the user's source as the save target, and "I've successfully saved
it to notes.md" slipping past the first-person check.
- Create/make/generate name an output only through their direct object
("create notes.md"), never through "in X", and a tech name before a noun
("a Next.js landing page") is not a file.
- A first-person claim is I/we followed within a few words by a save verb,
with no be-verb or clause break between, so adverbs no longer hide it and
"I think downloads are saved to x" is still information.
- A turn that stops at the step limit shows the finished inventory under the
step-limit message.
…verdict
An eighth review round showed that narrowing which save claims count had
dropped main's safety net: "The summary has been saved to notes.md" with no
save requested passed with no challenge at all, while checking every claim
hard had turned informational answers into incomplete turns.
- A save claim still makes the turn incomplete when a save was requested, a
file-writing tool ran, or I/we did the saving. Any other claim now gets one
correction (write it, or say it was not saved now) and then stands, as the
fabricated-save guard on main did.
- "Create/make/generate ... in notes.md" names an output when notes.md does
not exist yet; an existing file there is the source.
- A file name followed by a participle and an article ("report.md summarizing
the project") is the output, while "a Next.js landing page" is not.
A ninth review round found the previous commit treating "create a summary of the action items in meeting.md" as a save to meeting.md whenever the source sat outside the working directory, ending correct answers as incomplete. Only a create verb's direct object names an output now; a claim about a file after "in" still gets the one-correction check.
Testing against real YouTube workout captions (no newlines, no punctuation, non-breaking spaces) and an audit of main since this branch showed the pipeline failing on the input it exists for. - A cloud reasoning model spent its whole 8K budget thinking about one dense caption page and returned no JSON. Page calls now ask cloud models for low reasoning effort, allow 16K output tokens, and report a spent budget by name; the old finish_reason check never fired because the SDK drops it. - Quotes match captions despite non-breaking and doubled spaces; the stored quote is still the source's own text at its exact offsets. - Pages snap to a word boundary when a transcript has no punctuation. - A model that reshaped the saved JSON by hand made correct runs incomplete. Exports now give each requested field its own key, and hand edits to a file save_extracted_items wrote this turn are refused. - Local page calls drop the anti-repetition penalties, which fight verbatim copying; a save into the agent's scratch folder, deleted on close, no longer satisfies "save it"; save_extracted_items gets path grants like write_file.
Adversarial fuzzing and live runs on real YouTube workout captions found the
extractor failing honest models and occasionally losing items.
- An item is located by the source span of its identity value, not its whole
quote. Neighbouring items' quotes may now overlap, which aborted about a
quarter of real-caption runs; an omission-pass repeat whose quote names the
item twice takes the unclaimed occurrence instead of vanishing into the
first. Free text that repeats inside one quote is never merged.
- Matching ignores case and spacing but only on whole words ("arm" is not in
"farm"); stored quotes stay the source's own text.
- A cloud page that exhausts its budget reasoning is retried once with
reasoning off; malformed or truncated replies are retryable errors.
- The fields list stops before a save clause, an all-"not stated" item is
rejected, CSV keeps colliding field names and escapes formulas, large
exports validate right after saving, the prompt cap fits the query cap, a
field-schema mismatch names the fields to resend, and the hand-edit guard
matches case-insensitive filesystems.
…ripts
Live runs on real YouTube workout captions showed honest models failing whole
documents: instructors repeat names inside one quote, cloud reasoning models
exhaust their budget on dense pages, and models compose exercise names
("Big circles (arms)") rather than copying them.
- Merging no longer raises. Extractions are one item only at the same place
(same name span, or quotes sharing half their text) with matching or nested
names; different names stay separate items, differing descriptions are both
kept, and anything too ambiguous keeps both entries marked
"(may repeat item N)".
- A name copied from the quote locates the item; a composed label leaves the
quote to locate it, and one sharing no words with its quote is kept but
marked "(label not in quote)". Only the item's quote must be verbatim.
- A quote naming its item twice parses; an omission pass takes the unclaimed
occurrence, so a missed repeat is never folded into the first.
- Errors name the offending field and value so a retry can fix it.
0b3eafb to
279800d
Compare
…ports A 74K-character real caption file (the size of the original workshop) timed out at 30 minutes because a cloud reasoning model spent 50-100 s per page thinking, and a finished extraction then ran out of steps while the model paged through a 60K-character export to "verify" it. - Page calls ask cloud models for no reasoning; copying quotes needs none. The same file now finishes in about two minutes with comparable recall. - The framework reads every exported inventory back in full and compares it exactly, so that counts as the readback; the model no longer pages through it, and a tampered file is still caught. - An entry that states no field is ignored instead of failing its page.
A final planted-item fuzz found no lost items but a rare wrong merge: when a
quote named its item twice, the extraction was pinned to an occurrence already
found and its values landed on a different item of the same name.
- A quote naming its item twice takes an unclaimed occurrence and is never
merged; a true re-report shows as a flagged possible repeat.
- A name with a trailing period still locates itself, a one-sided located
name must sit inside the other quote, and free-text items at different
name positions stay apart.
- The repeat flag also catches label drift ("march" vs "Seated marching").
- Free text normalises carriage returns, invalid Unicode is a retryable
reply error, and the output-size error no longer calls the file a source.
1c27205 to
31f937c
Compare
|
The overlap abort you hit is fixed, and so is the class of failure behind it. I tested against real YouTube workout captions: one unbroken line, no punctuation at all, non-breaking spaces. A 74K-character class, the size of your workshop, now extracts end to end on Fireworks in about two minutes. Could you rerun your original transcript on the new head? Your report
What real captions surfaced beyond your case
Limits worth knowing
🔍 Technical detailsLive runs (Fireworks
Local run
Adversarial coverage
Architecture audit of the 51 commits on
|
Skills now load when the model calls load_skill rather than being guessed before the turn, so that call is the main way extraction switches on.
|
Replicated as #4374 — fork push access (kovtcharov/gaia) was revoked mid-review, so this PR could no longer be refreshed against main (59 commits behind and growing). Same content, conflicts re-resolved against current main. Closing in favor of the replacement. |
…md#4374) Replicates amd#4145 (`kovtcharov/gaia` fork, push access blocked) onto a branch this session can push to. No content changes beyond conflict resolution against current `main`. GAIA could claim it saved a file it never wrote this turn, or turn a long workshop transcript into a condensed list presented as complete. Now a save counts only when that exact file was written and read back, and a long document is extracted page by page into a full inventory in which every item keeps a verbatim quote from the source. The result is kept in memory, and anything unfinished is reported as incomplete. Ordinary questions ("What time does the store close?") behave exactly as on `main`. Fixes amd#3983 and amd#4141; related to amd#4009. Closes amd#4145. ## Test plan - [x] `python -m pytest tests/unit/agents/ -q`: 1,663 pass, 51 skip. The one failure (`test_symlinked_directory_is_the_same_output`) is this Windows box lacking the symlink privilege, not the code. - [x] `python -m pytest tests/unit/ -k "memory" -q`: 1,136 pass. The one failure (`test_memory_discovery.py::TestCredentialManagerContractShape`) reproduces on pristine `main`. - [x] `python -m pytest tests/unit/ -k "inventory or transcript or overlap or youtube or extract" -q`: 547 pass; remaining failures are a local `mcp` package version mismatch and a live-Lemonade ASR test. - [x] `black --check` / `isort --check-only` clean on every touched file. - [ ] Reporter check: Patrick reruns the original workshop transcript. - [ ] Judged `gaia eval agent` run: deferred by maintainer; the completion gate changes final answers, so decide before merge. <details> <summary>🔍 Technical details</summary> **What a reviewer should know** - **Saves** - A request that names a file, folder or disk is a hard obligation: the file must be written and read back this turn. - A save claim is checked hard when a save was requested, a disk tool ran, or the answer says "I" or "we" saved something. Any other claim gets one correction and then stands, as on `main`. - A file written through the shell counts only when a successful call modified it. The agent's scratch folder never counts as the user's save. - **Extraction** - Pages are 4K characters with 600 characters of overlap, snapped to a line, sentence or word boundary. Each page gets two passes, a retry on an unusable reply, and a 16K-token output budget. - Cloud models are asked for no reasoning: a reasoning model spent 50–100 s per page and ran past the 30-minute limit on a 74K file. - Quote matching ignores case and spacing, but only on whole words. The stored quote is always the source text at its exact offsets. - An item is placed by the span of its name when the name is copied from the quote, otherwise by its quote. - Merging never fails a run and never drops an item. Differing descriptions are both kept, and uncertain cases keep both entries, marked "(may repeat item N)". - **Exports** - JSON records give each field its own key and CSV gives each field its own column. The framework reads the saved file back in full and requires an exact match, and hand edits to it are refused. **Adversarial coverage (from amd#4145)** - A planted-item oracle (about 20,000 items, repeated names, paraphrased labels, repeats across pages and passes) finds no lost, absorbed or wrongly merged items. - In 60,000 hostile replies, no exception escaped the tool, and every quote matched the source at its offsets. - Live runs on Fireworks `deepseek-v4p1-flash` against real YouTube auto-captions of 13K, 21K and 74K characters; the 74K end-to-end agent run saved and verified 111 items in 122 s. Local Gemma-4-E4B completed the 13K file (63 items). **Conflicts resolved against current `main`** Two, both in `src/gaia/agents/base/agent.py`, plus an additive one in the flagship `CHANGELOG.md`: 1. **Turn-sealing order vs. amd#3707 (mid-turn followups).** `main` added a `_drain_followups` check that re-enters the loop rather than sealing the answer; amd#4145 replaced the same lines with `finalize_answer` + the completion-evidence gate. Kept both, drain first: a late user message still gets folded into the running turn, and the completion gate then runs on the answer that actually seals. 2. **Duplicated `_refresh_active_skill_filter` vs. amd#4369 (a loaded skill brings its tools).** amd#4369 hoisted that call to *before* `_refresh_active_tool_filter`; amd#4145 still carried it in its old position below, so a naive merge called it twice per turn. Dropped the duplicate and kept `main`'s hoisted call — the extraction block that follows reads `_active_skill_filter`, so running it earlier is strictly correct. **Verification of the resolution** - Per-file diff of (merge-base → amd#4145 head) against (current `main` → this branch): byte-identical on every file except the one blank line the de-duplication above removes. That rules out the silent near-identical duplication a large auto-merge can introduce. - `compile()` (not just `ast.parse`, which does not reject repeated keyword arguments) over every `.py` in `src/`, `tests/`, `hub/` and `scripts/`: clean. Repo-wide sweep for stray conflict markers: none. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: f <f@f>
GAIA could claim it saved a file it never wrote this turn, or turn a long workshop transcript into a condensed list presented as complete. Now a save counts only when that exact file was written and read back, and a long document is extracted page by page into a full inventory in which every item keeps a verbatim quote from the source. The result is kept in memory, and anything unfinished is reported as incomplete. Ordinary questions ("What time does the store close?") behave exactly as on
main.Fixes #3983 and #4141; related to #4009.
Test plan
python -m pytest tests/unit/agents/ tests/unit/test_memory*.py -n 8: 2,671 pass locally.python scripts/dev/validate_document_extraction.py <MODEL> <new-dir>and the same with--unlined: 40/40 extracted, saved and recalled from memory on Fireworks (deepseek-v4p1-flash).gaia eval agentrun: deferred by maintainer; the completion gate changes final answers, so decide before merge.🔍 Technical details
What a reviewer should know
main.Adversarial coverage
Audit of the 51 commits that landed on
mainmeanwhilesave_extracted_itemsgets path grants likewrite_file.Known limits