Skip to content

test(core): run the legacy skill-name test on Windows on 2.0.x (#4453) - #4454

Merged
jujn merged 1 commit into
agentscope-ai:2.0.xfrom
aiyili:test/skill-box-legacy-names-cross-drive
Nov 27, 2026
Merged

jujn merged 1 commit into
agentscope-ai:2.0.xfrom
aiyili:test/skill-box-legacy-names-cross-drive

Conversation

@aiyili

@aiyili aiyili commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4453

Problem

Since 508d5e27, the backport of #3787, build (windows-latest) fails on every 2.0.x PR in agentscope-core:

[ERROR] Tests run: 3237, Failures: 0, Errors: 1, Skipped: 12
[ERROR]   SkillBoxTest$UploadContainment.preservesLegacyNamesWithRelativeNonNormalizedWorkDirectory:332 » IllegalArgument 'other' has different root

The job stops there and build (ubuntu-latest) is cancelled, so no 2.0.x PR gets a complete CI run and the harness module is never reached. Seen on #4447, #4449, #4450 and #4452, and on #4212 and #4430.

Cause

The test begins with

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

Path.relativize cannot cross drives. The Windows runner keeps the checkout on D: and java.io.tmpdir on C:, so the line throws before SkillBox is called. The failure is the first statement of the test, so it never depended on the change under test.

Fix

Only the test changes. The directory that it relativizes is created under the module's target/ instead of @TempDir: a relative path is resolved against the working directory, so this directory is always on that drive. It is removed in a finally.

What the test asserts and the code it exercises are the same as before.

Tests

  • Windows, checkout on D: and temp directory on C:, the layout of the runner: SkillBoxTest runs 16 tests with 0 errors. Before, UploadContainment ran 4 with 1 error.
  • Linux container: SkillBoxTest runs 16 with 0 errors, as before.
  • The test still catches what it was written for. With the base directory no longer normalized in SkillUtil.resolveContainedPath, it fails with NoSuchFile .../skills/Upper_Case.技能_Legacy_Source/nested/file.txt, and no other test in the class does.

The whole agentscope-core suite on Windows then runs 3237 tests with 0 failures and 2 errors. Both are DangerousPathBypassTest.symlink*, which need the symlink privilege that this machine does not have; the CI log reports exactly one error in the module, the SkillBoxTest one, and that one is gone.

Effect on CI

The CI run of this PR shows the change: on Windows, agentscope-core now passes with 3237 tests and 0 failures, where it failed before with the one SkillBoxTest error.

The job then goes on to agentscope-harness and fails there on 18 tests. Those fail on unmodified 2.0.x on Windows as well and have three other causes, all to do with Windows paths; they are tracked in #4455. The Ubuntu job was cancelled by that failure. Before the cancellation it had run the harness module with 1619 tests and 0 failures.

…scope-ai#4453)

`SkillBoxTest$UploadContainment.preservesLegacyNamesWithRelativeNonNormalizedWorkDirectory` started with `Path.of("").toAbsolutePath().relativize(tempDir)`. A relative path cannot cross drives, and on the Windows runner the checkout is on `D:` while `java.io.tmpdir` is on `C:`, so that line threw `'other' has different root` before `SkillBox` was called. Since the backport of agentscope-ai#3787 (`508d5e27`) it has failed the Windows job of every `2.0.x` PR and got the Ubuntu job cancelled.

The directory the test relativizes is now created under the module's `target/`, which is on the drive a relative path is resolved against, and is removed afterwards. What the test asserts and the code it exercises are unchanged: with `SkillUtil.resolveContainedPath` no longer normalizing its base directory, this is the one test in the class that fails.
@aiyili

aiyili commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

About the CI of this PR: on Windows, agentscope-core now passes with 3237 tests and 0 failures, which is the point of the change.

The job still shows red because it gets further and fails in agentscope-harness, on 18 tests. Those fail on unmodified 2.0.x on Windows as well; they have three other causes to do with Windows paths and are tracked in #4455. On Ubuntu the job had run the harness module with 1619 tests and 0 failures before it was cancelled by the Windows failure.

@jujn
jujn merged commit 723887d into agentscope-ai:2.0.x Nov 27, 2026
3 of 5 checks passed
aiyili added a commit to aiyili/agentscope-java that referenced this pull request Nov 27, 2026
aiyili added a commit to aiyili/agentscope-java that referenced this pull request Nov 27, 2026
aiyili added a commit to aiyili/agentscope-java that referenced this pull request Nov 27, 2026
aiyili added a commit to aiyili/agentscope-java that referenced this pull request Nov 27, 2026
juruoO-o pushed a commit that referenced this pull request Dec 1, 2026
…ader on 2.0.x (#2888) (#4452)

Fixes #2888 on `2.0.x`, where the call still exists. `main` no longer
has it.

## Problem

A session that only has v1 keys (`memory_messages` /
`toolkit_activeGroups`) is reconstructed by `LegacyStateLoader` on first
load. Legacy keys carry no permission context, and
`ReActAgent.loadOrCreateAgentStateForSlot` calls the three-argument
overload, which passes `null`. The reconstructed state therefore gets
the default context although the builder configured one, mode and rules
alike. The fresh-state branch of the same method does use the builder's
context.

On `2.0.x` this shows through `getAgentState(userId, sessionId)` and
`getAgentState(ctx)`, which return the state as loaded. A `call()` is
not affected: `activateSlotForContext` applies the builder's context the
first time it activates a slot.

## Fix

`permCtx` is forwarded to the four-argument overload, the shape of #2886
and #3221. Nothing else changes: a state that already exists is still
loaded as it was persisted.

## Tests

`ReActAgentLegacyPermissionContextTest` (new, 4 cases).
`LegacyStateLoaderTest` already covers the loader's four-argument
overload; nothing covered the caller.

| Case | Unmodified `2.0.x` | With the fix |
| --- | --- | --- |
| the legacy session is reconstructed with the builder's context (mode
and deny rule), keeping the conversation and the tool groups | fails:
`expected ... mode=BYPASS, denyRules={shell=[...]}` but was
`mode=DEFAULT` with no rules | passes |
| without a builder context the default is kept | passes | passes |
| an existing state keeps its own context | passes | passes |
| a `call()` applies the builder's context on first activation | passes
| passes |

The last two pass before and after on purpose: they bound the change. A
variant of the fix that also overwrites the context of an existing state
fails the third case (`expected: <EXPLORE> but was: <BYPASS>`).

## Verification

The full `agentscope-core` suite was run before and after the change on
Windows and in a Linux container. The failing lists are identical; the
only difference is the 4 added tests.

| Environment | Before | After | Failing before and after |
| --- | --- | --- | --- |
| Windows | 3237 run, 0 F + 3 E | 3241 run, 0 F + 3 E | 2 ×
`DangerousPathBypassTest.symlink*` (no symlink privilege),
`SkillBoxTest$UploadContainment.preservesLegacyNamesWithRelativeNonNormalizedWorkDirectory`
|
| Linux container (`maven:3.9-eclipse-temurin-17`) | 3242 run, 0 F + 0 E
| 3246 run, 0 F + 0 E | none |

**CI.** The first run of this PR was red for reasons that lay in the
base branch: since the backports of 2026-11-13, every PR against `2.0.x`
failed the Windows job, at first in `agentscope-core`, and had its
Ubuntu job cancelled. Those causes are fixed by #4454 and #4461, merged
into `2.0.x` on 2026-11-27; the harness part went in with #4461. The
current run of this PR, on top of them, is green on both systems. The
local before/after runs recorded above were made before the fixes
existed, which is why the "before" column lists failures that the branch
no longer has.
juruoO-o pushed a commit that referenced this pull request Dec 2, 2026
…2918) (#4450)

Fixes #2918 on `2.0.x`, where the code involved still exists. This is
the final state of #3386, which targeted `main` and was closed when
#3441 removed that code there.

## Problem

With a remote filesystem, session history silently stays on the local
disk.

`ObjectStoreTranscriptStore`, the default transcript store whenever a
filesystem is present, writes each segment through the
`AbstractFilesystem` under `{tenant}/{agentId}/{sessionId}/events/...`,
with a default tenant of `default`. `RemoteFilesystemSpec` routes
`agents/{agentId}/sessions/` to the remote store. The two never match,
so `CompositeFilesystem` sends every segment to the default backend.

There is a second mismatch behind the first one. The route is keyed on
the builder's `agentId`. The transcript middleware is registered on the
inner `ReActAgent`, so it keys the transcript on the agent's display
name. Where the two differ, even a correctly prefixed segment would miss
the route.

## Fix

- `SessionTranscriptWriter` builds the ref as
`agents/{agentId}/sessions/{sessionId}` for the store the builder
installs by default, so segment keys hit the sessions route. The builder
creates that store through the new
`ObjectStoreTranscriptStore.onSessionsRoute(filesystem)`, and only a
store created that way is keyed on the route. A store supplied through
`transcriptStore(...)`, whatever its class, keeps the layout it was
configured with.
- The ref uses the id the routes were built with. `HarnessAgent` passes
`resolvedAgentId` through a new `TranscriptMiddleware` constructor
argument to the writer. Callers that do not pass it keep using their own
agent id.
- The Javadoc of `transcriptStore`, `transcriptTenant`,
`TranscriptStore` and `TranscriptRef` says which store uses which
layout: `transcriptTenant` applies to every supplied store, and the
default store's layout has no tenant segment.

**Scoped after review.** The first version keyed every
`ObjectStoreTranscriptStore` on the route, because the writer tested the
class. A store supplied explicitly would have been re-keyed as well,
from `{rootPrefix}{tenant}/{agentId}/{sessionId}` to
`{rootPrefix}agents/{agentId}/sessions/{sessionId}`: segments already
written under its tenant prefix would no longer be listed, and tenants
sharing a backend with the same agent and session ids would have shared
one namespace. The default store is the only one re-keyed now.

## Tests

`SessionTranscriptStoreRoutingTest` (new, 10 cases).

The default store, built the way the builder builds it:

- segments reach the store behind the sessions route when the routing id
differs from the caller's display name;
- the same when no routing id is given and the caller's id is the routed
one;
- a blank routing id is treated like none;
- a `TranscriptMiddleware` built with the three-argument constructor,
which passes no routing id, keys the segments on the agent's name;
- end to end: a built `HarnessAgent` with `agentId("agent-qa")`, a
different display name and a `RemoteFilesystemSpec` puts its segments
into the store under `agents/agent-qa/...`, nothing under the display
name, and no `events` directory on the local disk.

What must not change:

- a `TranscriptMiddleware` built with the one-argument constructor,
which has no transcript store, writes the local session log and nothing
else;
- a store that is not an `ObjectStoreTranscriptStore` keeps the tenant
layout;
- a supplied `ObjectStoreTranscriptStore` keeps its prefix and the
tenant layout, behind the same routes:
`tenants/acme/team-a/agent-a/session-1/events`, where the previous head
wrote `tenants/acme/agents/agent-a/sessions/session-1/events`;
- two tenants on one supplied store keep separate namespaces, with the
same agent and session ids: the previous head wrote both into one
directory on the route;
- end to end: the same agent as above, built with `transcriptStore(new
ObjectStoreTranscriptStore(...))` and a tenant, keeps the tenant layout
and puts nothing on the sessions route: the previous head's segments
reached the store of the route.

On unmodified `2.0.x` the two route tests and the end-to-end test of the
default store fail, and the tenant-layout test passes before and after.
The three supplied-store cases fail on the previous head, `287609b5`.
Where the other cases stand is placed by the mutants below, since they
need the store factory and cannot run on unmodified code.

Each piece of the fix was then broken on its own:

| Broken piece | Caught by |
| --- | --- |
| writer keeps the tenant layout for every store | the two route tests
and the end-to-end test of the default store |
| writer keys every `ObjectStoreTranscriptStore` on the route (the code
before the scoping) | the three supplied-store cases |
| builder installs a plain store instead of the one on the route |
`segmentsOfABuiltAgentReachTheSessionsRouteOfItsAgentId` |
| factory does not mark the store as on the route | the five
default-store cases |
| `isOnSessionsRoute()` answers false for every store | the five
default-store cases |
| `isOnSessionsRoute()` answers true for every store | the three
supplied-store cases |
| the one-argument constructor marks a supplied store as on the route |
`segmentsOfABuiltAgentWithASuppliedStoreKeepTheTenantLayout` |
| the three-argument constructor marks a supplied store as on the route
| `aStoreSuppliedToTheBuilderKeepsItsPrefixAndTheTenantLayout`,
`tenantsOfASuppliedStoreKeepSeparateNamespaces` |
| writer ignores the routing id |
`segmentsHitTheSessionsRouteOfTheRoutingId`, end to end |
| writer falls back to the tenant when no routing id is given |
`segmentsHitTheSessionsRouteOfTheCallersIdWhenNoRoutingIdIsGiven` |
| writer does not treat a blank routing id as absent |
`aBlankRoutingId_fallsBackToTheCallersId` |
| `HarnessAgent` passes the display name instead of `resolvedAgentId` |
end to end |
| `HarnessAgent` does not thread the id | end to end |
| `TranscriptMiddleware` does not hand the id to the writer | end to end
|
| the three-argument constructor of the middleware passes the tenant on
as routing id |
`aMiddlewareWithoutARoutingId_keysTheSegmentsOnTheAgentsName` |

All are caught. The three that break the threading between
`HarnessAgent` and the writer are caught by the end-to-end test alone,
which is why it is there. `withRuntimeContext` and `withFilesystem`
carry the mark over to their copies; nothing reads it from a copy, so no
test can tell and no mutant is listed. Every line this PR adds to
production code is covered on Linux, branches included.

## Segments written before this change

They are not migrated. They were written to the default backend, which
is the local disk of the node that wrote them; that is the bug. The
local context file remains the primary copy on that node. Nothing reads
the old segment files afterwards, since the store lists, compacts and
deletes by ref and the ref now points at the new layout, so they stay in
place until the workspace is removed.

Only the default store is affected. A supplied store writes where it
always did.

## Verification

The full `agentscope-harness` suite was run before and after the change
on Windows and in a Linux container. The failing lists are identical;
the only difference is the added tests. The Windows numbers are from
before the last two commits, which add tests and scope the change to the
default store; the current head passes the Windows job in CI.

| Environment | Before | After | Failing before and after |
| --- | --- | --- | --- |
| Windows | 1619 run, 5 F + 12 E | 1623 run, 5 F + 12 E (1629 with the
last two commits, green in CI) | Windows path checks (`Sandbox workspace
root must be an absolute path`), 2 × `MemoryConsolidatorCommitGateTest`,
`MemoryFlushSandboxIndependenceTest` |
| Linux container (`maven:3.9-eclipse-temurin-17`) | 1619 run, 3 F + 1 E
| 1629 run, 3 F + 1 E | 3 × `BaseSandboxFilesystemTest.edit_*`
(`python3: not found` in the image),
`MarketplaceStagerOrphanGcTest.unreadableEntryDoesNotFailStage` |

No existing test depends on the old key layout of the default store.

**CI.** The first run of this PR was red for reasons that lay in the
base branch: since the backports of 2026-11-13, every PR against `2.0.x`
failed the Windows job, at first in `agentscope-core`, and had its
Ubuntu job cancelled. Those causes are fixed by #4454 and #4461, merged
into `2.0.x` on 2026-11-27; the harness part went in with #4461. The
runs since, including the one on the current head, are green on both
systems. One Windows run in between, on `108fae28`, stopped on
`HttpSelfRegistrationTest` in `agentscope-extensions-aistio`: the
shutdown race of that module (#3132), unrelated to this change; the next
run passed. The local before/after runs recorded above were made before
the fixes existed, which is why the "before" column lists failures that
the branch no longer has.
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