fix(msg): Fix ToolResultBlock transient field#455
fix(msg): Fix ToolResultBlock transient field#455AlbumenJ merged 2 commits intoagentscope-ai:mainfrom
Conversation
Change-Id: I2d6314ae6bbd480758786106da1f614e114e18a8
Change-Id: I194c47a5e6fed658aef9a2e7a392139b8de429fc
There was a problem hiding this comment.
Pull request overview
This PR attempts to fix a transient field issue in the ToolResultBlock class by adding annotations to the isSuspended() method. However, the implementation uses incorrect Jackson annotations.
Key Changes:
- Added
@Transientannotation (fromjava.beans) to theisSuspended()getter method - Added
@JsonIncludeannotation (incorrect - should be@JsonIgnore) - Added import for
com.fasterxml.jackson.annotation.JsonInclude
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| package io.agentscope.core.message; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonInclude; |
There was a problem hiding this comment.
This import should be com.fasterxml.jackson.annotation.JsonIgnore instead of JsonInclude. The annotation used on line 125 should be @JsonIgnore to exclude the derived property from serialization, following the pattern established in Msg.java.
| import com.fasterxml.jackson.annotation.JsonInclude; | |
| import com.fasterxml.jackson.annotation.JsonIgnore; |
| */ | ||
| @Transient | ||
| @JsonInclude | ||
| public boolean isSuspended() { |
There was a problem hiding this comment.
The annotation should be @JsonIgnore instead of @JsonInclude. The isSuspended() method is a derived/computed property that reads from the metadata field, so it should be excluded from JSON serialization to prevent redundant data. Using @JsonInclude would cause this property to be serialized, which is incorrect.
This pattern is consistently used in Msg.java where all derived properties annotated with @Transient also use @JsonIgnore (see lines 182-183, 195-196, 209-210, etc. in Msg.java).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Change-Id: I2d6314ae6bbd480758786106da1f614e114e18a8
AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.5, check your pom.xml dependency version or run
mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]Description
[Please describe the background, purpose, changes made, and how to test this PR]
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)