Skip to content

fix(server): keep the INPUT_REQUIRED question in task history - #462

Merged
muscariello merged 2 commits into
mainfrom
stack/17-keep-input-required-question
Nov 3, 2026
Merged

muscariello merged 2 commits into
mainfrom
stack/17-keep-input-required-question

Conversation

@muscariello

@muscariello muscariello commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Fixes #433. Replaces #434.

Cause: the agent asks for input in the status message of its INPUT_REQUIRED update, and only there. A continuation appended the user's answer to history, and the next status update replaced task.status, so the question was lost: history read [ask, answer].

Fix: prepare_task_for_execution records the pending status.message in history ahead of the answer when it continues a task. A message already in history (same messageId) is not added twice.

Tests: test_continuation_keeps_the_question_in_history and its send_streaming_message twin give ["ask", "Which file?", "main.rs"] instead of ["ask", "main.rs"]; both fail with the fix reverted. test_continuation_does_not_repeat_a_question_already_in_history covers an agent that put the question there itself, and fails without the messageId check.

Unproven: the spec leaves history persistence to the agent and tells clients not to rely on it, so this is parity with Python, which orders the question the same way. Go puts it after the answer (a2aproject/a2a-go#498). Python also keeps status messages replaced within a run and clears status.message at the continuation; this PR does neither. #434 says the A2A 1.1 line records statuses in a timeline; not checked here.

@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

gulldan and others added 2 commits November 3, 2026 12:03
The agent asks for input in the status message of its INPUT_REQUIRED
update, and only there. A continuation appended the user's answer to
history and the next status update replaced the status, so the question
was lost: history read [ask, answer]. The continuation now records the
pending status message in history ahead of the answer, once.

Signed-off-by: gulldan <5641375+gulldan@users.noreply.github.com>
…in history

The question was only tested through a blocking send. Run the same ask
and answer through send_streaming_message, and add the case where the
agent put its question in history itself, which the messageId check keeps
from being recorded twice.

Signed-off-by: Luca Muscariello <muscariello@ieee.org>
@muscariello
muscariello force-pushed the stack/17-keep-input-required-question branch from a4610cc to f50fcb0 Compare November 3, 2026 11:03
@muscariello
muscariello added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit d7aa87f Nov 3, 2026
22 checks passed
@muscariello
muscariello deleted the stack/17-keep-input-required-question branch November 3, 2026 13:00
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: the agent's INPUT_REQUIRED question disappears from task history after the answer

3 participants