Skip to content

Log response body on event stream transport error#69

Merged
olsonjeffery merged 3 commits into
mainfrom
task/6-bug-still-seeingerror-decoding
Jul 24, 2026
Merged

Log response body on event stream transport error#69
olsonjeffery merged 3 commits into
mainfrom
task/6-bug-still-seeingerror-decoding

Conversation

@olsonjeffery

Copy link
Copy Markdown
Owner

Summary

When the SSE event stream's bytes_stream() yields a reqwest transport error (typically a framing/connection issue), the current code discards the partially-received response body without logging it. This makes it impossible to diagnose the root cause from log output.

Changes

  • src/opencode_sdk/client.rs: Added tracing::warn! logging of the full buffered body (self.buf) in EventStream::poll_next() when the byte stream yields Err(e)
  • Added unit test that verifies the buffered body is logged on stream error by capturing tracing log output

Testing

  • New unit test captures tracing subscriber output and asserts the body appears in log records
  • Existing CI integration tests continue to pass

- In EventStream::poll_next(), when the byte stream yields a reqwest
  error, log the full buffered body (self.buf) via tracing::warn! with
  error and body fields
- Add test_event_stream_error_logs_body that creates a stream yielding
  partial data then a transport error, capturing the tracing output
  to verify the body appears in the log
@olsonjeffery
olsonjeffery force-pushed the task/6-bug-still-seeingerror-decoding branch from e1aedff to d1e9be8 Compare July 23, 2026 21:31
@olsonjeffery
olsonjeffery merged commit 116fe75 into main Jul 24, 2026
3 checks passed
@olsonjeffery
olsonjeffery deleted the task/6-bug-still-seeingerror-decoding branch July 24, 2026 11:27
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.

1 participant