Skip to content

Conversation

@harshav167
Copy link

Summary

Fixes SSE parsing issues when Codex API returns non-standard SSE formats.

Changes

  • Handle data: with or without space after colon (both data: {...} and data:{...})
  • Support multiline JSON split across multiple data: lines
  • Graceful fallback chain: finalResponselastResponseLikelastEvent
  • Skip malformed JSON lines while preserving valid subsequent events
  • Add tests for edge cases (no-space colon, multiline data)

Files Changed

  • lib/request/response-handler.ts - Enhanced SSE parsing logic
  • test/response-handler.test.ts - Added edge case tests

- Handle data: with or without space after colon
- Support multiline JSON split across multiple data: lines
- Graceful fallback chain: finalResponse → lastResponseLike → lastEvent
- Skip malformed JSON lines while preserving valid subsequent events
- Add tests for edge cases (no-space colon, multiline data)
@numman-ali
Copy link
Owner

Thanks! I haven’t been able to reproduce yet. If you can share a failing raw SSE payload or ~/.opencode/logs/codex-plugin/request-*-response.json, I’ll validate and fold this in.

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.

2 participants