Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

fix(sse): batch tiny stream chunks before emitting#362

Merged
CJackHwang merged 2 commits into
devfrom
codex/fix-issue-based-on-feedback
Apr 29, 2026
Merged

fix(sse): batch tiny stream chunks before emitting#362
CJackHwang merged 2 commits into
devfrom
codex/fix-issue-based-on-feedback

Conversation

@CJackHwang

Copy link
Copy Markdown
Owner

Motivation

Description

  • internal/sse/stream.goStartParsedLinePump 中增加了聚合逻辑,新增常量 minFlushChars(默认 160)和 maxFlushWait(默认 80ms)用于字符阈值和时间阈值的双重触发。
  • 将扫描拆成独立 reader goroutine + 主循环 select(支持 ctx、定时器和行通道),以便实现定时刷新与及时取消。
  • 仅对普通内容增量结果累积(根据 LineResult 的字段判断),在遇到 stop / error / content_filter / 非内容行时先 flush 再发送控制事件,并在流结束时强制 flush。
  • 新增测试 TestStartParsedLinePumpAccumulatesSmallChunks 并调整现有多行测试的期望,使其与聚合语义一致;变更文件为 internal/sse/stream.gointernal/sse/stream_edge_test.go

Testing

  • 运行并通过了 ./scripts/lint.sh
  • 运行并通过了 ./tests/scripts/check-refactor-line-gate.sh
  • 运行并通过了单元测试套件 ./tests/scripts/run-unit-all.sh(所有测试通过)。
  • 运行并通过了 npm run build --prefix webui
  • 单独执行 go test ./internal/sse -run TestStartParsedLinePump 验证了相关流处理用例通过。

Codex Task

@vercel

vercel Bot commented Apr 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Apr 29, 2026 2:59pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89225c778e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/sse/stream.go Outdated
@wyv202011y

Copy link
Copy Markdown

我刚想交 Pull Request 😂,动作真快,👏

@CJackHwang

CJackHwang commented Apr 29, 2026

Copy link
Copy Markdown
Owner Author

我刚想交 Pull Request 😂,动作真快,👏

正好 如果可以你把上面codex的review结果修一下吧 我没有电脑 我是手机codex远程修的 现在暂时没空了 你看清楚并入的这个
codex/fix-issue-based-on-feedback分支改吧

@wyv202011y

Copy link
Copy Markdown

我尽力而为,但不一定成功,因为我本身不会go语言,上述都是由minimax2.5完成的。。。。

@zeabur zeabur Bot temporarily deployed to production April 29, 2026 13:21 Inactive
@CJackHwang

Copy link
Copy Markdown
Owner Author

我尽力而为,但不一定成功,因为我本身不会go语言,上述都是由minimax2.5完成的。。。。

review了你的pr代码,实现逻辑还要再评估一下,你先暂时不用更新先,辛苦了,我处理一下后手,等后续有其他问题再看看

@CJackHwang CJackHwang merged commit af4a067 into dev Apr 29, 2026
7 of 8 checks passed
@CJackHwang CJackHwang deleted the codex/fix-issue-based-on-feedback branch April 29, 2026 15:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Bug Report: SSE 流式输出 token 分块过细,导致客户端超时

2 participants