agentscope-ai / agentscope-ai/agentscope-java

[Bug]:创建k8s沙箱的时候报错,无法新建工作目录

未关闭
#2,396 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area/extensions bug
主要语言
Java
星标
5.6k
派生
1.3k
平均合并
4 天 12 小时
30 天内合并 PR
77

描述

public ExecResult exec(KubernetesSandboxState state, String command, int timeoutSeconds)
throws Exception {
String script =
"cd " + shellSingleQuote(state.getWorkspaceRoot()) + " && (" + command + ")";
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
ContainerResource pod = pod(state);
try (ExecWatch watch = pod.writingOutput(out).writingError(err).exec("sh", "-c", script)) {
Integer exit = watch.exitCode().get(timeoutSeconds + 5L, TimeUnit.SECONDS);
int code = exit != null ? exit : -1;
String stdout = truncate(out.toByteArray());
String stderr = truncate(err.toByteArray());
boolean truncated =
out.size() >= OUTPUT_TRUNCATE_BYTES || err.size() >= OUTPUT_TRUNCATE_BYTES;
ExecResult result = new ExecResult(code, stdout, stderr, truncated);
if (!result.ok()) {
throw new SandboxException.ExecException(code, stdout, stderr);
}
return result;
} catch (java.util.concurrent.TimeoutException e) {
throw new SandboxException.ExecTimeoutException(command, timeoutSeconds);
}
}
这个代码中命令是cd workspace && mkdir -p workspace,但是workspace 不存在,cd workspace会报错,导致创建沙箱失败

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。