1.3 KiB
1.3 KiB
Proxy SSE Minimal Fix
Summary
The local Responses proxy can report upstream_status=200 while still handing OpenCode a broken stream in two narrow cases inside internal/proxy/server.go:
- the upstream returns
200withtext/event-streambut closes before sending any bytes - the upstream sends one SSE chunk and then stays silent longer than
streamIdleTimeout, causing the proxy to terminate a still-valid SSE stream
This task applies the smallest possible fix in the proxy layer only, without changing CLI, desktop, app, config, or public interfaces.
Requirements
- Keep the existing
firstByteTimeoutbehavior. - Treat
readFirstChunk()returningio.EOFwith zero bytes as a retryable pre-first-byte failure. - Do not write downstream
200for that empty first-read case. - Preserve existing failover behavior for transport errors and
429/5xxresponses. - After the first chunk succeeds, bypass
streamIdleTimeoutonly fortext/event-streamresponses. - Keep non-SSE responses on the existing idle-timeout path.
- Add regression coverage for empty-200-SSE failover and long-idle SSE continuation.
Non-Goals
- No proxy refactor.
- No new config flags.
- No changes outside
internal/proxy/server.goandinternal/proxy/server_test.go.