Problem
When BP_DATA_DIR=/data, the agent workspace and persistent library use physical paths under the same prefix that is also treated as a logical alias:
- workspace:
/data/workspaces/<session>
- persistent library:
/data/data
- logical
/data/...: persistent library
Structured file tools currently interpret every /data/... as a logical path before checking whether it is already a real path under the current workspace or persistent directory. This rewrites workspace paths to /data/data/workspaces/... and can rewrite /data/data/... to /data/data/data/.... Bash still uses the physical path, so Bash and read/write/edit disagree about the same string.
Root cause
rewriteLogicalPath selects /data by string prefix before classifying known physical roots. Existing tests use /root/.bp-root, so they do not cover the production collision.
Proposed fix
- For absolute paths, classify current workspace, attachments, persistent, and shared physical roots first.
- Apply logical aliases only when the path is not already under a known physical root.
- Keep HTTP Files API logical-path behavior unchanged.
- Add regression tests with
cwd=/data/workspaces/s1 and persistentDir=/data/data.
Acceptance criteria
- Structured tools and Bash address the same workspace file.
- Real persistent paths are not rewritten twice.
- Logical
/data/x still maps to /data/data/x.
/workspace/x remains session-scoped.
- Existing traversal and cross-session confinement tests continue to pass.
Problem
When
BP_DATA_DIR=/data, the agent workspace and persistent library use physical paths under the same prefix that is also treated as a logical alias:/data/workspaces/<session>/data/data/data/...: persistent libraryStructured file tools currently interpret every
/data/...as a logical path before checking whether it is already a real path under the current workspace or persistent directory. This rewrites workspace paths to/data/data/workspaces/...and can rewrite/data/data/...to/data/data/data/.... Bash still uses the physical path, so Bash and read/write/edit disagree about the same string.Root cause
rewriteLogicalPathselects/databy string prefix before classifying known physical roots. Existing tests use/root/.bp-root, so they do not cover the production collision.Proposed fix
cwd=/data/workspaces/s1andpersistentDir=/data/data.Acceptance criteria
/data/xstill maps to/data/data/x./workspace/xremains session-scoped.