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

[CI] 2.0.x: every PR fails the Windows job in SkillBoxTest$UploadContainment, so no 2.0.x PR gets a complete CI run

Open aiyili opened this issue 5 days ago • 3 comments

Describe the bug

On 2.0.x, build (windows-latest) fails in agentscope-core on one test. The job stops there and build (ubuntu-latest) is cancelled, so no PR against 2.0.x gets a complete CI run and the harness module is never reached.

Seen on #4447, #4449, #4450 and #4452, and on other contributors' PRs such as #4212 and #4430.

To Reproduce

On Windows, with the checkout on a drive other than the one java.io.tmpdir is on (the GitHub runner has the checkout on D: and the temp directory on C:):

mvn -pl agentscope-core test -Dtest=SkillBoxTest

UploadContainment: 4 run, 1 error.

Error messages

[ERROR] Tests run: 3237, Failures: 0, Errors: 1, Skipped: 12
[ERROR]   SkillBoxTest$UploadContainment.preservesLegacyNamesWithRelativeNonNormalizedWorkDirectory:332 » IllegalArgument 'other' has different root
java.lang.IllegalArgumentException: 'other' has different root
	at java.base/sun.nio.fs.WindowsPath.relativize(WindowsPath.java:404)
	at java.base/sun.nio.fs.WindowsPath.relativize(WindowsPath.java:42)
	at io.agentscope.core.skill.SkillBoxTest$UploadContainment.preservesLegacyNamesWithRelativeNonNormalizedWorkDirectory(SkillBoxTest.java:332)

Root cause

The test computes a relative path from the working directory to the JUnit temp directory:

Path relative = Path.of("").toAbsolutePath().relativize(tempDir);

Path.relativize cannot cross drives, so this line throws before SkillBox is called. It is the first statement of the test, so the failure does not depend on the change under test.

The test came to 2.0.x with the backport of #3787 (508d5e27). The 2.0.x PRs I checked since then (#4212, #4430 and the four above) all show the same failure. main does not have this test.

Expected behavior

The test runs on Windows, and a 2.0.x PR gets a complete CI run.

Suggested fix

Keep the directory that the test relativizes on the drive of the working directory, for example by creating it under the module's target/ instead of using @TempDir. With the temp directory moved to the same drive as the checkout, the test passes as it is:

mvn -pl agentscope-core test -Dtest=SkillBoxTest -DargLine="-Djava.io.tmpdir=D:/tmp/jt"

UploadContainment: 4 run, 0 errors. On Linux it passes unchanged.

Environment

  • AgentScope-Java Version: 2.0.x at 50886798
  • Java Version: 17
  • OS: Windows (GitHub windows-latest; reproduced locally on Windows 10 with the checkout on D:)

aiyili avatar Nov 27 '26 05:11 aiyili

I'll open a PR against 2.0.x for this, changing only the test: the directory it relativizes is created under the module's target/, so it is always on the drive where a relative path is resolved. The assertions and the code path exercised stay the same.

aiyili avatar Nov 27 '26 05:11 aiyili

Opened #4454 against 2.0.x. It changes only the test: the directory it relativizes is created under the module's target/, which is on the drive a relative path is resolved against, and is removed afterwards.

On Windows with the checkout on D: and the temp directory on C:, SkillBoxTest now runs 16 tests with 0 errors, and the whole agentscope-core suite no longer has the SkillBoxTest error. In a Linux container the class passes as before. The test still fails when SkillUtil.resolveContainedPath stops normalizing its base directory, so it still covers what it was written for.

aiyili avatar Nov 27 '26 05:11 aiyili

The CI run of #4454 confirms the change and shows what is left: on Windows, agentscope-core passes with 3237 tests and 0 failures. The job then fails in agentscope-harness on 18 tests that fail on unmodified 2.0.x on Windows as well, for three other reasons. I have put those in #4455 so that this one stays scoped to the SkillBoxTest failure.

aiyili avatar Nov 27 '26 06:11 aiyili