feat: surface codex app-server approval progress

This commit is contained in:
AI Bot
2026-05-31 03:36:07 +08:00
parent b9d3cca2e7
commit 4800352e22
12 changed files with 691 additions and 5 deletions

View File

@@ -84,3 +84,73 @@ test("POST task progress accepts device-token updates and keeps task running", a
assert.equal(progressMessage?.executionProgress?.steps[0]?.text, "连接 Codex App Server");
assert.equal(progressMessage?.executionProgress?.branch?.additions, 12);
});
test("POST task progress preserves Codex approval, warning, and file-change summaries", async () => {
const task = await data.queueMasterAgentTask({
taskId: "route-progress-approval-task",
projectId: "group-progress-test",
taskType: "dispatch_execution",
requestMessageId: "msg-route-progress-approval",
requestText: "让目标线程继续开发并回写审批状态",
executionPrompt: "让目标线程继续开发并回写审批状态",
requestedBy: "krisolo",
requestedByAccount: "krisolo",
deviceId: "mac-studio",
targetProjectId: "master-agent",
targetThreadId: "master-agent-thread",
});
await data.claimNextMasterAgentTask("mac-studio");
const response = await postProgress(
new NextRequest(`http://127.0.0.1:3000/api/v1/master-agent/tasks/${task.taskId}/progress`, {
method: "POST",
headers: {
"content-type": "application/json",
"x-boss-device-token": "boss-mac-studio-token",
},
body: JSON.stringify({
deviceId: "mac-studio",
status: "running",
executionProgress: {
steps: [{ text: "等待 Codex 审批事件", status: "running" }],
approvals: [
{
id: "cmd-approval-1",
kind: "command",
label: "命令执行审批",
status: "resolved",
detail: "需要确认命令执行",
},
],
warnings: [
{
id: "guardian-warning-1",
message: "检测到需要用户确认的命令执行。",
severity: "warning",
},
],
fileChanges: [
{
id: "file-change-1",
path: "src/app/page.tsx",
kind: "update",
status: "updated",
},
],
},
}),
}),
{ params: Promise.resolve({ taskId: task.taskId }) },
);
assert.equal(response.status, 200);
const state = await data.readState();
const progress = state.projects
.find((project) => project.id === "master-agent")
?.messages.find((message) => message.executionProgress?.taskId === task.taskId)
?.executionProgress;
assert.equal(progress?.approvals?.[0]?.label, "命令执行审批");
assert.equal(progress?.warnings?.[0]?.message, "检测到需要用户确认的命令执行。");
assert.equal(progress?.fileChanges?.[0]?.path, "src/app/page.tsx");
});