Skip to content

fix(agent): fail --live gate on unusable model replies - #6606

Merged
kovtcharov-amd merged 2 commits into
amd:mainfrom
burgulvedant:fix/live-gate-unusable-reply
Nov 4, 2026
Merged

kovtcharov-amd merged 2 commits into
amd:mainfrom
burgulvedant:fix/live-gate-unusable-reply

Conversation

@burgulvedant

@burgulvedant burgulvedant commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

gaia agent test --live printed "All live gates passed" even when the model never gave a usable reply: three unparsable tool calls in a row, repeated cut-off replies, or a stream that kept ending early. Those turns now fail the gate with a reason that names the underlying error, so a broken model no longer looks healthy.

Hitting the cut-off limit now also marks the turn failed in the Agent UI and the sidecar, and makes a scheduled run raise an error.

Refs #6578

Test plan

  • python -m pytest tests/unit/test_cli_agent.py tests/unit/agents/test_cut_off_reply_guard.py tests/unit/agents/test_parse_error_recovery.py tests/unit/agents/test_deepseek_tool_markup.py (175 passed)
  • python util/lint.py --black --isort

…sable reply

gaia agent test --live printed "All live gates passed" for a turn whose model output was never usable: three unparsable tool calls in a row, repeated cut-off replies, or a reply stream that kept ending early. The gate now fails on an unrecovered tool_call_parse_error or stream_cut_off at the end of the turn, and the agent sets the model-failed flag when it stops on the cut-off limit. The failure reason now includes the underlying error.

Refs amd#6578
@github-actions github-actions Bot added documentation Documentation changes tests Test changes agents labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

gaia agent test --live used to say "All live gates passed" when the model never gave a usable reply: unparsable tool calls, replies cut off at the token limit, or a stream that kept ending early. Those turns now fail the gate and name the error. The logic is right and the unit tests cover the failing and the recovered case for each kind of bad reply. Two things before merge:

  • The PR description shows no real gaia agent test --live run. Add the output of one run against a healthy model, so we can see the stricter gate doesn't fail a working agent.
  • The fix also changes what the Agent UI, the sidecar and scheduled runs do when replies keep getting cut off. Those surfaces now treat the turn as failed, where before they showed it as an ordinary answer. That is probably the behaviour you want, but the description only mentions the CLI gate. Say so in the description so reviewers of those surfaces know.

Real-world evidence

N/A: no evidence bundle was produced for this run. --live needs a running Lemonade Server, which this runner doesn't have. The verdict rests on static review alone. I couldn't run the unit tests here either (pytest isn't installed on this runner), so I'm going on the author's report of 175 passing.

🔍 Technical details

Issues

🟡 No CLI evidence for a CLI-visible change. The rubric asks for the real gaia agent test --live output on a CLI gate change. A passing run on a healthy model is enough: the failing paths are hard to trigger on demand and the unit tests already cover them. If you can force a cut-off (e.g. a very low max_tokens), the failing output would be worth showing too.

🟢 model_failed now reaches more than the gate (src/gaia/agents/base/agent.py:10857). Setting self._turn_model_retries["failed"] = True on the cut-off give-up path means:

  • src/gaia/ui/_chat_helpers.py:3340 marks the Agent UI turn failed.
  • hub/agents/gaia/python/gaia_agent/server.py:724 sets final["failed"], and :744 (_run_answer) keeps the notice out of the pushed history.
  • src/gaia/ui/server.py:370 makes a scheduled run raise RuntimeError with _CUT_OFF_FAILURE_ANSWER as the message.

All of these look right for a "could not finish this task" notice, but none has a test. One assertion in hub/agents/gaia/python/tests/test_server_query.py, next to the existing model_failed cases, would pin the sidecar side. Your call whether it belongs in this PR.

🟢 Cross-module import of a private constant. _unrecovered_unusable_reply imports _RECOVERABLE_ERROR_TYPES from agent.py. It works, and the lazy import costs nothing once --live has loaded the agent. Still, if this set now serves as a contract between the agent and the CLI, consider dropping the underscore (or re-exporting it) so a rename in agent.py doesn't silently break the gate. The unit tests would catch a rename, so this is minor.

Checked, no issue

  • output_truncated isn't in _RECOVERABLE_ERROR_TYPES, so a cut-off the model recovered from never trips _unrecovered_unusable_reply. Only the give-up path sets model_failed, and test_a_recovered_cut_off_passes_the_live_gate pins that.
  • _mark_errors_recovered flags exactly the types the new helper reads, so a retried parse error or stream cut-off passes the gate.
  • The cli.mdx --live row matches the new behaviour. I found no other doc describing the old gate.

Strengths

  • The gate reuses the agent's own "recovered" bookkeeping instead of re-deriving it from the transcript, so the CLI and the agent can't disagree about which errors still stand.
  • Tests run real process_query turns with stubbed replies, not hand-built result dicts, so they exercise the actual contract between agent and gate.
  • The failure reason now carries the underlying error ("…(reply cut off at the output-token limit)"), which tells the user what to fix.

…remedy

A turn whose step-cap, loop-guard, or post-answer closing call parsed cleanly
was still failed by an earlier unparsable reply. Unusable or cut-off replies
now point at the model choice or max_tokens instead of Lemonade being down.
@kovtcharov-amd kovtcharov-amd added this to the v0.25.4 milestone Nov 4, 2026
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 4, 2026
Merged via the queue into amd:main with commit 8117382 Nov 4, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants