agentscope-ai / agentscope-ai/agentscope-java

[Bug]:BaseSandboxFilesystem.edit() generates broken python3 -c command with literal \n

Đang mở
#1,609 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area/harness bug
Ngôn ngữ chính
Java
Star
5.6k
Fork
1.3k
Merge trung bình
4 ngày 12 giờ
Pull request đã merge (30 ngày)
77

Mô tả

Description

BaseSandboxFilesystem.edit() generates python3 -c "...code..." shell 命令,Python 语句之间用字面两字符 \n 分隔。但 shell 双引号不会把 \n 解释为换行,导致 Python 收到单行代码 → SyntaxError。

Steps to Reproduce

1. 使用 SandboxBackedFilesystem 配合远程沙箱(Aone / E2B 等)
2. 调用 edit(ctx, path, oldString, newString, false)
3. 框架生成类似:
python3 -c "import pathlib\npath = pathlib.Path('/home/user/workspace/foo.txt')\n..."
4. 沙箱 shell 执行 → Python 收到单行 → SyntaxError

Expected Behavior

edit 操作应成功。建议的修复方式:不走 exec,改为:
1. 通过沙箱 file API 读取文件内容
2. Java 侧完成字符串替换
3. 通过沙箱 file API 写回

Environment

- agentscope version: 2.0.0-RC1
- Sandbox: Aone remote sandbox
- Java: 21

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.