[GH-ISSUE #241] Composite backend doesn't respect path->backend mapping #234

Closed
opened 2026-06-05 17:21:11 -04:00 by yindo · 2 comments
Owner

Originally created by @alvedder on GitHub (Feb 21, 2026).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/241

Originally assigned to: @christian-bromann on GitHub.

Please let me know whether it's expected behavior or not, if the latter then I can submit a PR.

Description

Composite backend is supposed to route requests to backends based on path mapping, yet globInfo and grepRaw do not respect the path mapping configuration

Current Behavior

Both globInfo and grepRaw follow the same algorithm:

  1. try to find a backend by the path mapping configuration and delegate the command
  2. if a matching routed backend is not found delegate the command to the default backend
  3. keep delegating to each and every routed backend no matter what the path config says

grepRaw implementation
globInfo implementation

Expected Behavior

I'd expect step 3 to be dropped: if no routed backend is found then delegate only to the default backend and return the result.
Routed backends are configured for a reason and from my perspective they should be used for matching paths only.

Reproduction

For a setup like this

new CompositeBackend(workspaceFs, { // a remote sandbox
    'memory/': configsFs, // host machine's filesystem
    'skills/': configsFs, // same
})

a tool call like this

"tool_calls": [
  {
    "name": "grep",
    "args": {
      "path": "/workspace",
      "pattern": "index",
      "glob": "**/*"
    },
    "id": "call_eheeJEPNpT70OljJ5eYlrrbe",
    "type": "tool_call"
  }
]

will trigger composite backend to search within configsFs backend which in my case fails with "EPERM: operation not permitted, scandir '/Library/Bluetooth'" (which is expected on a MacOS machine)

Environment
deepagents: 1.8.0

Workaround

I extended CompositeBackend in my repo and fully overrode globInfo and grepRaw

Originally created by @alvedder on GitHub (Feb 21, 2026). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/241 Originally assigned to: @christian-bromann on GitHub. Please let me know whether it's expected behavior or not, if the latter then I can submit a PR. ## Description Composite backend is supposed to route requests to backends based on path mapping, yet `globInfo` and `grepRaw` do not respect the path mapping configuration ## Current Behavior Both `globInfo` and `grepRaw` follow the same algorithm: 1. try to find a backend by the path mapping configuration and delegate the command 2. if a matching routed backend is not found delegate the command to the default backend 3. **keep delegating to each and every routed backend no matter what the path config says** [`grepRaw` implementation](https://github.com/langchain-ai/deepagentsjs/blob/main/libs/deepagents/src/backends/composite.ts#L150-L201) [`globInfo` implementation](https://github.com/langchain-ai/deepagentsjs/blob/main/libs/deepagents/src/backends/composite.ts#L206-L240) ## Expected Behavior I'd expect step 3 to be dropped: if no routed backend is found then delegate only to the default backend and return the result. Routed backends are configured for a reason and from my perspective they should be used for matching paths only. ## Reproduction For a setup like this ```ts new CompositeBackend(workspaceFs, { // a remote sandbox 'memory/': configsFs, // host machine's filesystem 'skills/': configsFs, // same }) ``` a tool call like this ```json "tool_calls": [ { "name": "grep", "args": { "path": "/workspace", "pattern": "index", "glob": "**/*" }, "id": "call_eheeJEPNpT70OljJ5eYlrrbe", "type": "tool_call" } ] ``` will trigger composite backend to search within `configsFs` backend which in my case fails with "EPERM: operation not permitted, scandir '/Library/Bluetooth'" (which is expected on a MacOS machine) Environment deepagents: 1.8.0 ## Workaround I extended `CompositeBackend` in my repo and fully overrode `globInfo` and `grepRaw`
yindo closed this issue 2026-06-05 17:21:11 -04:00
Author
Owner

@christian-bromann commented on GitHub (Feb 24, 2026):

@alvedder thanks for raising the issue, as clarification, would a tool call like this:

"tool_calls": [
  {
    "name": "grep",
    "args": {
      "path": "/m",
      "pattern": "index",
      "glob": "**/*"
    },
    "id": "call_eheeJEPNpT70OljJ5eYlrrbe",
    "type": "tool_call"
  }
]

include a lookup in memory/?

<!-- gh-comment-id:3949112726 --> @christian-bromann commented on GitHub (Feb 24, 2026): @alvedder thanks for raising the issue, as clarification, would a tool call like this: ``` "tool_calls": [ { "name": "grep", "args": { "path": "/m", "pattern": "index", "glob": "**/*" }, "id": "call_eheeJEPNpT70OljJ5eYlrrbe", "type": "tool_call" } ] ``` include a lookup in `memory/`?
Author
Owner

@alvedder commented on GitHub (Feb 25, 2026):

@christian-bromann a tool call like this will indeed include a lookup in memory/, same with /memory/, just reproduced both cases.

I even found one more issue, with a setup like this

new CompositeBackend(workspaceFs, {
    '/w/': configsFs,
});

a tool call like this

"tool_calls": [
  {
    "name": "grep",
    "args": {
      "pattern": "index",
      "path": "/workspace"
    },
    "id": "call_mJQ8t5aaitaRSZPFktvPX4SG",
    "type": "tool_call"
  }
]

will be routed to /w/ backend (configsFs) and WILL NEVER reach workspaceFs.
Moreover, it will even strip out /w from the path and the actual tool call will look like this:

[2026-02-25T19:03:47.164Z] [DEBUG] [FilesystemBackend:configs] grepRaw called with {
  "pattern": "index",
  "dirPath": "orkspace",
  "glob": null
}
<!-- gh-comment-id:3961412481 --> @alvedder commented on GitHub (Feb 25, 2026): @christian-bromann a tool call like this will indeed include a lookup in `memory/`, same with `/memory/`, just reproduced both cases. I even found one more issue, with a setup like this ``` new CompositeBackend(workspaceFs, { '/w/': configsFs, }); ``` a tool call like this ``` "tool_calls": [ { "name": "grep", "args": { "pattern": "index", "path": "/workspace" }, "id": "call_mJQ8t5aaitaRSZPFktvPX4SG", "type": "tool_call" } ] ``` will be routed to `/w/` backend (`configsFs`) and WILL NEVER reach `workspaceFs`. Moreover, it will even strip out `/w` from the path and the actual tool call will look like this: ```log [2026-02-25T19:03:47.164Z] [DEBUG] [FilesystemBackend:configs] grepRaw called with { "pattern": "index", "dirPath": "orkspace", "glob": null } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#234