Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0d4bbd6
fix(core): fix list hash stability for equivalent messages
Weilong-Qin May 9, 2026
774b4cd
Move ListHashUtil hash test to core
Weilong-Qin May 9, 2026
a0f5e43
Merge branch 'agentscope-ai:main' into fix/unstable-computehash
Weilong-Qin May 11, 2026
0392f38
refactor(core): add value-based equals and hashCode methods to the Ms…
Weilong-Qin May 12, 2026
004b226
Merge remote-tracking branch 'origin/fix/unstable-computehash' into f…
Weilong-Qin May 12, 2026
cd4e0fe
test(core): add test
Weilong-Qin May 13, 2026
a94bbb0
test(core): add Msg test
Weilong-Qin May 13, 2026
32c03f1
fix(core): stabilize ToolUseBlock hashCode for Gemini thoughtSignature
Weilong-Qin May 26, 2026
bec4729
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 4, 2026
765e942
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 4, 2026
628b3a0
fix: variable name updated
Weilong-Qin Jun 4, 2026
d1ebe31
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 5, 2026
b766ddf
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 10, 2026
731c3a0
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 12, 2026
166c697
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 16, 2026
95c6798
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 25, 2026
0ea3d44
fix(test): move OpenAIReasoningDetail hash test to extensions module
Weilong-Qin Jun 25, 2026
93cd966
style: apply spotless formatting
Weilong-Qin Jun 25, 2026
a4d90f0
fix(test): add missing ChatUsage import in OpenAIChatModelTest
Weilong-Qin Jun 25, 2026
a26d1e3
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 26, 2026
913f598
Merge branch 'main' into fix/unstable-computehash
Weilong-Qin Jun 26, 2026
a050a84
Merge remote-tracking branch 'origin/main' into fix/unstable-computehash
Weilong-Qin Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.agentscope.core.session;

import io.agentscope.core.state.State;
import io.agentscope.core.util.JsonUtils;
import java.util.List;

/**
Expand Down Expand Up @@ -88,7 +89,7 @@ public static String computeHash(List<? extends State> values) {

for (int idx : sampleIndices) {
State item = values.get(idx);
int itemHash = item != null ? item.hashCode() : 0;
int itemHash = item != null ? JsonUtils.getJsonCodec().toJson(item).hashCode() : 0;
sb.append(idx).append(":").append(itemHash).append(",");
Comment thread
Weilong-Qin marked this conversation as resolved.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import io.agentscope.core.message.Msg;
import io.agentscope.core.message.MsgRole;
import io.agentscope.core.message.TextBlock;
import io.agentscope.core.session.ListHashUtil;
import io.agentscope.core.state.SessionKey;
import io.agentscope.core.state.SimpleSessionKey;
import io.agentscope.core.state.State;
Expand Down Expand Up @@ -282,6 +286,45 @@ void testSaveAndGetListState() throws SQLException {
assertEquals("value2", loaded.get(1).value());
}

@Test
@DisplayName("Should compute same hash for equivalent message lists")
void testComputeHashEquivalentMessageLists() {
List<Msg> first =
List.of(
Comment thread
Weilong-Qin marked this conversation as resolved.
Outdated
Msg.builder()
.id("m-user-1")
.timestamp("2026-05-08 14:00:00.000")
.role(MsgRole.USER)
.content(TextBlock.builder().text("hello").build())
.build(),
Msg.builder()
.id("m-assistant-1")
.timestamp("2026-05-08 14:00:01.000")
.role(MsgRole.ASSISTANT)
.content(TextBlock.builder().text("hello").build())
.build());

List<Msg> second =
List.of(
Msg.builder()
.id("m-user-1")
.timestamp("2026-05-08 14:00:00.000")
.role(MsgRole.USER)
.content(TextBlock.builder().text("hello").build())
.build(),
Msg.builder()
.id("m-assistant-1")
.timestamp("2026-05-08 14:00:01.000")
.role(MsgRole.ASSISTANT)
.content(TextBlock.builder().text("hello").build())
.build());

String h1 = ListHashUtil.computeHash(first);
String h2 = ListHashUtil.computeHash(second);

assertEquals(h1, h2);
}

@Test
@DisplayName("Should commit incremental list save when connection auto-commit is disabled")
void testSaveListIncrementalAppendCommitsWhenAutoCommitDisabled() throws SQLException {
Expand Down
Loading