Fix subagent publishing before A2A response arrives (0.10.62)#401
Merged
Conversation
A subagent that dispatches an A2A task via spawn_wisps was treating the "dispatched, result async" ack as a final answer and publishing success immediately. When the target agent's actual response landed, the originating subagent session had exited; A2ATaskResultHandler then skipped synthesis and bubble publish for the non-user session, so the user never saw the result. Add ISessionA2AAwaiter (Host.Abstractions) implemented by A2ATaskAwaiter (RockBot.A2A), wired into SubagentRunner. After the LLM loop completes, the subagent polls A2ATaskTracker for any pending tasks on its session and waits until they reach a terminal state (or the subagent's CT cancels). A2A result keys land in working memory before publish, and the existing SubagentResultHandler whiteboard hint surfaces them to the synthesis turn. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
spawn_wispswere treating the "dispatched, result async" ack as a final answer and publishing success immediately. When the target agent's actual response landed seconds later, the originating subagent session had exited;A2ATaskResultHandlerthen skipped synthesis and bubble publish for the non-user session and the user never saw the result.ISessionA2AAwaiter(Host.Abstractions) implemented byA2ATaskAwaiter(RockBot.A2A), wired intoSubagentRunner. After the LLM loop completes, the subagent pollsA2ATaskTrackerfor any pending tasks on its session and waits for them to reach a terminal state (bounded by the subagent's CT, so cancels/timeouts still resolve promptly).subagent/{taskId}/a2a/{TargetAgent}/{a2aTaskId}/resultand.../result.data) are populated in working memory before the subagent publishes, so the existingSubagentResultHandlerwhiteboard hint surfaces them to the consolidation LLM automatically — no handler changes needed.Test plan
dotnet build RockBot.slnx— cleandotnet test tests/RockBot.A2A.Tests/RockBot.A2A.Tests.csproj— 158 pass (6 new awaiter tests)dotnet test tests/RockBot.Subagent.Tests/RockBot.Subagent.Tests.csproj— 31 passdotnet test tests/RockBot.Wisp.Tests/RockBot.Wisp.Tests.csproj— 117 pass🤖 Generated with Claude Code