Repository navigation
fix(agent): a corrected test claim must not cost the user the whole answer - #4401
Conversation
…nswer GLM-5.3 Flash answered a code review in full, was corrected on one test claim it could not back, ran the tests, and replied only about the tests. That reply was the final answer; the review never reached the user. The correction now says the next answer replaces the one before it, and asks for the complete answer again, and it is written to the transcript so the record shows why the turn continued.
|
Verdict: Approve with suggestions When the agent is corrected over a test result it can't back up, its reply becomes the only answer the user sees. Some models replied only about the corrected claim, so the rest of the answer was lost. The correction now asks the model to give its complete answer again and says the new answer replaces the old one. The fix is small, matches how the neighbouring "verify after change" correction already works, and has a test that pins the new behaviour.
Real-world evidenceN/A: this bundle has no 🔍 Technical detailsIssues 🟡 Model-behaviour change, no eval result yet ( 🟢 History-tagged test comment ( Checked, no issue
Strengths
|
…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>
400 was tight enough that a carefully-tuned, eval-validated docstring (read_tool_output, amd#4379) tripped the CI gate at 469 chars. Raising the ceiling avoids forcing a rewrite of text that was tuned against real model behavior — the two named allowances (run_shell_command, remember_skill_lesson) still exist for cases that need to go further.
A memory the model filed under "work" or "personal" was saved and never shown again. The `remember` tool offered a `context` label, and `gaia memory bootstrap` writes "work" rows. But a default session reads only "global" rows, and nothing in GAIA switches to another context. In a learning benchmark the user stated two standing rules, and the model saved them with `context='work'`. Sessions 2–4 ran on the same store, never saw the rules, and all three failed to follow them. A default session now shows memories from every context, and that also fixes rows already on disk. An agent that picked its own context, such as email, keeps it plus "global". The model can no longer choose a label: `remember` and `update_memory` store under the agent's active context. I dropped the parameter rather than validating it. Validation would mean either rejecting the call, which wastes a turn, or quietly relabelling it, which is a silent substitution. The model can't know the agent's scoping anyway. <details> <summary>🔍 Technical details</summary> - The same "global means unscoped" rule applies to the reminder list in the per-turn context and to extraction's duplicate search. `recall` already searches every context unless the model filters. - Sensitive rows stay out as before. - A model that still passes `context=` gets the loop's structured "unexpected argument" error and can retry without it. - Docs updated: the memory guide's context section, which showed the model storing into "personal" by chat, and the SDK page's filter description and tool card. Also updated the bootstrap docstring that described the old global-only read. - The per-request retrieval in amd#4061 gets the same rule in a follow-up commit on that branch. </details> ## Test plan - [x] `pytest tests/unit/test_memory_context_visibility.py`: 6 new tests on a real on-disk store. A "work" preference saved in one session is in the next session's system prompt, and a "personal" reminder reaches the next turn (both fail on main). Sensitive rows stay out. Email scoping holds. `remember` stores under the active context, and neither tool accepts `context` - [x] `pytest tests/unit -k "memory or bootstrap"`: 1108 passed. Two existing tests updated because they encoded the old global-only read and the model-chosen label - [x] `python util/lint.py --black --isort` on changed files - [ ] `gaia eval agent` on the memory categories vs the committed baseline (memory tool schema changed) --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
amd#3791) GAIA refused its `coding` skill whenever the `pytest` executable was not on the global PATH. That is the usual state for a Python project, where pytest lives in a virtualenv. In a benchmark run where models could see and load skills, 42 of 48 attempts to load `coding` were refused, so models lost the skill's guidance on the very tasks it was written for. A missing command now refuses a skill only when nothing can stand in for it. pytest can: the skill loads, and `load_skill` tells the model to run the suite through `execute_python_file` with `pytest.main`. `gh` cannot, so a missing `gh` still refuses `github-triage`. The refusal also appears to derail models. Every one of 12 benchmark runs that ended in "I had trouble formatting my tool call" had a refused `coding` load earlier in the turn; the build before skills became visible had none. It is an association, not a measured cause: a re-run of those cells with this fix will show whether they recover. Closes amd#3790 ## Test plan - [x] `pytest tests/unit/test_skill_binary_grants.py`: a missing pytest resolves without refusing and is reported as unavailable; an installed one is never reported; missing `gh` still refuses. - [x] `pytest hub/agents/gaia/python/tests/test_skill_library_tools.py`: `load_skill` on a pytest-declaring skill with pytest off PATH succeeds, returns `unavailable_commands: ["pytest"]` with the substitute in `warning`, and grants nothing. - [x] `pytest tests/unit/test_skill_binary_grants.py hub/agents/gaia/python/tests/test_skill_library_tools.py tests/unit/test_starter_skills.py tests/unit/test_skills_manager.py`: 523 pass. - [x] Live, the real flagship loading the real `coding` skill with pytest absent from PATH. `main` fails with "Skill 'coding' needs the 'pytest' command, which is not on PATH…". This branch loads it with the warning "'pytest' is not on PATH, so this skill's `pytest` steps cannot run as written. Run the suite with execute_python_file…". - [ ] `gaia eval agent`: it changes what the model is told on skill load. It can't run on this machine (no `claude` CLI for the judge). --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
…amd#4066) **Stacked on amd#4058.** The first four commits are that PR. Review the last two here. The agent rediscovered the same project quirk every session. When a call failed and the agent worked around it (say `pytest` fails with "test clock not configured", it reads the doc, reruns with `env TOYBOX_CLOCK=frozen` and it passes), memory stored the error and then deleted it on the success. Nothing recorded what fixed it, so the next session started from scratch. Now that fail-then-fix sequence in one turn becomes a lesson, built only from the two calls: the failing call and its error, the call that worked, and what changed ("added `env TOYBOX_CLOCK=frozen`"). It belongs to the workspace it happened in, and the next session there sees it in its memory prompt with the date learned. It gains confidence each session the fix works again and is dropped when the fix itself fails. Other folders never see it. <details> <summary>🔍 Technical details</summary> - The pairing key is amd#4058's operation key: the tool plus the program it runs (past `env`, `VAR=value` and `python -m`) or the path. The failing and working calls must have different arguments, so a plain retry that happens to pass teaches nothing. Refusals (`executed: False`) never count, either as the failure or as a failed fix. There's no matching on error wording. - Scope: stored as `category="note"`, `domain="lesson"`, in the memory context `workspace:<most specific allowed path>`. That context keeps lessons out of every other workspace's prompt and retrieval, including amd#4061's per-request recall. So lessons are shown in their own stable-prompt section (top 3 by confidence), not through relevance search, which would also hide them whenever the request is worded differently from the lesson. - Within a session, later turns get the new lessons in the per-turn context, since the stable prompt is frozen. Within a turn there was a real loss path: overflow recovery stubs every tool result except the latest, which drops the failure a fix answered. The recovery now restates this turn's lessons on the last user message. The cache is already lost at that moment, so this costs nothing extra. - A lesson whose text looks like a credential isn't stored. </details> ## Test plan - [x] `pytest tests/unit/test_memory_heal_lessons.py`: 14 tests on a real on-disk store, over several sessions sharing one DB. All 7 positive tests fail on the pre-change source. Covers the exact lesson text and row shape, no lesson for a same-call retry / a refused failure / a different program / a failure and fix in different turns, a path tool's changed argument, the next session's prompt in the same workspace but not another, the rest of the session, confirm once per session (0.5 → 0.6), drop when the fix fails, keep when the fix is refused, and overflow recovery keeping the lesson (idempotent) - [x] `pytest tests/unit -k "memory or overflow or shrink"`: 1155 passed. The 1 failure, `test_tool_loader_token_budget`, also fails on main - [x] black + isort on changed files - [ ] `gaia eval agent` on the memory categories vs the committed baseline (memory prompt content changed) --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
…ding on it (amd#4054) All three TheRock benchmark runs that GAIA failed ended the same way: the DeepSeek model used up its 8,192-token output budget, and GAIA took the cut-off reply as its final answer at about step 30 of 150. Two of those replies were unfinished reasoning handed back as text ("The fix: add `trigger_test_label_only: True` to gfx90a's linux entry…"). The third was a tool call cut off partway through its arguments. GAIA never knew the reply had been cut off, because the provider threw away the reason the reply ended. Now it keeps that reason. A cut-off reply goes back to the model with "your reply was cut off, continue", before GAIA tries to read it as an answer or a tool call. After two cut-offs in one turn, the turn ends with an honest "I could not finish" message instead of the half-written text. - **Why this is a structural check:** it acts on `finish_reason=length`, which comes from the provider, not on the wording. A complete answer, an honest "I couldn't finish" and a normal chat reply all end normally, so none of them can trigger it. - **Why the existing plan guard didn't fire:** it only reads the last sentence of a short reply. These replies were 38–39K characters and ended mid-thought. It still had its whole re-prompt budget left. - **Worth a follow-up, not changed here:** the 8,192 output cap is hard-coded in the base `Agent`. It was sized for a 32K local context, and for a cloud reasoning model the thinking counts against it. <details> <summary>🔍 Technical details</summary> - `LLMClient.get_last_finish_reason()` is added. It defaults to `None` and `LemonadeProvider` implements it for streaming and non-streaming calls. `AgentResponse.finish_reason` carries it to the loop. - The check runs right after the reply arrives, before `_parse_llm_response`. Native tool-call envelopes keep their existing truncation error. - The Claude, OpenAI and LiteLLM providers don't report the finish reason yet, so they behave as before. </details> ## Test plan - [x] `pytest tests/unit/agents/test_cut_off_reply_guard.py`. Replays the final reply of each of the three failed runs, and each one is continued and the work goes on. Repeated cut-offs and a cut-off on the last step end with the honest failure message. A complete answer, an honest "could not finish" and a chat reply all end the turn untouched. The finish reason reaches the loop from the provider and the SDK. The loop tests failed against `main`. - [x] `pytest tests/unit/agents tests/unit/chat tests/unit/test_claude_provider.py tests/unit/test_streaming_tool_calls.py tests/unit/test_tool_call_priority.py` - [ ] `gaia eval agent --category tool_selection` --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
…sitory (amd#4376) Replicates amd#4076 (kovtcharov/gaia fork, push access blocked) onto a branch this session can push to. No content changes beyond conflict resolution against current main. The flagship worked real repositories without a shell. The tool loader showed `run_shell_command` only when a request sounded like a shell request, and coding requests usually don't ("skip gfx90a tests on PRs unless labeled"). On four TheRock CI-fix tasks it never got the shell, and 181 of its 276 tool calls were `run_python` wrapping a single `grep` or `sed`. Claude Code took about 20 shell calls per task; GAIA took 65–96 calls. Now, when the session's project is a code repository, the shell is offered on every turn. Outside a repository nothing changes, and the shell still asks for approval as before. **Why not just make the shell always-on everywhere:** its schema is about 160 tokens on every call, and most flagship sessions (documents, email, chat) have no use for a shell. Tying it to the workspace spends those tokens only where they pay off. It's decided once, when the agent is built, so the prompt prefix stays cache-stable from turn 1. ## Review status carried over The original review raised four findings. Three were fixed on the branch and I verified each is present in this replication: - The project map no longer names a shell the turn didn't offer — `_shell_tool_offered()` reads `_active_tool_filter` and falls back to the registry. - The non-deterministic "no project root" test was split into a stubbed-root case and an explicit-root case. - The npm changelog now names `GAIA_PROJECT_ROOT` / `GaiaAgentConfig(project_root=...)` instead of implying the shell turns itself on in any repository. The fourth — **the agent eval — is still outstanding and remains a pre-merge gate for a maintainer.** See the note below for how far I got. ## Test plan - [x] `python -m pytest hub/agents/gaia/python/tests/test_shell_in_code_repos.py tests/unit/test_project_map.py -q` — 91 passed - [x] `python -m pytest hub/agents/gaia/python/tests/ -q` — 507 passed, 0 failed - [x] `python -m pytest tests/unit/ -k "tool_loader or full_tool_bundles or dynamic_tool or project_map"` — 191 passed, 2 failed; both failures (`test_harness_runs_and_pins_baseline`, `test_token_baseline_when_tiktoken_available`) reproduce identically on a clean `main` checkout - [x] `python util/lint.py --black --isort` clean - [ ] `gaia eval agent --category tool_selection` — **could not run here**, see below > [!IMPORTANT] > **The agent eval still needs to run on maintainer hardware, and this is a tool-schema change, so it is required before merge.** > > I did attempt it rather than skipping it. Lemonade and the Claude judge both work on this machine, and a scenario completes end-to-end (`known_path_read` PASS 9.8/10). But the eval only runs against *this* checkout if `PYTHONPATH` is pinned to it — otherwise the installed `gaia` resolves to an unrelated worktree and measures the wrong code. With the path correctly pinned, every scenario returns `INFRA_ERROR` because the eval's MCP bridge cannot start: `src/gaia/mcp/servers/agent_ui_mcp.py:282` does `from mcp.server import MCPServer`, but the installed `mcp` package exports `Server`, not `MCPServer`. That file is untouched by this PR and the same import is on current `main`, so the eval is blocked by a pre-existing incompatibility, not by this change. --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
…uest (amd#4055) GAIA threw away almost everything a reasoning model wrote. On one DeepSeek call, 91% of the output tokens were reasoning and the visible answer was 18 characters. So at every step of a tool-calling job, the model had to re-derive its plan from scratch, and a plan that existed only in its reasoning never reached the next step. When a reply had no visible text, GAIA did something worse: it handed the private reasoning to the user as the answer. Now reasoning is kept as its own field. It is recorded in the transcript, sent back to the model on each step of the same request (the provider's own guidance for thinking models that use tools), and never shown as the answer. - **Earlier requests:** reasoning from past user requests is kept but not sent again by default, so long conversations don't keep growing. `resend_reasoning_across_requests=True` turns that on. The owner may want it on. - **Checked with a real call:** one request through the Lemonade gateway to `fireworks.deepseek-v4p1-flash`, in a tool-call loop, sent back an assistant turn carrying `reasoning_content`. It was accepted and the model answered coherently. The prompt grew by 27 tokens for 117 characters of reasoning, which shows the reasoning reaches the model rather than being dropped. - **Cost:** each step's prompt grows by roughly that step's reasoning. On the TheRock benchmark, replies averaged about 1,000 tokens, mostly reasoning, so a 30-step job carries on the order of 30K extra prompt tokens by the end. Most of that is a cached prefix. <details> <summary>🔍 Technical details</summary> - `LLMClient.get_last_reasoning()` and `accepts_reasoning_history` are added, and `LemonadeProvider` implements both. The SDK attaches `reasoning_content` to assistant history only for a provider that accepts it, so OpenAI and LiteLLM never receive the field, and Claude's message translation already drops unknown keys. - Inline `<think>` blocks go into the same field as `reasoning_content`, including an unclosed block (a reply cut off mid-thought) and a lone `</think>` (the chat template opened the block in the prompt). - The Claude provider doesn't turn on extended thinking. It does drop any `thinking` blocks it gets back, so it would have the same gap if thinking were enabled. That provider is not changed here. - Callers that rebuild `conversation_history` from the UI database (`ui/_chat_helpers.py`, `ui/agent_loop.py`) store only the answer text, so the setting has no effect in the Agent UI until they store reasoning too. - amd#4054 (continue a cut-off reply) pairs with this change. With both merged, a reply cut off while the model is still thinking is continued with its reasoning intact. Neither PR depends on the other. </details> ## Test plan - [x] `pytest tests/unit/agents/test_model_reasoning_kept.py`. Reasoning from `reasoning_content` and from inline `<think>` blocks is stored and kept out of the answer. Within a request, the next call carries the previous step's reasoning. Across requests it is not resent by default and is resent with the setting on. Ten of these tests failed before the change. - [x] `pytest tests/unit/agents tests/unit/chat tests/unit/test_claude_provider.py tests/unit/test_streaming_tool_calls.py tests/unit/test_tool_call_priority.py` - [x] One real tool-call round trip through the Lemonade gateway with `reasoning_content` sent back (see above) - [ ] `gaia eval agent --category tool_selection` - [ ] `gaia eval agent --category rag_quality` --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
…ge (amd#4061) Memory held useful lessons that the model almost never saw. The memory section of the system prompt is fixed at session start and picks facts by confidence alone, whatever the user is asking. Everything else only surfaced if the model called `recall`, and it did so 4 times in a 2,121-task benchmark sweep. Surfaced memories also had no dates, so a lesson learned months ago under different permissions looked as current as one confirmed yesterday. Each turn now adds the three stored memories most relevant to the request to the per-turn context, which is prepended to the user message. The cached system prompt doesn't change. A memory has to clear a similarity floor, so an unrelated nearest match isn't shown. It must also be in this context or global and not sensitive, credentials are masked, and anything the system prompt already shows is skipped. Every memory the model sees without calling `recall` now carries a short "(learned 2026-06-03, last confirmed 2026-09-20)". The dates are absolute, so the fixed prompt stays stable, and the per-turn context already carries the current time. <details> <summary>🔍 Technical details</summary> - Uses a vector-only FAISS search with an absolute cosine floor (`TURN_RECALL_MIN_SIMILARITY = 0.5`), not `_hybrid_search`. RRF gives no absolute floor, and hybrid search bumps confidence on every hit, which would inflate anything shown passively. - About the floor: it is set from memory-to-memory similarity in the sweep stores (nomic-embed-text-v2). Unrelated pairs have a median around 0.34 and same-topic pairs sit above 0.8. It hasn't been measured on query-to-memory pairs, and the eval below is where it gets checked. - Cost: one embedding call before each turn when the index isn't empty. Extraction already embeds the same text after the turn, so that later call now hits the embedding cache. If embedding fails, the turn still gets its time and reminders, and a warning is logged. - "Last confirmed" is `updated_at`, which moves when the same memory is stored again or updated. </details> ## Test plan - [x] `pytest tests/unit/test_memory_turn_recall.py`: 13 new tests on a real SQLite store and FAISS index. The 6 positive ones fail on main. Covers the exact injected line with its age, the top-3 cap, dedup against the stable prompt, no confidence or use-count bump, context scope (a default session reads every context, the same rule as amd#4062; a scoped one reads its own), excluded rows (sensitive, reminder, below floor), credential masking, embedder failure, stable-prompt ages, and that the memory arrives on the user message while the system prompt stays byte-identical - [x] `pytest tests/unit -k memory`: 1101 passed. Hub chat/gaia memory tests: 22 passed - [x] `python util/lint.py --black --isort` - [ ] `gaia eval agent` on the memory categories vs the committed baseline (memory prompt content changed) --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
When a tool result is too large for the model, GAIA used to keep its first and last few thousand characters and drop the middle, so the agent often went back for what it could not see. Now an over-budget result arrives as the parts that fit plus a numbered index of everything left out, split where the document splits: functions and methods, headings, JSON records, a search's files, failing test sections, diff hunks. `read_tool_output(artifact, entry=n)` returns one part verbatim, so nothing is lost and the model can see exactly what it is missing. The split is deterministic, with no summarising model in the tool path. Budgets are unchanged: the index applies only above the existing device threshold. Measured on the TheRock benchmark (4 real ROCm build-system bugs, GLM-5.3 Flash and DeepSeek V4.1 Flash), the judged quality of fixes rose on the two tasks where the old cut had hidden the relevant code (3.00 → 4.00 and 3.75), and stayed level elsewhere. Tokens and cost did not fall: a tighter cloud budget was tried and reverted, because the model walks an index of a file it needs whole, one part per round trip. This PR is the "nothing lost" mechanism, not a cost saving. ## Test plan - [x] `pytest tests/unit/agents` — 1578 passed, 50 skipped on main, including ~90 chunk-index tests: every chunker tiles its text exactly, every index entry reads back verbatim by number, inputs of 100 KB, 1 MB and a single 50K-char line page correctly, a property test over 30 seeds of mixed text, `check_result` kept verbatim, local NPU/GPU and remote budgets pinned, a `read_tool_output` page is never re-condensed - [x] black, isort, flake8, pylint clean on changed files - [x] Offline replay of recorded transcripts through the real handler: `python util/bench_chunk_index_sim.py 'runs.*/*/*/_transcript.json'` (needs local transcripts) - [x] Live: TheRock tasks on GLM-5.3 Flash (4 tasks, 2 runs) and DeepSeek V4.1 Flash (1 task), judged; outcome and quality as described above - [ ] NPU eval: a non-string result between 20K and 30K chars now reaches the model whole on NPU instead of being cut to 20K unarchived at the message backstop --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
… refuse, one name for full access (amd#4408) Three open PRs rewrite the same refusal branch in the agent's shell tool, and landing any two without the third leaves guard messages describing behaviour that no longer exists. This folds all three into one branch so the shell story can be reviewed and tested as one thing. **What a user gets.** The agent stops refusing work you are sitting right there to approve: `git commit`, `npm test`, `rm notes.txt` are now shown to you and run once you say yes, instead of coming back as a flat "not allowed". A `cd` survives to the next command, so `cd build && cmake ..` followed by `make` works the way it reads. And the coding skill loads on a machine where `pytest` lives only in a virtualenv, which is most machines. Replaces amd#3791, amd#3400 and amd#3808. ### The one decision a reviewer should confirm amd#3400 and amd#3808 forked 143 and 184 commits back, and main moved under both. Where the two disagreed about behaviour, **main's newer design won** and amd#3808's older expectations were updated: - **`git push` stays refused outright** rather than becoming confirmable — amd#3374 made push/reset/rebase refusals that the `git` grant itself will not run. - **Full access keeps the developer command set** rather than lifting the allowlist entirely, so `rm` and `touch` stay out. amd#3808's own later commit ("keep unattended runs narrow; leave shell lifting to amd#3394") is what settled this. If either call is wrong, it is a small edit here rather than a re-merge. <details> <summary>🔍 Technical details</summary> **Merge shape.** `amd#3791` (the only mergeable member) anchors; `amd#3400` and `amd#3808` were merged onto it in that order, each as a `--no-ff` merge whose message records its own resolutions. **One name for full access.** Main carried `console.bypass_permissions` and amd#3808 added `console.full_access` for the same session-wide grant — the naive merge shipped both, which would have been a live bug (`full_access_active()` reading one while `PermissionState` wrote the other). Collapsed onto `full_access`, keeping main's semantics and amd#3808's name: | before | after | |---|---| | `console.bypass_permissions` | `console.full_access` | | `ShellToolsMixin.bypass_gates_active` | `full_access_active` | | `client.PermissionBypasser` (Go) | `client.FullAccessSetter` | | `SetBypassPermissions` (Go) | `SetFullAccess` | | `PermissionState.set_bypass` | `set_full_access` | | stdio control verb `bypass` | `full_access` | The HTTP route keeps its original `/v1/{agent}/sessions/{id}/bypass` spelling — renaming it would break every already-published sidecar. `--bypass-permissions` and the `bypass` control verb stay accepted as retired spellings. **Superseded, deliberately not carried over from amd#3808:** `_resolve_git_subcommand` and `SAFE_GIT_COMMANDS` (main moved `git` into `BINARY_POLICIES` with a read-only ungranted floor), its git-subcommand branch, and its SPEC claim that `/tool_decision` and the session toggle are stdio-only (contract 2.14 gave HTTP both). **`shell_session` is a new bundle, not two more members of `shell`.** Folding `get_shell_state` / `reset_shell_session` into `shell` put it at 7 members, over `MAX_BUNDLE_MEMBERS` — a cap that exists so one pull-in cannot exhaust the dynamic-tool slots. Registered tool count 86 → 88, with `gaia-agent.yaml`, `gaia_agent/__init__.py`, `CAPABILITY_MATRIX.md` and the guide updated together. **Two fixes that fell out of the merge rather than out of any of the three PRs:** - Under full access a shell keyword (`for`, `while`) was reported as "not in the developer command set" instead of being named as control flow. `_validate_bypass_command` now names it, because no mode can run it. - `wait_for_condition` refused a confirmable predicate in front of the prompt — the same dead end the confirm tier exists to remove. **One stale test corrected:** `test_a_pipe_is_refused_for_its_binary_not_for_the_pipe` asserted the exact grant-id refusal for `pytest`, which amd#3791 replaces with a "not installed" refusal wherever `pytest` is not on `PATH`. It passed in CI only because CI has `pytest` on `PATH` — exactly the hidden-state masking CLAUDE.md warns about. It now holds in both machine states. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: f <f@f> Co-authored-by: Kalin Ovtcharov <[email protected]>
…md#4353) About 300 unit tests never ran in CI. Their files skip as a whole when a hub wheel (`gaia_agent_chat`, `gaia_agent`, `gaia_agent_email`) or an optional extra is missing. The unit lane lacks them, but it still names the files, so the lane check counted them as covered. With this PR, each file runs in a lane that installs what it needs, and a lane fails when a file skips as a whole without an allowlist entry saying which lane runs it. Stacked on amd#4344. Merge amd#4343 and amd#4344 first. - **The new guard runs inside each lane**, right after install. It collects the job's own pytest commands in that lane's environment, so it sees what the lane actually runs. It reports the skipping file by name. This matters because a file that imports a skipping helper is otherwise blamed on the helper's line: `test_chat_inline_web_ssrf.py` was hidden that way. - **Two moved files needed repairs to pass together.** `test_chat_fix_contracts.py` picked up file tools leaked from earlier tests. `test_chat_system_prompt_budget.py` evicted the chat agent module at collection, so other files' patches stopped hitting it. - **Two files stay allowlisted with no lane, for an owner to decide.** `test_profilespec_characterization.py` has 11 golden rows that drifted, and its docstring says golden updates need sign-off. `test_tool_loader_token_budget.py` has 4 token and tool-count pins that are stale, and even re-pinned, one ratio is over budget. Overlaps: amd#4350 is also stacked on amd#4344 and edits the offline-integration list and the allowlist, so expect a small conflict there. amd#4038, amd#3721, amd#3669, amd#3812 and amd#3072 touch other parts of `test_unit.yml` and `test_gaia_agent.yml`. ## Test plan - [x] Before: `python util/check_module_skips.py --workflow test_unit.yml --job unit-tests` with no `module_skips` entries reports 80 files skipping wholesale and exits 1 - [x] After: the guard exits 0 for all 7 guarded jobs, each run in a clean py3.12 venv built from that job's install step - [x] `python util/check_test_lane_coverage.py` and `python util/lint.py --test-lanes` pass (31 module-skip entries verified) - [x] New tests: `pytest tests/unit/test_check_module_skips.py tests/unit/test_check_test_lane_coverage.py` passes 64. They include a real `--collect-only` over a temp repo - [x] Chat-lane files in the chat env: 421 passed. Before the two test repairs, 2 failed when run together - [x] Flagship-lane files in the gaia env: 59 passed. `test_mcp2_server.py` plus the MCP transcript tests in the MCP env: 27 passed - [x] Email unit lane's full command plus `test_synthetic_mbox.py`: 4980 passed - [x] The 4 newly unskipped files in the unit job (docx, pptx, reportlab, slack): 60 passed. Full `tests/unit/` in that env: 14509 passed, 23 failed. The failures are in 3 files (uninstall, CLI smoke, Lemonade ASR) that also fail when run alone. They come from this Mac's setup: `GAIA_HOME` isolated and `gaia` not on PATH. This PR changes no code those files exercise - [x] `actionlint` is clean on the 6 edited workflows. `black`, `isort`, and `pylint --errors-only` are clean on the changed Python - [ ] Watch the MCP lane's Windows leg run `test_mcp2_server.py` and the guard. They were only run on macOS locally Fixes amd#4206 --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: f <f@f> Co-authored-by: probe <probe@local>
…ess, TheRock tier, metering) (amd#4335) Comparing GAIA with Claude Code, or one model with another, needed a local lab folder nobody else could run — so every number it produced had to be taken on trust. `gaia eval tasks run --harness claude-code` now drives Claude Code over the same tasks, fixtures, time limit and judge the flagship gets, `--repeats N` shows the spread instead of one draw, and `gaia eval tasks report` builds the harness × model table. Anyone with a checkout can reproduce the comparison, and a follow-up can run it nightly. On the same open-weights model, GAIA completes the same work at equal quality for 2.2–2.9× less cost and about a third of the tokens. ### What it measures today (14 everyday tasks, harness × model) | Model | Harness | Runs | Passed | Quality | Truthful | Steps | Tokens | Time | Cost | % of Opus cost | |---|---|---|---|---|---|---|---|---|---|---| | Claude Opus 5 · `claude-opus-5` | Claude Code | 1 | 14/14 | 5.00 | 5.00 | 83 | 2.4M | 7:36 | $3.89 API-equivalent | 100% | | Claude Sonnet 5 · `claude-sonnet-5` | Claude Code | 1 | 14/14 | 4.95 | 4.93 | 86 | 2.1M | 5:14 | $1.33 API-equivalent | 34% | | DeepSeek V4.1 Flash · `deepseek-v4p1-flash` | Claude Code | 3 | 14/14 | 4.87 (4.80–4.93) | 4.80 (4.64–4.90) | 126 (122–131) | 3.9M (3.6M–4.1M) | 8:18 (6:51–10:06) | $0.26 ($0.25–$0.27) | 7% | | DeepSeek V4.1 Flash · `deepseek-v4p1-flash` | **GAIA** | 3 | 14/14 | 4.92 (4.89–4.96) | 4.85 (4.71–4.93) | 83 (81–84) | 1.1M | 5:39 (5:05–6:32) | $0.10 | 3% | | Kimi K2.7 Code · `kimi-k2p7-code` | Claude Code | 3 | 14/14 | 4.69 (4.59–4.77) | 4.93 (4.86–5.00) | 121 (97–168) | 3.4M (2.6M–4.8M) | 9:32 (4:06–18:30) | $1.11 ($0.93–$1.46) | 29% | | Kimi K2.7 Code · `kimi-k2p7-code` | **GAIA** | 3 | 14/14 | 4.68 (4.66–4.70) | 4.95 (4.93–5.00) | 84 (78–90) | 0.9M (0.8M–1.0M) | 5:09 (4:44–5:54) | $0.41 ($0.37–$0.43) | 10% | | GLM-5.3 Flash · `glm-5p3-flash` | Claude Code | 3 | 14/14 | 4.87 (4.84–4.93) | 4.82 (4.79–4.90) | 104 (92–121) | 3.4M (2.9M–4.1M) | 7:25 (5:58–10:13) | $0.20 ($0.18–$0.23) | 5% | | GLM-5.3 Flash · `glm-5p3-flash` | **GAIA** | 3 | 14/14 | 4.89 (4.80–4.95) | 4.93 (4.80–5.00) | 98 (93–101) | 1.3M (1.2M–1.3M) | 7:04 (6:20–8:13) | $0.09 | 2% | - The Anthropic rows run on a Claude subscription, so their cost is the API list-price equivalent Claude Code reports, not money spent. - Open-model costs are real Fireworks charges from the billing meter. - Quality is the mean of four 1–5 axes from a blind Opus judge. A planted control confirms the judge separates honest, fabricated and empty work. - Numbers in brackets are min–max across runs; a gap smaller than that range is noise. - These were produced on a developer machine with the tools in this PR; the nightly CI follow-up will produce them from `main`. TheRock tier results will be added once its reruns complete. A live 14-task run on GLM-5.3 Flash through this harness reproduced the GAIA row above to the cent ($0.095 measured against $0.09 in the table), which is the first independent check that these numbers can be reproduced by someone other than their author. ### What a reviewer should look at Four things beyond "it runs another harness", each of which was a real bug in the earlier comparison and now has a regression test: - **Equal conditions.** Both agents get the same wall-clock cap (one leg was hard-coded to 900 s while the other had 1800 s) and the same project toolchain on `PATH` (Claude Code had been pip-installing pytest before it could test anything). A run cut off at the cap keeps its partial record instead of reporting zero turns, and both are judged from the same tool record — reading only one harness's transcript shape once told the judge that no Claude Code attempt had ever run a test. - **The answer is not on disk.** TheRock tasks check out the fix's *true parent* with the remote removed, so `git log --all` cannot find the fix; the reference diff is fetched only by the judge step, after the agent has exited. GitHub's `base.sha` is not that parent for amd#7998, so the harness verifies the parent and refuses to grade if it differs. - **Cost says what kind of dollar it is.** `metered`, `api_equivalent` and `harness_counts` are three different things; the reports label the API-equivalent cells and never sum them silently. A run that reached the model but counted no tokens reads `n/a`, never `$0.00`. - **Nothing publishable carries a secret.** No provider key is in the agent's environment, every artifact is scrubbed before it is written and the run *fails* if a secret survives, and `gh` inside a task is an offline stand-in that refuses writes. `--fence` (macOS `sandbox-exec`) fences the agent off the answer keys; on Linux it is refused rather than pretended, because the grading step already separates them structurally. ### Test plan - [x] `pytest tests/unit/eval tests/integration/eval/test_bench_e2e.py tests/unit/test_skills_cli.py` — 1037 passed, 4 skipped - [x] Lint: `black`, `isort`, `flake8` and `pylint` clean on every changed file (`util/lint.py --black --isort` also flags three files unrelated to this PR that already fail on `main`: `src/gaia/connectors/api.py`, `tests/integration/test_email_rest_http_corpus.py`, `tests/integration/test_email_corpus_alignment.py`) - [x] **The full 14-task `everyday` suite on a Fireworks-routed model** (`fireworks.glm-5p3-flash`, GAIA harness): 13/14 passed, quality 4.88, 101 steps, 1.38M tokens, 11:46, priced from harness counts at **$0.095** — within a cent of this table's GLM/GAIA row, an independent check of the rate card. All six newly ported tasks passed; the five GitHub tasks reached their issues through the offline stand-in (26 calls, 0 blocked writes) - [x] The judge's "no usable grade" path, unrehearsed: one question came back without a grade, and it was reported as unjudged, counted as not passed and warned about, rather than scored - [x] Claude Code harness end to end on `claude-sonnet-5`, cost recorded as `api_equivalent` - [x] **Claude Code through the model gateway on a Fireworks-routed model** (`fireworks.deepseek-v4p1-flash`, 2 tasks): the gateway's credential replacement and routing carried 5 and 6 calls, and the GitHub task used the stand-in (4 calls, 0 blocked writes) - [x] `gaia eval tasks controls` against the real Opus judge: ideal 5·4·5·5, fabricated 5·4·2·1, nothing 1·1·1·1 — each met its expectation - [x] `gaia eval tasks report` on two real runs: markdown, self-contained HTML and PNG, with the API-equivalent cell labelled and an un-carded model shown as `n/a` - [x] TheRock pins verified against the public repository: both checkouts land on the pinned base with no remote, and both reference diffs match the upstream fix's file set - [x] **Docs:** added the [Agent Benchmarks guide](docs/reference/agent-benchmarks.mdx) and ran every quick-start command for real, including a reproduction check against an independent run that agreed on pass/fail for both spot-checked tasks - [ ] **The `metered` cost source end to end.** Blocked on credentials, not on code: the Fireworks key lives in a macOS keychain item whose ACL requires interactive authorisation, so no unattended process can read it. Running the check needs `FIREWORKS_API_KEY` and `FIREWORKS_ACCOUNT_ID` in the environment; everything up to the billing call is exercised by unit tests (fixed window, negative-delta refusal, billing aliases, header-only key use). The attempt did surface a real defect, now fixed: that read used to hang forever instead of failing - [ ] `gaia eval agent` — not run; no agent prompt, tool schema, model default or tool-call parsing is touched by this PR ### Not in this PR The GitHub Actions workflows. A follow-up adds a nightly workflow that runs the matrix in parallel from `main`, compares against prior runs' artifacts (no result data is ever committed), and routes regressions to the existing `bug`-label auto-fix path. Every choice that workflow makes is already a flag here, so it stays thin. --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: kovtcharov-amd <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: f <f@f> Co-authored-by: Tomasz Iniewicz <[email protected]> Co-authored-by: probe <probe@local>
…arks (amd#4400) **Stacked on amd#4335 — merge that first.** This branch is `feat/eval-harness-benchmarks` plus one commit; the diff against `main` shows both until amd#4335 lands. The agent benchmarks could only be compared with each other: `everyday` is a project built for the benchmark and `therock` has no published numbers. `gaia eval tasks run --suite swebench` now runs either harness on SWE-bench Verified instances — the public yardstick — and grades the patches with the official SWE-bench harness in Docker, so a GAIA number can be set beside a published one on the same instances and grader. Nothing of the dataset is committed: instances are fetched from Hugging Face at run time and cached under the work root, the checkout is built the leak-proof way amd#4335 builds TheRock's (bare cache by commit, `file://` clone at depth 200, `git fsck` must find nothing), and the amd64-only 3 GB images are pulled and removed one at a time. ## Test plan - [x] `pytest tests/unit/eval` — 1036 passed, 2 skipped (31 new in `test_bench_swebench.py`: stubbed fetcher, real-git checkout with exact argv, prediction capture, mocked harness/docker argv and pull→grade→rmi order, report parsing in the swebench 5.x shape, run/judge/grade through the suite, CLI flags) - [x] `python util/lint.py --black --isort`; flake8 and pylint clean on the changed files - [ ] `gaia eval tasks run --suite swebench --no-judge --out /tmp/swe` on a machine with Docker and `pip install swebench` — not run here: the local Docker Desktop VM is wedged (needs a GUI reset), so `evaluate` is verified against the harness's argv and report format only, not a live container - [ ] The five-instance pilot on both harnesses, then `gaia eval tasks report` --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
…swer' into next-4401
A model that is corrected on one unbacked test claim can answer only about that claim, and that short reply becomes the final answer the user sees. In a GLM-5.3 Flash run of the code-review task the model wrote the full prioritized review, was told the record showed no test run, ran the tests, and replied "verified now, 3 passed" — the review it had written was gone, and the judge scored the task 2.75 against 5.0 for the same model without the correction. The correction now tells the model that its next answer replaces the previous one and asks for the complete answer again, and the correction itself is written to the transcript, where before only the model's reply to it appeared.
Test plan
pytest tests/unit/agents/test_unsupported_test_claim.py tests/unit/agents/test_verification*.py— 260 passed; the new test pins the wording and that the correction is on the record11-codereviewbenchmark task on GLM-5.3 Flash, 3 runs, judged — the review must survive the correction (queued behind the validation pass)