agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

SandboxClientOptions.workspaceRoot vs WorkspaceSpec.root — duplicate configuration

Open chcodex opened this issue 4 months ago • 5 comments

When configuring a sandbox filesystem, users need to set the workspace root path in two separate places, which is confusing and error-prone:

WorkspaceSpec workspaceSpec = new WorkspaceSpec();
workspaceSpec.setRoot("/home/user/workspace");

SandboxFilesystemSpec filesystemSpec = new E2bFilesystemSpec()
    .workspaceRoot("/home/user/workspace")       // → SandboxClientOptions.workspaceRoot
    .workspaceSpec(workspaceSpec)                 // → WorkspaceSpec.root
    ...

There are two independent configuration paths for the same concept:

  1. SandboxClientOptions.workspaceRoot — read by *SandboxClient.create() to set the sandbox state's internal root
  2. WorkspaceSpec.root — read by AbstractBaseSandbox (WorkspaceSpecApplier) for spec apply / mount calculations

If a user sets only one and not the other, the sandbox may behave inconsistently (e.g., exec commands use one path while mount/bind logic uses another).

Questions:

  1. Are these two values intentionally redundant, or is this a legacy design that should be consolidated?
  2. If we keep only WorkspaceSpec.root as the single source of truth, could *SandboxClient.create() read workspaceSpec.getRoot() instead of options.getWorkspaceRoot()?
  3. Would a PR to remove SandboxClientOptions.workspaceRoot and redirect everything through WorkspaceSpec.root be accepted?

chcodex avatar Jul 13 '26 08:07 chcodex

@chickenlj @jujn Can you help me answer this question?

chcodex avatar Jul 13 '26 09:07 chcodex

@chickenlj @jujn Can you help me answer this question?

At present, I am not particularly familiar with the harness module, so I cannot provide a clear answer to you. You can wait for now, or follow other issues. We warmly welcome your contribution.

jujn avatar Jul 13 '26 09:07 jujn

@chickenlj This code was committed by you. Could you help clarify this issue?

chcodex avatar Jul 13 '26 09:07 chcodex

Image Image From the documentation, these two seem to have the same meaning.

chcodex avatar Jul 14 '26 06:07 chcodex

@Chickenlj @LearningGp @fang-tech @flystar32 @albumenj @guanxuc @JGoP-L @shiyiyue1102 @jujn @KomachiSion

Is there anyone who can help answer this question?

chcodex avatar Jul 14 '26 06:07 chcodex