Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
oss-maintainer
left a comment
There was a problem hiding this comment.
Review: PR #2364 — fix(harness): honor isolation scope for shell working directory
Verdict: Approved ✅
Summary
Fixes resolveExecuteCwd() to check namespace scope before falling back to shellCwd. Previously, shellCwd took priority, which meant USER/SESSION isolation was silently bypassed when a default shell working directory was configured.
Analysis
The bug:
When shellCwd was set (e.g., to the user's project directory), namespaced calls (USER/SESSION isolation) would still use shellCwd instead of the namespaced path. This broke workspace isolation — a SESSION-scoped agent could see/modify another session's files.
The fix:
// Before: shellCwd checked first
if (shellCwd != null) return shellCwd;
if (namespace != null) return namespacedPath;
// After: namespace checked first
if (namespace != null) return namespacedPath;
if (shellCwd != null) return shellCwd;This is the correct priority: explicit isolation scope should always override the default working directory.
Test coverage:
- SESSION namespace with shellCwd set → uses namespaced path ✅
- USER namespace with shellCwd set → uses namespaced path ✅
- GLOBAL (null namespace) with shellCwd → uses shellCwd ✅
- Null namespace + null shellCwd → falls back to cwd ✅
- Directory creation failure → proper error handling ✅
Javadoc updates accurately describe the new priority order.
All CI checks pass. Important isolation fix.
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR fixes a genuine isolation bug in LocalFilesystemWithShell.execute(). Previously, shell commands always ran with pwd = shellCwd (or rootDir) regardless of whether a NamespaceFactory was configured. The fix adds a branch: when a namespace is active, pwd is set to getCwd() (the namespaced root); otherwise it falls back to shellCwd / rootDir. Six new tests cover all namespace × shellCwd combinations. The core logic is correct and the fix is clean.
(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR fixes a genuine isolation bug in LocalFilesystemWithShell.execute(). Previously, shell commands always ran with pwd = shellCwd (or rootDir) regardless of whether a NamespaceFactory was configured. The fix adds a branch: when a namespace is active, pwd is set to getCwd() (the namespaced root); otherwise it falls back to shellCwd / rootDir. Six new tests cover all namespace × shellCwd combinations. The core logic is correct and the fix is clean.
(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR fixes a genuine isolation bug in LocalFilesystemWithShell.execute(). Previously, shell commands always ran with pwd = shellCwd (or rootDir) regardless of whether a NamespaceFactory was configured. The fix adds a branch: when a namespace is active, pwd is set to getCwd() (the namespaced root); otherwise it falls back to shellCwd / rootDir. Six new tests cover all namespace × shellCwd combinations. The core logic is correct and the fix is clean.
(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)
|
This PR currently conflicts with git fetch upstream
git checkout fix/2329-isolated-shell-working-directory
git rebase upstream/main
# resolve conflicts, then:
git push --force-with-leaseThis is a one-time reminder. Once the conflicts are resolved, comment Automated notification by github-manager-bot |
|
1. Must-fix before merge: the workspace system prompt now contradicts actual behavior. 2. Please state the behavior change explicitly in the PR description. After the flip, 3. Style: prefer keeping 4. Minor observation on the failure path. When |
Summary
Testing
mvn -pl agentscope-harness -Dtest=ProjectAwareOverlayTest,LocalFilesystemModeTest testgit diff --checkFixes #2329