Skip to content

fix(session): normalize wrapped subagent stream errors#28898

Open
ririnto wants to merge 1 commit into
anomalyco:devfrom
ririnto:fix/wrapped-subagent-stream-errors
Open

fix(session): normalize wrapped subagent stream errors#28898
ririnto wants to merge 1 commit into
anomalyco:devfrom
ririnto:fix/wrapped-subagent-stream-errors

Conversation

@ririnto
Copy link
Copy Markdown

@ririnto ririnto commented May 22, 2026

Issue for this PR

Fixes #21979
Related #26129

Type of change

  • Bug fix

What does this PR do?

Normalizes wrapped provider stream error envelopes before generic Error values become UnknownError.

This covers OpenAI stream payloads shaped like:

{"error":{"type":"error","sequence_number":2,"error":{"type":"service_unavailable_error","code":"server_is_overloaded","message":"Our servers are currently overloaded. Please try again later."}}}

It also makes the task tool fail when a child assistant returns terminal info.error without text, instead of reporting an empty successful task result to the parent.

This intentionally does not add retry caps, retry_exhausted, TUI states, fallback redesign, or OMO changes.

How did you verify your code works?

  • bun test --timeout 30000 test/session/retry.test.ts test/tool/task.test.ts from packages/opencode — 50 pass, 0 fail
  • bun run typecheck from packages/opencode
  • git diff --check
  • Pre-push bun turbo typecheck — 15 successful, 15 total

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:

Based on the search results, I found one PR that appears closely related:

Related PR:

The current PR (#28898) is specifically about normalizing wrapped subagent stream error envelopes before they become generic errors, while #26167 handles empty stream truncations. They both deal with session stream error handling but address different specific scenarios.

No exact duplicate PRs found - this appears to be addressing a distinct issue (#21979) related to wrapped provider stream error normalization.

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.

Wrapped stream error chunks bypass retry and can leave parent sessions waiting forever

1 participant