feat: forward all Codex SSE response headers for codex sub#6098
feat: forward all Codex SSE response headers for codex sub#6098seefs001 wants to merge 1 commit into
Conversation
WalkthroughThe stream scanner gains configurable buffering and conditional SSE header copying. Codex channels copy eligible upstream headers, while non-Codex channels preserve legacy behavior. Tests cover header inclusion, exclusion, and multi-valued cookies. ChangesCodex SSE header propagation
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant StreamScannerHandler
participant copyCodexSSEHeaders
participant UpstreamResponse
participant GinWriter
StreamScannerHandler->>copyCodexSSEHeaders: pass Codex channel flag
copyCodexSSEHeaders->>UpstreamResponse: select upstream headers
copyCodexSSEHeaders->>GinWriter: append eligible header values
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@relay/helper/stream_scanner.go`:
- Line 28: Correct the comment for DefaultMaxScannerBufferSize to state that 128
<< 20 is 128MB (128*1024*1024), matching the configured value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 09d0c97a-e733-486c-827d-25fce23f64cb
📒 Files selected for processing (2)
relay/helper/stream_scanner.gorelay/helper/stream_scanner_test.go
| DefaultMaxScannerBufferSize = 128 << 20 // 64MB (64*1024*1024) default SSE buffer size | ||
| DefaultPingInterval = 10 * time.Second | ||
| InitialScannerBufferSize = 64 << 10 // 64KB (64*1024) | ||
| DefaultMaxScannerBufferSize = 128 << 20 // 64MB (64*1024*1024) default SSE buffer size |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix incorrect comment: 128 << 20 is 128MB, not 64MB.
The value 128 << 20 equals 134,217,728 bytes (128MB), but the comment states "64MB (6410241024)". This could mislead developers tuning buffer size.
📝 Proposed fix
- DefaultMaxScannerBufferSize = 128 << 20 // 64MB (64*1024*1024) default SSE buffer size
+ DefaultMaxScannerBufferSize = 128 << 20 // 128MB (128*1024*1024) default SSE buffer size📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| DefaultMaxScannerBufferSize = 128 << 20 // 64MB (64*1024*1024) default SSE buffer size | |
| DefaultMaxScannerBufferSize = 128 << 20 // 128MB (128*1024*1024) default SSE buffer size |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@relay/helper/stream_scanner.go` at line 28, Correct the comment for
DefaultMaxScannerBufferSize to state that 128 << 20 is 128MB (128*1024*1024),
matching the configured value.
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
codex渠道类型全量透传sse response header
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit
New Features
Bug Fixes