Repository navigation
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Nice, well-documented fix for #3388 — making projected definitions host-authoritative and verifying the live sandbox copy before skipping hydration closes both halves of the problem (sandbox edits entering the trusted catalog, and host-hash-only checks trusting a stale copy). The opt-out flag, the EN/ZH doc updates and the cross-call tamper regression tests (USER/AGENT/GLOBAL, real tar snapshot round-trips) are all in good shape, and CI is green on ubuntu + windows with CLA signed.
I am leaving this as a COMMENT (not an approval) because of a few questions around the verification fast path, path normalization in the new host branch, and how the new default interacts with the documented per-user skills/ precedence — none of them look like blockers, but they are worth confirming before merge.
What reads well
- Fail-closed verification: any exec/parse/timeout failure forces rehydration instead of trusting the recorded hash.
hostAuthoritativeDefinitions(false)+ narrowingworkspaceProjectionRoots(...)give a clean migration path, andWorkspaceProjectionEntrykeeps secure-by-default deserialization for legacy persisted specs (covered by the new round-trip test).- Explicit
.filesystem(prefix, backend)routes are kept ahead of host ownership, which preserves existing multi-backend setups. - Default
MEMORY.mdsemantics are untouched; the 4-branch workspace start logic is not restructured.
Main points (details inline)
WorkspaceProjectionApplier.matchesSandbox— images withoutsha256sum/test(distroless, Windows containers) can never pass verification, which silently turns "skip transfer" into "re-hydrate every start"; distinguishing "unsupported" from "diverged" (plus a single WARN) would keep the security default without the hidden performance cliff. Batching also puts N sequentialexec()calls on the start path.WorkspaceManager.readWithOverride— the host branch resolves the rawrelativePathwhileowns()compares a normalized form, and skips the containment guard that the rest of the class uses (readManagedWorkspaceFileUtf8,appendLocalFile). ReusingrequireSafeRelativePath(...)would keep the two in sync.WorkspaceDefinitionAuthority— the hostLocalFilesystemis created without aNamespaceFactory, so an owned root likeskillsanswers reads for the Layer-4<userId>/skills/logical path from the shared host directory. If that is intended,skill.md's "whichever mode you run,<userId>/skills/overrides the shared version" (EN + ZH) should carry the sandbox-mode exception.maxFileSizeMb/virtualModeare also hardcoded here rather than inherited from the primary filesystem.WorkspaceDefinitionAuthority.globalways returns success; when both sources fail the catalog looks empty rather than errored.- Minor: double host-tree walk in
build(), andcatch (Exception)swallowing interrupt status/absence of the diverging file in the log.
Questions
- Is the loss of per-user (
<userId>/skills/) overrides under an owned root a deliberate part of this security change, and should it be called out in the release notes alongside the new default? - Should
MEMORY.mdbe rejected (or warned about) when a caller adds it toworkspaceProjectionRootswhile host authority is on, given memory writes still go to the runtime filesystem?
Author validation notes are thorough and honest (noting the mvn test checklist item and the Windows symlink limitation). Since CI passes on both ubuntu and windows, could you tick or annotate the "All tests are passing" checklist item so the state of the full suite is unambiguous for the next reviewer?
Thanks for the contribution, @lzyruc — this is a substantial hardening change and the regression coverage around it is already strong.
Automated review by github-manager-bot
| } | ||
|
|
||
| Map<String, Path> projectedFiles = collectProjectedFiles(entries); | ||
| var authoritativePaths = |
There was a problem hiding this comment.
[Info] collectProjectedFiles(...) is now invoked twice per projection build (once for all entries, once filtered by isHostAuthoritativeDefinitions), which walks the host tree twice on every start. Consider collecting once and tagging each entry with its authority flag (e.g. return Map<String, AuthoritativePath> or collect per-entry in the existing loop) — same result, half the traversal, and it keeps authoritativePaths and projectedFiles from drifting if the two calls ever diverge in ordering/dedup rules.
There was a problem hiding this comment.
Thanks for the suggestion. I’ve left the two traversals unchanged in this update to keep the review follow-up focused on correctness and diagnostics. Collecting once would be a useful optimization, but hasn’t been implemented here.
|
Thanks for the detailed review. I’ll check the path normalization and per-user namespace handling, tighten the error propagation, and improve diagnostics when live verification is unavailable while keeping the fail-closed behavior. I’ll also clarify the projected MEMORY.md behavior and update the EN/ZH documentation and test checklist to reflect the passing CI runs. |
|
Thanks for the detailed review! I’ve pushed the follow-up changes and replied to the individual threads. The full Harness suite passed locally: 1,096 passed and 18 skipped. Spotless and documentation validation also passed. I’ve left the double-traversal optimization unchanged for now. Please take another look when you have time. |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Re-reviewed the delta since c2530a3c (8f614141). All five points from my previous round are addressed, and the fixes are the ones I would have written:
- Unsupported vs. diverged —
WorkspaceProjectionAppliernow probes forsha256sum/teston the first batch and raisesUnsupportedVerificationException;AbstractBaseSandboxlatchesprojectionVerificationUnsupportedso an image without the tools rehydrates once per sandbox lifetime with a single WARN instead of failing verification on every start. Fail-closed behaviour is preserved. - Path handling —
readWithOverridenow goes throughrequireSafeRelativePath(...)plus the explicitstartsWith(workspace)containment check, so the host branch can no longer drift from the rest of the class. - Per-user overrides under owned roots —
WorkspaceDefinitionAuthority.withNamespace(...)+OverlayFilesystem(namespacedLocalFilesystemupper, shared host lower) keeps host-authored<userId>/skills/ahead of the shared copy while still excluding sandbox-written definitions, andskill.md(EN + ZH) now states the sandbox-mode exception instead of claiming uniform precedence. That closes the doc/behaviour mismatch I asked about. - Error surfacing —
glob()returns a failure when both the host and the runtime enumeration fail, so an unavailable backend no longer looks like an empty catalog.FileInfopaths are also normalized before being returned, which keeps the map keys and the reported paths consistent. - Interrupt status —
InterruptedExceptionis caught separately and the interrupt flag is restored instead of being swallowed by the generic handler.
The new MEMORY.md warning also answers the second question from the last round: the projection now tells the operator that memory writes stay on the runtime filesystem, rather than silently pretending host authority covers it.
Two Info notes inline; neither affects correctness. Verified locally against the branch: withNamespace/OverlayFilesystem.of(upper, lower) arity matches the existing APIs, LocalFsMode/PathPolicy resolve from the same package, and GlobResult.fail(String) exists, so this compiles without new plumbing. CLA signed (license/cla: success); validate, Check License, Check Module Sync and build (ubuntu-latest) are green — build (windows-latest) was still in flight at review time, which is a merge gate rather than a review blocker.
Thanks for the thorough turnaround, @lzyruc — approving.
Automated review by github-manager-bot
| protected abstract String getWorkspaceRoot(); | ||
|
|
||
| private boolean projectionMatchesSandbox(WorkspaceProjectionApplier.ProjectionPayload payload) { | ||
| if (payload.fileHashes().isEmpty()) return true; |
There was a problem hiding this comment.
[Info] fileHashes().isEmpty() -> return true is correct (the aggregate payload.hash() still gates the skip), but the condition reads like 'no authoritative files means no verification was possible'. A one-line comment — nothing host-authoritative to verify, the tar hash alone decides — would save the next reader the detour through build().
| List<Map.Entry<String, String>> batch = | ||
| files.subList(start, Math.min(start + 64, files.size())); | ||
| StringBuilder command = new StringBuilder(); | ||
| if (start == 0) { |
There was a problem hiding this comment.
[Info] The probe runs only on the first batch (start == 0), so an image that has sha256sum but is missing test on a later batch would still be reported as a plain mismatch instead of unsupported. Both usually come from the same coreutils/shell, so this is fine — noting it only so the asymmetry reads as deliberate.
AgentScope-Java Version
2.0.4-SNAPSHOT, based on main at
9e43ed8.Description
Fixes #3388.
Sandbox modifications to projected definitions could persist in snapshots and enter the next call's system prompt or skill catalog. Projection also skipped hydration when the host hash was unchanged, without checking whether the sandbox copy had been modified.
This PR makes configured projection roots host-authoritative for workspace context, skills and their resources, and subagent declarations. Before skipping hydration, projection now verifies the current sandbox files. Divergence or failed verification triggers rehydration from the host.
Default projection roots remain unchanged. Default
MEMORY.mdretains its existing runtime reads, writes, and persistence. Explicitly projectedMEMORY.mdreceives the same protection as other projected definitions. Ordinary sandbox files and shell execution remain writable.Adds
.hostAuthoritativeDefinitions(false)to restore legacy behavior, with matching English and Chinese documentation.Host-authored user skill overrides retain the configured isolation namespace and take precedence over shared host skills; sandbox-authored overrides beneath owned roots remain excluded. This namespace view is limited to skill repositories, including skill management. Host reads validate paths, and failed definition globs retain their error status.
Unsupported hashing utilities are detected and warned about once per sandbox instance; verification remains fail-closed with hydration on each start. Verification interruptions restore the interrupt flag. Migration and explicitly projected MEMORY.md behavior are clarified in EN/ZH documentation, and projected memory emits a configuration warning.
Validation:
git diff --check: passed.Cross-call regression tests use a local fake sandbox backend with actual Harness calls and tar snapshot persistence/restoration, covering USER, AGENT, and GLOBAL isolation. No live model or container backend was used.
Full repository
clean verifywas attempted but stopped in two unchanged Core tests because this Windows environment lacks symlink privileges. Mintlify's localbroken-linkscheck also fails on unmodified main; the four additional anchor links in this PR pass the repository static checker and build validation.Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test) — the published commit passed Ubuntu and Windows CI. This follow-up passes the full Harness suite locally; local full-repository verification is still blocked by the two existing Windows symlink cases. CI for the follow-up is pending.