Skip to content

feat(task-tool): emit diagnostic when subagent returns no text part (#24447)#28021

Open
PeterPonyu wants to merge 1 commit into
anomalyco:devfrom
PeterPonyu:feat/opencode-24447-tasktool-empty-result-diagnostics
Open

feat(task-tool): emit diagnostic when subagent returns no text part (#24447)#28021
PeterPonyu wants to merge 1 commit into
anomalyco:devfrom
PeterPonyu:feat/opencode-24447-tasktool-empty-result-diagnostics

Conversation

@PeterPonyu
Copy link
Copy Markdown

@PeterPonyu PeterPonyu commented May 17, 2026

Issue for this PR

Closes #24447

Type of change

  • Bug fix

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 failed
  • bun typecheck — passed

Screenshots / recordings

N/A — runtime-only task tool serialization change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…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>
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.

TaskTool returns no diagnostic context when subagent result text is empty or missing

1 participant