feat: add thread status documents and safe thread reply handling
This commit is contained in:
@@ -37,3 +37,27 @@ test("RemoteRuntimeAdapter 会忽略空白字段并保留失败状态", () => {
|
||||
assert.equal(normalized.rawThreadReply, undefined);
|
||||
assert.equal(normalized.errorMessage, "MODEL_CALL_FAILED");
|
||||
});
|
||||
|
||||
test("RemoteRuntimeAdapter 会把线程环境脏回复改写成失败", () => {
|
||||
const normalized = normalizeRemoteExecutionResultForTesting({
|
||||
status: "completed",
|
||||
replyBody:
|
||||
"我不能直接把当前会话环境从只读改回可写。cwd 我可以在命令里指向 /Users/kris/code/gptpluscontrol,但真正卡住的是只读权限。",
|
||||
});
|
||||
|
||||
assert.equal(normalized.status, "failed");
|
||||
assert.equal(normalized.replyBody, undefined);
|
||||
assert.equal(normalized.rawThreadReply, undefined);
|
||||
assert.match(normalized.errorMessage ?? "", /THREAD_ENVIRONMENT_INVALID/);
|
||||
});
|
||||
|
||||
test("RemoteRuntimeAdapter 不会误杀包含路径和 sandbox 描述的有效线程回复", () => {
|
||||
const normalized = normalizeRemoteExecutionResultForTesting({
|
||||
status: "completed",
|
||||
replyBody:
|
||||
"已经把配置写到 /Users/kris/code/gptpluscontrol/.env.local,接下来如果线上仍受 sandbox 限制,我们再切到服务器验证。",
|
||||
});
|
||||
|
||||
assert.equal(normalized.status, "completed");
|
||||
assert.match(normalized.replyBody ?? "", /gptpluscontrol/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user