feat(task-tool): emit diagnostic when subagent returns no text part (#24447)#28021
Open
PeterPonyu wants to merge 1 commit into
Open
Conversation
…nomalyco#24447) When a subagent session completes without producing any text part, the parent now receives a structured diagnostic block instead of a silent empty <task_result>. The block includes the finish reason, any error details, and the list of part types actually produced, making it straightforward to distinguish an intentional empty reply (text part present but empty) from a missing-text-part scenario. Co-Authored-By: Claude Sonnet 4.6 <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.
Issue for this PR
Closes #24447
Type of change
What does this PR do?
The task tool previously returned an empty
<task_result>when a subagent response had no text part, which made missing output indistinguishable from an intentionally empty response.This PR preserves intentionally empty text parts, but emits a short diagnostic when no text part exists. The diagnostic includes the finish reason, error if present, and the part types returned by the subagent. Regression tests cover text output, intentionally empty text, and missing text parts.
This replaces auto-closed PR #27888 with a template-compliant PR body.
How did you verify your code works?
From
packages/opencode:bun test test/tool/task.test.ts— 18 passed, 0 failedbun typecheck— passedScreenshots / recordings
N/A — runtime-only task tool serialization change.
Checklist