agentscope-ai / agentscope-ai/agentscope-java

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

オープン
#2,396 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
area/extensions bug
主要言語
Java
スター
5.6k
フォーク
1.3k
平均マージ
4日 12時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。