feat: add thread status documents and safe thread reply handling

This commit is contained in:
kris
2026-04-04 11:50:46 +08:00
parent 010d8eda2d
commit 4d9b8e2976
10 changed files with 487 additions and 57 deletions

View File

@@ -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/);
});