Skip to content

fix(go-agent): filter SSE done sentinel from model stream - #17034

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
Harry-Hz-Zhang:fix/LLM-SSE-DONE
Jul 17, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
Harry-Hz-Zhang:fix/LLM-SSE-DONE

Conversation

@Harry-Hz-Zhang

Copy link
Copy Markdown
Contributor

Summary

  • Filter the [DONE] transport sentinel from Eino model streams
  • Add regression coverage for stream messages and callbacks

Testing

  • bash build.sh --test ./internal/entity/models
  • bash build.sh --test ./internal/agent/component
  • bash build.sh --test -run 'Test(AgentChatCompletions_Stream|RunAgent_Stream)' ./internal/handler

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jul 17, 2026
@Harry-Hz-Zhang Harry-Hz-Zhang added the ci Continue Integration label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2fa96f3-8800-4478-91d0-42f87bc69fd6

📥 Commits

Reviewing files that changed from the base of the PR and between bee5248 and cfa23bd.

📒 Files selected for processing (2)
  • internal/entity/models/llm.go
  • internal/entity/models/llm_test.go

📝 Walkthrough

Walkthrough

The chat model now filters OpenAI-compatible [DONE] stream terminators before forwarding content. Tests verify that regular tokens reach both the stream and callback while the sentinel is excluded.

Changes

Streaming sentinel filtering

Layer / File(s) Summary
Sentinel filtering and validation
internal/entity/models/llm.go, internal/entity/models/llm_test.go
The streaming sender suppresses [DONE], while tests verify stream and callback outputs contain only "answer" and "DONE!".

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: qinling0210

Poem

A bunny watched the tokens flow,
“answer,” then “DONE!” in a row.
The [DONE] sign hopped away,
No noisy crumb was left to stay.
The stream now ends just right—
Thump, thump, goodnight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: filtering the SSE [DONE] sentinel from model streams.
Description check ✅ Passed The description follows the template's Summary section and includes relevant testing details, with only limited background context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yuzhichang

Copy link
Copy Markdown
Member

LGTM

@yuzhichang
yuzhichang merged commit e55bc96 into infiniflow:main Jul 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants