bug: Streams that are not SSE (Bedrock, Ollama NDJSON) reach the client only when they end
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- go
- 领域
- backend, networking
调研方向
Start in core/listener/forwardproxy/server.go around lines 972 and 1015, then read the existing fix for #1879. Reproduce with a Go test that sends five flushed event-stream lines at 400 ms intervals, with and without a body-reading plugin. Done means supported non-SSE streams reach the client incrementally and are not buffered until completion.
由索引模型根据 Issue 内容生成。
描述
Problem
The proxy streams a response only when its type is text/event-stream. It buffers all other streaming responses until they are complete. These streams arrive at the client only at the end:
- Bedrock
invoke-with-response-stream(application/vnd.amazon.eventstream) - Ollama
/api/chat(application/x-ndjson) - Gemini
streamGenerateContentwithoutalt=sse
These streams also get a 502 when they are larger than 10 MB (see #1879).
Reproduction (main at 676557d35)
A Go test that builds forwardproxy.NewServer with one ReadsBody plugin. The upstream sends Content-Type: application/vnd.amazon.eventstream and writes one line every 400 ms, five times, with a flush after each line.
Result: the client gets the first line after 2.007 s, which is when the upstream ends the stream. Without the proxy, the first line arrives at about 0 s.
Cause
core/listener/forwardproxy/server.go:972: httpx.IsEventStream is the only test for a stream. All other responses go to the buffered branch at server.go:1015 when any plugin reads bodies. inference-parser always reads bodies.
Fix
Use the same fix as #1879: buffer only parsed traffic. Also send ContentLength == -1 responses through flushWriter when no plugin must read them.
Impact if not fixed
Claude Code on Bedrock through Cortex shows no streamed output. Local Ollama and Gemini clients that use these formats have the same problem.
- 主要语言
- Go
- 星标
- 26
- 派生
- 46
- 平均合并
- 9 小时 55 分钟
- 30 天内合并 PR
- 257
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rossoctl/cortex 的其他 Issue
-
bug laptop
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
bug laptop
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
feat: Do not count a removed session's cost again when an import brings it back可能已有人在做 @huang195 今天认领。 未关闭enhancement
rossoctl/cortex#1885 · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug: The JWT bypass matches a cleaned path but forwards the raw path, so /mcp/../healthz skips validation可能已有人在做 @evaline-ju 今天认领。 未关闭bug
rossoctl/cortex#1884 · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
Containerpak/cpak#93 ·
-
bug triage
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
router-for-me/CLIProxyAPI#7607 ·
维护者通常 1 天内回复
-
enhancement ui/ux
难度 2/5 1-3 小时 新手友好度 82/100
myNameArnav/lex#52 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100