Repository navigation
fix(harness): keep the shell when filesystem routes are applied - #4304
Merged
Merged
Conversation
ningmao-hlyz
force-pushed
the
fix/composite-shell-policy
branch
from
November 20, 2026 15:54
6bad5f2 to
6c10937
Compare
A filesystem route wrapped the primary filesystem in a CompositeFilesystem, which routes paths but implements none of the capabilities it wraps: no execute, no AbstractSandboxFilesystem marker, no sandbox workspace prefix. Any routed workspace therefore lost shell_execute, and with it the skill runtime's code-execution block and <files-root>; a subagent sharing its parent's sandbox-backed workspace was the visible case (agentscope-ai#4292). Composition now matches what filesystemRoute documents: a primary that executes commands in a sandbox keeps execute/id through RoutedSandboxFilesystem, which routes the same way and forwards them to the primary. A local shell stays on a plain composite, since routing an overlay over LocalFilesystemWithShell would make the workspace probes read host paths as sandbox paths. The probes that read the filesystem now resolve it through FilesystemUtils.primaryBackend and agree on one marker, so a routed workspace over any shell-capable primary keeps its shell, and a custom BaseSandboxFilesystem no longer gets shell_execute while its skills are told there is no shell. primaryBackend peels CompositeFilesystem and RoutedSandboxFilesystem only: an overlay is a single filesystem that already exposes shell execution through its upper layer, and callers rely on that distinction.
ningmao-hlyz
force-pushed
the
fix/composite-shell-policy
branch
from
November 20, 2026 16:49
6c10937 to
5305b27
Compare
jujn
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
2.1.0-SNAPSHOT
Description
Fixes #4292.
Any agent that declares a filesystem route loses
shell_execute. The builder wrapped the primary filesystem in aCompositeFilesystem, which routes paths but implements none of the capabilities it wraps — noexecute/id, noAbstractSandboxFilesystemmarker, no sandbox workspace prefix — so every probe that reads the filesystem concluded "this workspace has no shell":shell_executewas never registered (HarnessAgentprobed the marker on the wrapper);NO_SHELL, so every skill lost its<files-root>and code-execution block;LocalFilesystemWithShell+ a route.A subagent with
workspace.mode=sharedover a sandbox-backed parent is the reported case: it inherits the parent filesystem, gets routes applied, and ends up with no shell.Composition.
filesystemRoute's javadoc already promises "when the primary filesystem is sandbox-backed, the route is applied viaRoutedSandboxFilesystemsoshell_executestill targets the sandbox" — that held for the sandbox-spec branch but not for an injected primary.withFilesystemRoutesnow applies the same rule to any primary that executes commands in a sandbox, so a customBaseSandboxFilesystem(theSharedSandboxFilesystemshape) and an overlay over a sandbox keepexecute/id. A host shell stays on a plain composite:LocalFilesystemWithShellimplementsAbstractSandboxFilesystemtoo, and routing it would make the probes read host paths as/workspacepaths.Probes. Shell tool registration and the skill shell policy now resolve the filesystem through
FilesystemUtils.primaryBackend, which peelsCompositeFilesystemandRoutedSandboxFilesystem. The two also agree on the same marker now: registration has always usedAbstractSandboxFilesystem, the policy used the narrowerSandboxBackedFilesystem, so a routed custom sandbox filesystem got a shell tool while every skill was told there was none.Deliberately not changed:
primaryBackenddoes not peelOverlayFilesystem: an overlay is a single filesystem that already exposes shell execution through its upper layer, and the existing probes rely on that distinction.forSandboxprefix handling for callers that currently take the local branch, which is a separate decision.How to test
HarnessAgentFilesystemRoutesShellTest(new, 8 cases): routed sandbox primary resolves toRoutedSandboxFilesystemand still reports the sandbox marker; routed non-sandbox primary stays composite; an overlay overLocalFilesystemWithShellstays composite so its skills keep host paths; the shell tool is registered for a routed local-with-shell workspace and for a routed sandbox-backed primary; the skill policy returnsSANDBOX/LOCAL_WITH_SHELL/NO_SHELLthrough both wrappers and matches the unwrapped decision.FilesystemUtilsTest:primaryBackendpassthrough, composite/routed/nested unwrap, overlay left alone.Red/green, with the composition and probe changes reverted:
Full module on this head:
mvn -pl agentscope-harness test→ 1904 tests, 0 failures, 47 skipped (Windows host; the skipped ones are docker/shell integration).Checklist
mvn spotless:applymvn test)filesystemRoute's javadoc already described the fixed behaviour; no user-facing doc mentions the loss