Skip to content

fix(opencode): fail task on empty subagent output#29239

Open
YOMXXX wants to merge 1 commit into
anomalyco:devfrom
YOMXXX:fix/task-empty-output-error
Open

fix(opencode): fail task on empty subagent output#29239
YOMXXX wants to merge 1 commit into
anomalyco:devfrom
YOMXXX:fix/task-empty-output-error

Conversation

@YOMXXX
Copy link
Copy Markdown

@YOMXXX YOMXXX commented May 25, 2026

Issue for this PR

Closes #29054

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The task tool previously treated a subagent response with no meaningful text as a successful empty <task_result>. That made upstream fallback/retry logic see the task as successful even though there was no usable result.

This changes TaskTool.runTask to fail when the subagent returns no text output or only whitespace, while preserving the original non-empty text for successful task results. Background tasks now naturally record this case as an error through the existing background error path.

How did you verify your code works?

  • bun test test/tool/task.test.ts -t "execute fails when the subagent returns empty text output" from packages/opencode
  • bun test test/tool/task.test.ts from packages/opencode
  • bun typecheck from packages/opencode
  • bun turbo typecheck from repo root
  • .husky/pre-push from repo root

Screenshots / recordings

Not applicable.

Checklist

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

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found a potentially related PR:

PR #29048: fix(tool): trigger fallback on empty task output
#29048

Why it might be related: This PR directly addresses the same issue (triggering fallback on empty task output) and is likely addressing the same GitHub issue #29054. Both PRs are focused on handling empty task outputs to prevent successful task states when no meaningful result exists.

@YOMXXX
Copy link
Copy Markdown
Author

YOMXXX commented May 25, 2026

Thanks for the duplicate check. This is closely related to #29048. The implementation is intentionally small in the same code path, but this PR also adds regression coverage in test/tool/task.test.ts proving that an empty subagent text response now fails instead of returning a successful empty <task_result>.

If maintainers prefer #29048, this can be closed, but this PR keeps the same behavior test-covered and verified with the package task tests and typecheck.

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: Empty task output breaks fallback system

1 participant