Skip to content

ci(harness): make async wait timeout tests deterministic - #3529

Merged
jujn merged 1 commit into
agentscope-ai:mainfrom
CryoThrust:test/virtual-async-waits
Oct 13, 2026
Merged

jujn merged 1 commit into
agentscope-ai:mainfrom
CryoThrust:test/virtual-async-waits

Conversation

@CryoThrust

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT

Description

WaitAsyncResultsToolTest.timeoutClampedToMax currently spends 120 seconds waiting for an empty inbox. The test named nullTimeoutUsesDefault passes 1, so it does not exercise the actual 60-second default.

Add package-local clock and sleep injection to run those same polling loops with virtual elapsed time. The public constructors still use System.currentTimeMillis and Thread.sleep; production timeout values and polling behavior remain unchanged.

The tests now check the 600 → 120 clamp, null → 60 default, remaining sleep budget, consecutive-empty accounting and incomplete task barriers. A real-thread interruption test uses the public constructor, alongside a deterministic check that interruption restores the flag without consuming the empty-wait budget. Existing real async-completion tests remain.

This is a narrow test-time slice of #3521, not a change to test parallelism or the whole build optimization assigned there. #2797 touches the same class for async-completion recovery; that functional change remains separate.

Verification

On JDK 17:

mvn -B -T1 -pl agentscope-harness -am clean verify
mvn -B -T1 -pl agentscope-harness -am -Dtest=WaitAsyncResultsToolTest verify
  • The six-module clean verify passed: Core 2,620 cases, AG-UI 453, Harness 1,233; zero failures/errors and 27 existing skips. Formatting, packaging and Javadocs passed. This is not a full-repository verification.
  • All 22 WaitAsyncResultsToolTest cases passed in 12.073 seconds, including the retained real waits. The clamp testcase previously took 120.014 seconds locally and now completes without a real 120-second wait. This is a local testcase measurement, not a measured overall CI speedup.
  • Temporarily changing the default/cap to 61/121 made both corresponding tests fail. Restored 60/120, then reran all 22 cases successfully.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All repository tests are passing (mvn test); selected modules verified above
  • Javadoc comments follow project conventions
  • No user-facing API, configuration or documentation change
  • Code is ready for review

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jujn
jujn merged commit 9718768 into agentscope-ai:main Oct 13, 2026
6 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.

2 participants