Skip to content

fix(agent): never read an unanswered question as the user's answer - #7322

Merged
kovtcharov-amd merged 2 commits into
amd:mainfrom
kovtcharov:kalin/rc18-unanswered-question
Nov 12, 2026
Merged

kovtcharov-amd merged 2 commits into
amd:mainfrom
kovtcharov:kalin/rc18-unanswered-question

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

When nobody answered "What kind of cleanup do you want?" within five
minutes, the agent was handed its own default as if the user had picked
it, moved 15 files and replied "Done". Now it is told the user did not
answer; its reply has to say what it assumed, and any step that changes
files after that waits for a person's approval, even with Full access on.
Closes #7294

Draft until it is replayed in the app: this changes a check or tool result the agent reads.

Test plan

  • python -m pytest hub/agents/gaia/python/tests/test_unanswered_question.py hub/agents/gaia/python/tests/test_request_user_input_window.py (15 pass; 6 fail on main)
  • Replay in Full access on a cloud model: leave a clarifying question unanswered for 5 minutes; nothing is moved or written, and the reply says it assumed
  • Eval categories to watch: gaia_resilience and any category with clarifying questions

When nobody answered "What kind of cleanup do you want?" within five
minutes, the agent was handed its own default as if the user had picked
it, moved 15 files and replied "Done". Now it is told the user did not
answer; its reply has to say what it assumed, and any step that changes
files after that waits for a person's approval, even with Full access on.

request_user_input no longer passes the model's default to the console as
the timeout value: a timeout returns "__NO_RESPONSE__" with a plain
statement that nobody answered, naming the default only as an assumption.
The turn remembers the unanswered question, and ChatAgent marks any
non-read call after it with NEEDS_PERSON_ARG, which pre-approval never
answers; an answered question clears the hold.

Closes #ISSUE
@github-actions github-actions Bot added the documentation Documentation changes label Nov 12, 2026
@kovtcharov
kovtcharov marked this pull request as ready for review November 12, 2026 06:09
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

This fixes a real problem. When a user leaves a clarifying question unanswered, the agent no longer treats its own default as the user's choice, and file changes made after that wait for a person, even with Full access on. One gap remains in the hold. Some actions still go through without asking: removing a skill, wiping memory, installing a CLI and connector (MCP) tools. They get through because the check only knows the risk of shell, Python and file-writing tools. In the rc18 scenario a connector tool could still move or write files on the guessed answer.

  • Close the gap: hold every approval-gated action after an unanswered question unless it is known to be read-only. Don't limit the hold to the tools the risk table knows.
  • Update the stale spec: the autonomous-agent-mode spec still says a timeout returns the default as the answer.

Real-world evidence

N/A: no evidence bundle was produced for this run. This review rests on reading the code alone. Pytest isn't installed on this runner, so the new tests weren't run here either. The PR is open as a draft until it is replayed in the app. Its unchecked Full-access replay item is the evidence that matters, and so are the eval categories it names (gaia_resilience and any category with clarifying questions). Both should happen before merge, because this change alters a tool result and a tool docstring the model reads.

🔍 Technical details

Issues

🟡 The hold skips gated tools that call_risk has no opinion on (hub/agents/gaia/python/gaia_agent/chat_agent.py:2378)
call_risk returns None for everything outside shell, code and the _FILE_WRITE_TOOLS set. Those calls include gated tools that change state: remove_skill, install_skill, capture_skill, forget_everything, install_cli, sign_in_cli, every mcp_* tool (fail-closed gated in _tool_requires_confirmation) and skill tools such as calendar and send-email. With Full access on, any of these still runs on the guessed answer, which breaks the promise in the PR body and in docs/guides/gaia.mdx.

Treating only a known read as exempt is safe. NEEDS_PERSON_ARG only changes behaviour on a call that _tool_requires_confirmation already gates (agent.py:7928), so it adds no new prompts for ungated tools:

        if call_risk(tool_name, tool_args) == READ:
            return shown

After this change, test_reading_after_an_unanswered_question_is_unchanged needs read_file swapped for a check that the prompt never fires (or drop that case). The dir shell case still holds. Add an mcp_* or remove_skill case to the "needs a person" parametrize.

🟡 Spec still documents the old timeout contract (docs/spec/autonomous-agent-mode.md:289, :298, :314, :320-321)
The spec says "Timeout + default_if_no_response set: returns the default" and "response is always a real value here — default used on timeout". The tool now never returns the default as an answer. Line 839 says the UI shows "will use default if no reply", but the default is no longer passed to the console, so that note no longer appears. The SSEOutputHandler.request_user_input_blocking docstring (src/gaia/ui/sse_handler.py:2469) describes the console, which still honours a default for other callers, so it can stay.

Strengths

  • The fix is in the right place: the default never reaches the console, so no surface can return it as the user's answer. The hold uses the existing NEEDS_PERSON_ARG mechanism instead of a new gate.
  • The tests reproduce the rc18 cleanup scenario directly. They also cover the non-obvious cases: a real answer that happens to equal the default, and a later answer lifting the hold.

