feat: map codex thread collaboration progress
This commit is contained in:
@@ -447,3 +447,73 @@ test("POST task progress preserves Codex account, quota, verification, and notic
|
||||
assert.equal(serialized.includes("sk-secret-should-not-persist"), false);
|
||||
assert.equal(serialized.includes("turn-secret-should-not-persist"), false);
|
||||
});
|
||||
|
||||
test("POST task progress preserves Codex thread collaboration summaries without leaking thread internals", async () => {
|
||||
const task = await data.queueMasterAgentTask({
|
||||
taskId: "route-progress-thread-collab-task",
|
||||
projectId: "group-progress-test",
|
||||
taskType: "dispatch_execution",
|
||||
requestMessageId: "msg-route-progress-thread-collab",
|
||||
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" }],
|
||||
threadCollaboration: {
|
||||
tool: "send_input",
|
||||
status: "completed",
|
||||
target: "已有线程",
|
||||
agentStatus: "completed",
|
||||
senderThreadId: "thread-source-secret-should-not-persist",
|
||||
receiverThreadId: "thread-target-secret-should-not-persist",
|
||||
prompt: "internal prompt token=sk-secret-should-not-persist",
|
||||
},
|
||||
compaction: {
|
||||
status: "completed",
|
||||
message: "上下文已压缩",
|
||||
turnId: "turn-secret-should-not-persist",
|
||||
},
|
||||
},
|
||||
}),
|
||||
}),
|
||||
{ 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.deepEqual(progress?.threadCollaboration, {
|
||||
tool: "send_input",
|
||||
status: "completed",
|
||||
target: "已有线程",
|
||||
agentStatus: "completed",
|
||||
});
|
||||
assert.equal(progress?.compaction?.status, "completed");
|
||||
const serialized = JSON.stringify(progress);
|
||||
assert.equal(serialized.includes("thread-source-secret-should-not-persist"), false);
|
||||
assert.equal(serialized.includes("thread-target-secret-should-not-persist"), false);
|
||||
assert.equal(serialized.includes("internal prompt"), false);
|
||||
assert.equal(serialized.includes("sk-secret-should-not-persist"), false);
|
||||
assert.equal(serialized.includes("turn-secret-should-not-persist"), false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user