agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Bug]: SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete is flaky on windows-latest

Open wahllllll opened this issue 1 month ago • 0 comments

Describe the bug

SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete fails intermittently on the build (windows-latest) lane. It has been seen with two different symptoms on the same test method, and no issue currently tracks either of them.

The test drives 50 concurrent agent.call(...) invocations against two HarnessAgent instances sharing one workspace, then asserts that none of them failed:

List<Throwable> errors = runConcurrently(50, agentA, agentB);
assertEquals(List.of(), errors, () -> "no call should fail, but got: " + errors);

Environment

  • AgentScope-Java Version: 2.1.0-SNAPSHOT
  • Lane: build (windows-latest) (ubuntu-latest is not affected in the runs I looked at)
  • JDK 17

Symptom A — a call fails with an async-cleanup error (seen on a PR branch)

Commit dce9a3884 (base 16632ae84), run 38141427129, job 114475922373, 2026-10-11T13:07Z:

[ERROR] SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete(Path) -- Time elapsed: 86.74 s <<< FAILURE!
org.opentest4j.AssertionFailedError: no call should fail, but got: [java.lang.RuntimeException: Async resource cleanup failed after onComplete] ==> expected: <[]> but was: <[java.lang.RuntimeException: Async resource cleanup failed after onComplete]>
	at ...SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete(SharedWorkspaceSkillStagingE2ETest.java:85)
[ERROR] Tests run: 1223, Failures: 1, Errors: 0, Skipped: 18

The other two methods in the class passed in the same run. 86.74 s for the method (the internal done.await(120, SECONDS) at runConcurrently:243 was not what fired here — the run finished and one of the 50 calls had collected a Throwable).

Symptom B — the calls do not finish in time (seen on main)

Commit 05f4b6115, run 38111384774, job 114387505095, 2026-10-11T04:21Z:

[ERROR] SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete(Path) -- Time elapsed: 120.1 s <<< FAILURE!
	at ...SharedWorkspaceSkillStagingE2ETest.runConcurrently(SharedWorkspaceSkillStagingE2ETest.java:243)
	at ...SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete(SharedWorkspaceSkillStagingE2ETest.java:83)
[ERROR]   SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete:83->runConcurrently:243 agent calls should finish ==> expected: <true> but was: <false>
[ERROR] Tests run: 1223, Failures: 1, Errors: 0, Skipped: 18

Here the 120 s done.await(...) expired: at least one of the 50 calls never returned.

What I could and could not establish

  • Could not establish whether A and B share a root cause. They are different assertions on different lines (:85 vs :83->:243) with different messages, so I am not claiming they are one bug — only that the same test is unstable on this lane.
  • Could not locate the throw site of symptom A. A literal search of the whole tree at dce9a3884 (5419 files, all .java plus resources and docs) finds no occurrence of Async resource cleanup failed, resource cleanup failed, cleanup failed after, or Async + cleanup; the only after onComplete hit is unrelated AG-UI code. So the RuntimeException most likely originates from a dependency on the harness test classpath rather than from this repository. That is an observation, not a conclusion.
  • The CI log does not help here: the test collects the Throwable into a list and only its toString() is printed, so no stack trace for the inner exception appears in the log.
  • Frequency: on main's last 30 push runs, 4 failed, and this test was one of them. So it is intermittent, not deterministic.

Possible lead (unverified)

#3106 reworks transcript persistence to be fire-and-forget, tracks pending writes with MemoryBackgroundTasks, and explicitly covers "sandbox release ordering" and shutdown quiescence — the same "async work must quiesce before resources are released" shape that symptom A's message describes. I have not verified any connection, and I am not proposing a fix here; flagging it only so whoever picks this up knows where to look first.

Related context: HarnessBackgroundTaskQuiescenceExtension and HarnessAgent.close() already exist to drain exactly this class of background work, which suggests the general problem area is known even though this particular test is not tracked.

wahllllll avatar Oct 12 '26 03:10 wahllllll