The hold only covered shell, Python and file-writing tools, so a connector
(MCP) tool, remove_skill, forget_everything, install_cli or a skill's send
still ran on the model's guessed answer with Full access on. Now every gated
call that is not a known read waits for a person; the marker only matters on
a call that already asks, so ungated tools gain no prompt.

The autonomous-agent-mode spec still promised the default back on a
timeout; it now describes the "__NO_RESPONSE__" result and the hold.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Both review points are fixed in d7e0784: after an unanswered question, every action that already asks for approval now waits for a person unless it is a known read-only command, and the spec no longer says a timeout returns the default.

🔍 Technical details
  • confirmation_args_for_call now exempts only call_risk(...) == READ. Connector (mcp_*) tools, remove_skill, forget_everything, install_cli, skill sends, and shell lines that read then change (dir & del a.txt, git status && git push) are held. An empty command is held too. The marker only takes effect on calls _tool_requires_confirmation already gates, so ungated reads like read_file get no new prompt.
  • New tests: those cases, a fresh unanswered question after an answer holds again, and an empty reply counts as no answer. Six of them fail under the old in (None, READ) rule.
  • docs/spec/autonomous-agent-mode.md: the docstring, return contract, both code samples (startswith("__NO_RESPONSE__")) and the UI card ("will use default if no reply" is gone) now match.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 12, 2026
Merged via the queue into amd:main with commit 2a8b325 Nov 12, 2026
38 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/rc18-unanswered-question branch November 12, 2026 08:01
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Nov 12, 2026
amd#7276, amd#7277, amd#7278, amd#7248, amd#7319 and amd#7322 merged, so their seven strict
expected failures now pass and would turn the unit job red. The two left
(amd#7321 open, amd#7326 unfixed) still fail as recorded.

The stand-in console now returns an empty-string default the way the real
transport does, instead of reading it as no default.
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Nov 12, 2026
The rc18 release test found seven cases where GAIA's own answer checks
got a turn wrong: a correct read-only answer ended with "I couldn't
confirm all of this", a plan the user asked for was thrown away, an
unanswered question became the user's answer. Each check had unit tests
and none caught these, because every case needed the request, the tool
results and the answer together. This adds a corpus of recorded turns
and one test that replays each through the real loop with no model, so a
misfire seen once in a release test becomes a file that guards it for
good.

Seeded with 16 turns: a "must not fire" and a "must fire" case for each
of F8, F10, F11, F12, F36, F80 and F81. Adding a case is adding a JSON
file; the README beside the cases says how to make one from a
transcript.

**Bugs it found** (a bug still open is a strict expected failure, so the
fix has to delete the marker):

| Case | Issue | Fix |
|---|---|---|
| Read-only answer that says "I wrote no file" gets the unsaved-file
note | amd#7178 | amd#7276 (merged, marker removed) |
| Answer quoting an edit's own backup path gets the note | amd#7179 | amd#7277
(merged, marker removed) |
| A plan the user asked for is sent back as unfinished work | amd#7180 |
amd#7278 (merged, marker removed) |
| "Do NOT run anything" is answered with GAIA's own "look first" message
| amd#7181 | amd#7278 (merged, marker removed) |
| A native tool call is shown as answer text | amd#7205 | amd#7248 (merged,
marker removed) |
| A fixed test's rerun with a different `tail` reads as an unpassed
check | amd#7293 | amd#7319 (merged, marker removed) |
| A file a script wrote beside its input is called unwritten | amd#7293 |
amd#7321 (merged, marker removed) |
| Silence after a question is handed to the model as the user's answer |
amd#7294 | amd#7322 (merged, marker removed) |
| **New:** "I also saved it to X" with no write gets no note | amd#7326 |
none yet |

I replayed the corpus on each fix branch: every case passes there, so
the markers come off as those PRs land.

## Test plan

- [ ] `python -m pytest tests/unit/agents/test_answer_check_corpus.py
-q` reports 17 passed, 1 xfailed
- [ ] Delete the `"xfail"` line from any case and the test fails with
the note or nudge the tester saw
- [ ] Runs in the existing unit job (`test_unit.yml` runs
`tests/unit/`), no workflow change needed

<details>
<summary>🔍 Technical details</summary>

- `kind: "turn"` builds a bare `Agent` whose tools are stand-ins
returning the recorded results (and writing the files the real call
wrote, since the checks stat the disk), scripts the model's replies, and
runs `process_query`.
- `kind: "stream"` feeds recorded provider chunks to
`AgentSDK.send_messages_stream` (F36 lives below the loop).
- `kind: "question"` calls the flagship's real `request_user_input` with
a console that answers or stays silent (F81 is the tool's contract, not
a check).
- Unknown keys in a case are an error, so a typo cannot turn an
assertion off.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent: an unanswered question becomes its own choice after 5 minutes

2 participants