Skip to content

fix(stream): respect StreamOptions config for event emission#411

Merged
AlbumenJ merged 1 commit intoagentscope-ai:mainfrom
AlbumenJ:1231-event
Dec 31, 2025
Merged

fix(stream): respect StreamOptions config for event emission#411
AlbumenJ merged 1 commit intoagentscope-ai:mainfrom
AlbumenJ:1231-event

Conversation

@AlbumenJ
Copy link
Collaborator

No description provided.

Change-Id: I2a68ac738440e7ae7fa4d41ddf0d9c4e4fb1c208
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes stream event emission to properly respect StreamOptions configuration, ensuring that only requested event types are emitted to subscribers. The fix addresses Issue #265 by adding filtering checks for reasoning emissions and the final agent result event.

  • Added filtering for reasoning chunk vs result emissions based on StreamOptions.shouldIncludeReasoningEmission()
  • Added conditional emission of AGENT_RESULT events based on StreamOptions.shouldStream(EventType.AGENT_RESULT)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
agentscope-core/src/main/java/io/agentscope/core/agent/StreamingHook.java Added shouldIncludeReasoningEmission() checks to filter PostReasoningEvent (final result) and ReasoningChunkEvent (intermediate chunks) based on StreamOptions configuration
agentscope-core/src/main/java/io/agentscope/core/agent/AgentBase.java Wrapped AGENT_RESULT event emission in a conditional check using shouldStream(EventType.AGENT_RESULT) to respect event type filtering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...n/java/io/agentscope/core/agent/StreamingHook.java 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@AlbumenJ AlbumenJ merged commit 174cec0 into agentscope-ai:main Dec 31, 2025
9 of 10 checks passed
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.

1 participant