Skip to content

fix(ai): remove over-safe provider error handling - #42610

Merged
rekram1-node merged 1 commit into
v2from
structured-errors
Aug 14, 2026
Merged

rekram1-node merged 1 commit into
v2from
structured-errors

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This removes the native request executor's vibed, over-safe provider-error policy and aligns it with pre-existing legacy behavior such as the AI SDK path.

Specifically, this kills:

  • the 500-character gate that discarded valid structured provider messages
  • the 16 KiB response-body cap and bodyTruncated behavior
  • structural response-body redaction based on names such as token, secret, key, and authorization
  • literal replacement of request header and query values echoed by providers
  • automatic masking of request URL query parameters
  • automatic and CurrentRedactedNames-driven request/response header redaction at the executor seam
  • raw-body display for short unrecognized payloads

Structured error.message and top-level message values are now parsed from the complete response and surfaced regardless of size. Complete response bodies, URLs, headers, and transport messages are retained in HTTP diagnostics. Unrecognized or malformed payloads use the generic HTTP status fallback rather than being printed as the user-facing message.

Why

The removed behavior was vibed, "over-safe", and inconsistent with pre-existing legacy behavior from integrations such as the AI SDK. It silently threw away useful provider errors based on arbitrary body-length thresholds and applied a separate sanitization policy only to the native path. Matching the established behavior makes native and legacy provider failures predictable and preserves the actual diagnostic evidence.

Checks

  • bun test test/executor.test.ts --timeout 30000 --test-name-pattern 'RequestExecutor'
  • bun test test/provider/openai-chat.test.ts test/provider/openai-responses.test.ts test/provider/anthropic-messages.test.ts --timeout 30000 --test-name-pattern 'fails HTTP provider errors before stream parsing'
  • bun typecheck

Requested by: @rekram1-node (Aiden Cline via Slack)

@opencode-agent
opencode-agent Bot force-pushed the structured-errors branch 2 times, most recently from 59cc78e to 877e8c3 Compare August 14, 2026 16:45
@opencode-agent opencode-agent Bot changed the title fix(ai): preserve structured provider errors fix(ai): remove over-safe provider error handling Aug 14, 2026
@rekram1-node
rekram1-node merged commit d6c299c into v2 Aug 14, 2026
7 of 8 checks passed
@rekram1-node
rekram1-node deleted the structured-errors branch August 14, 2026 17:09
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant