Repository navigation
Conversation
With a zero-event executor, message/send hung forever: the result was None and ActiveTask.get_task() awaited _task_created with no timeout, but _task_created is only set when a task event is processed, the task pre-existed at start(), or the producer failed — none of which happens on a silent success path (issue a2aproject#1330). Per the approach endorsed on the issue, fail fast with InternalError when the subscribe loop finished without a task event, guarded by the new ActiveTask.task_created_is_set() accessor. The legacy handler's unreachable 'raise InternalError' guard is unchanged; making it reachable is a separate follow-up. Signed-off-by: andy <linux2011@qq.com>
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/agent_execution/active_task.py | 95.40% | 95.42% | 🟢 +0.02% |
| src/a2a/server/cluster/database_event_stream.py | 96.94% | 92.86% | 🔴 -4.08% |
| src/a2a/server/request_handlers/default_request_handler_v2.py | 87.46% | 86.74% | 🔴 -0.72% |
| Total | 93.17% | 93.11% | 🔴 -0.07% |
Generated by coverage-comment.yml
Open
1 task done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With an
AgentExecutorthat returns normally without enqueueing any event,message/sendhung forever on both the request coroutine and the ActiveTask producer/consumer tasks:resultwasNone, andActiveTask.get_task()awaited_task_createdwith no timeout — but_task_createdis only set when a task event is processed, the task pre-existed atstart(), or the producer failed. A silent success path sets none of them. Root-cause analysis and a runtime reproduction are in #1330.Per the approach endorsed on the issue, this fail-fasts with
InternalErrorwhen the subscribe loop finishes without a task event:ActiveTask.task_created_is_set()accessor (public wrapper over the internal_task_createdevent) so the handler doesn't reach into private state.DefaultRequestHandlerV2.on_message_send: raiseInternalErrorwhenresult is Noneandtask_created_is_set()is False, before awaitingget_task().Follow-up (not in this PR): the legacy handler contains an equivalent
raise InternalErrorguard (default_request_handler.py:456) that is empirically unreachable in this scenario — the flow blocks earlier inconsume_and_break_on_interrupt. Making that reachable is a separate piece of work.fix:→ SemVer patch)Fixes #1330 🦕
Validation
InternalErrorinstead of hanging; an event-producing executor is unaffected.message/sendnever returns (3s+ timeout in repro, issue [Bug]: message/send hangs forever when the AgentExecutor returns without producing events #1330). AFTER: raisesInternalError('Agent execution produced no events')immediately.test_on_message_send_raises_when_agent_produces_no_events; handler + agent_execution suites green.is_set()guard fully covers the unreachable-wait case; happy to add on request.Prepared with AI assistance (WorkBuddy); reviewed and verified by Linux2010