[PR #557] fix(acp): run filesystem backend in virtual mode #559

Open
opened 2026-06-05 17:23:44 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/557
Author: @johannes117
Created: 5/28/2026
Status: 🔄 Open

Base: mainHead: fix/acp-filesystem-virtual-mode


📝 Commits (2)

  • c99449a fix(acp): run filesystem backend in virtual mode
  • 4a99bca fix(acp): avoid ReDoS-prone path regex, add changeset

📊 Changes

6 files changed (+70 additions, -43 deletions)

View changed files

.changeset/acp-virtual-mode.md (+6 -0)
📝 libs/acp/src/acp-filesystem-backend.test.ts (+39 -29)
📝 libs/acp/src/acp-filesystem-backend.ts (+9 -4)
📝 libs/acp/src/adapter.test.ts (+5 -5)
📝 libs/acp/src/adapter.ts (+10 -4)
📝 libs/deepagents/src/backends/filesystem.ts (+1 -1)

📄 Description

Problem

The ACP filesystem backend runs non-virtual, so a path-less grep (default path = "/") resolves to the real filesystem root and scans the whole disk — wasteful, and crashes on unreadable dirs (e.g. macOS /Library/Trial without Full Disk Access) as session/prompt -> Internal error.

Fix

virtualMode: true on the backend, matching Python (FilesystemBackend(root_dir=cwd, virtual_mode=True) in deepagents_acp/server.py). Paths become virtual, rooted at the workspace; ../~ blocked.

  • FilesystemBackend.resolvePathprotected so the ACP subclass reuses it for read/write proxying.
  • extractToolCallLocations resolves virtual paths under workspaceRoot so clients still get real paths.

Test

ACP unit suite (157) and deepagents filesystem (20) pass. server.ts typecheck errors are pre-existing (unchanged on main).

Complements #556 (scope fix here; #556 hardens unreadable dirs within a valid workspace).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/557 **Author:** [@johannes117](https://github.com/johannes117) **Created:** 5/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/acp-filesystem-virtual-mode` --- ### 📝 Commits (2) - [`c99449a`](https://github.com/langchain-ai/deepagentsjs/commit/c99449a175bc355dea4ab48b27e5ca217a4f3f70) fix(acp): run filesystem backend in virtual mode - [`4a99bca`](https://github.com/langchain-ai/deepagentsjs/commit/4a99bca6c851f82240967fbdcad16656af5b1625) fix(acp): avoid ReDoS-prone path regex, add changeset ### 📊 Changes **6 files changed** (+70 additions, -43 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/acp-virtual-mode.md` (+6 -0) 📝 `libs/acp/src/acp-filesystem-backend.test.ts` (+39 -29) 📝 `libs/acp/src/acp-filesystem-backend.ts` (+9 -4) 📝 `libs/acp/src/adapter.test.ts` (+5 -5) 📝 `libs/acp/src/adapter.ts` (+10 -4) 📝 `libs/deepagents/src/backends/filesystem.ts` (+1 -1) </details> ### 📄 Description ## Problem The ACP filesystem backend runs non-virtual, so a path-less `grep` (default `path = "/"`) resolves to the real filesystem root and scans the whole disk — wasteful, and crashes on unreadable dirs (e.g. macOS `/Library/Trial` without Full Disk Access) as `session/prompt -> Internal error`. ## Fix `virtualMode: true` on the backend, matching Python (`FilesystemBackend(root_dir=cwd, virtual_mode=True)` in `deepagents_acp/server.py`). Paths become virtual, rooted at the workspace; `..`/`~` blocked. - `FilesystemBackend.resolvePath` → `protected` so the ACP subclass reuses it for read/write proxying. - `extractToolCallLocations` resolves virtual paths under `workspaceRoot` so clients still get real paths. ## Test ACP unit suite (157) and deepagents filesystem (20) pass. `server.ts` typecheck errors are pre-existing (unchanged on `main`). Complements #556 (scope fix here; #556 hardens unreadable dirs within a valid workspace). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 17:23:44 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#559