diff --git a/agentscope-examples/jev/src/main/java/io/agentscope/examples/jev/JevContextCompactionExample.java b/agentscope-examples/jev/src/main/java/io/agentscope/examples/jev/JevContextCompactionExample.java index 599144cfc4..dc51515a85 100644 --- a/agentscope-examples/jev/src/main/java/io/agentscope/examples/jev/JevContextCompactionExample.java +++ b/agentscope-examples/jev/src/main/java/io/agentscope/examples/jev/JevContextCompactionExample.java @@ -175,11 +175,13 @@ protected Flux doStream( .build()) .build()) { var ctx = RuntimeContext.builder().userId("demo").sessionId("context-demo").build(); + // No wall-clock ceiling: the offline stream completes deterministically, while a + // fixed timeout flakes on CPU-starved parallel CI runners. var result = agent.streamEvents(history(), ctx) .ofType(AgentResultEvent.class) .single() - .block(Duration.ofSeconds(10)); + .block(); var restored = archive.restore( new JevContextArchive.Scope( diff --git a/agentscope-extensions/agentscope-extensions-channel/agentscope-extensions-channel-weixin/src/test/java/io/agentscope/extensions/channel/weixin/WeixinChannelRuntimeTest.java b/agentscope-extensions/agentscope-extensions-channel/agentscope-extensions-channel-weixin/src/test/java/io/agentscope/extensions/channel/weixin/WeixinChannelRuntimeTest.java index fb4b853ce2..dd0f8b4c0c 100644 --- a/agentscope-extensions/agentscope-extensions-channel/agentscope-extensions-channel-weixin/src/test/java/io/agentscope/extensions/channel/weixin/WeixinChannelRuntimeTest.java +++ b/agentscope-extensions/agentscope-extensions-channel/agentscope-extensions-channel-weixin/src/test/java/io/agentscope/extensions/channel/weixin/WeixinChannelRuntimeTest.java @@ -101,8 +101,11 @@ void startServer() throws Exception { } body = updates.get(); } else if (path.endsWith("sendmessage")) { - sends.incrementAndGet(); + // Publish the payload before counting the send: waitFor() polls + // `sends`, and a reader that observes the increment must also + // observe the payload, or lastSend.get() dereferences null. lastSend.set(JSON.readTree(exchange.getRequestBody())); + sends.incrementAndGet(); body = sendResponse; } else { exchange.getRequestBody().readAllBytes(); diff --git a/agentscope-harness/src/test/java/io/agentscope/harness/agent/example/LocalFilesystemPersonalAssistantExampleTest.java b/agentscope-harness/src/test/java/io/agentscope/harness/agent/example/LocalFilesystemPersonalAssistantExampleTest.java index e7710de45e..c3da0b1563 100644 --- a/agentscope-harness/src/test/java/io/agentscope/harness/agent/example/LocalFilesystemPersonalAssistantExampleTest.java +++ b/agentscope-harness/src/test/java/io/agentscope/harness/agent/example/LocalFilesystemPersonalAssistantExampleTest.java @@ -89,28 +89,30 @@ void localFilesystem_filesPersistAcrossCalls() throws Exception { .abstractFilesystem(new LocalFilesystemWithShell(workspace)) .build()) { - // Call 1: write a note to MEMORY.md through the workspace manager + // Call 1: write a note through the workspace manager. A plain user file is + // used on purpose: MEMORY.md is agent-managed (memory consolidation rewrites + // it asynchronously after calls), so its bytes are not stable across calls. agent.call(userMsg("first call"), ctx("session-1", "alice")).block(); agent.getWorkspaceManager() .writeUtf8WorkspaceRelative( - RuntimeContext.empty(), "MEMORY.md", "# Notes\n- item 1"); + RuntimeContext.empty(), "notes.md", "# Notes\n- item 1"); // The file exists on disk after call 1 - Path memoryFile = workspace.resolve("MEMORY.md"); + Path notesFile = workspace.resolve("notes.md"); assertTrue( - Files.isRegularFile(memoryFile), "MEMORY.md should exist on disk after call 1"); - String content = Files.readString(memoryFile, StandardCharsets.UTF_8); - assertTrue(content.contains("item 1"), "MEMORY.md content should be persisted on disk"); + Files.isRegularFile(notesFile), "notes.md should exist on disk after call 1"); + String content = Files.readString(notesFile, StandardCharsets.UTF_8); + assertTrue(content.contains("item 1"), "notes.md content should be persisted on disk"); // Call 2: same workspace, different session — file is still there agent.call(userMsg("second call"), ctx("session-2", "alice")).block(); assertTrue( - Files.isRegularFile(memoryFile), - "MEMORY.md should still exist on disk in call 2"); + Files.isRegularFile(notesFile), + "notes.md should still exist on disk in call 2"); assertEquals( content, - Files.readString(memoryFile, StandardCharsets.UTF_8), - "MEMORY.md content should be unchanged after call 2"); + Files.readString(notesFile, StandardCharsets.UTF_8), + "notes.md content should be unchanged after call 2"); } } diff --git a/docs/examples/jev/source/JevContextCompactionExample.java.txt b/docs/examples/jev/source/JevContextCompactionExample.java.txt index 599144cfc4..dc51515a85 100644 --- a/docs/examples/jev/source/JevContextCompactionExample.java.txt +++ b/docs/examples/jev/source/JevContextCompactionExample.java.txt @@ -175,11 +175,13 @@ public final class JevContextCompactionExample { .build()) .build()) { var ctx = RuntimeContext.builder().userId("demo").sessionId("context-demo").build(); + // No wall-clock ceiling: the offline stream completes deterministically, while a + // fixed timeout flakes on CPU-starved parallel CI runners. var result = agent.streamEvents(history(), ctx) .ofType(AgentResultEvent.class) .single() - .block(Duration.ofSeconds(10)); + .block(); var restored = archive.restore( new JevContextArchive.Scope(