mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-24 04:01:10 -04:00
b839e53c5c
When providers like OpenAI return a stream successfully but error during iteration (e.g., insufficient_quota mid-stream), the fallback system now catches these errors and switches to a fallback provider. Key changes: - Add wrapFullStream() using Proxy to intercept async iteration - Add tryMidStreamFallback() for mid-stream recovery - Wrap all returned streams with the mid-stream error handler - Emit FallbackUsed event with "mid-stream:" reason prefix Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>