feat: summarize codex stream progress events
This commit is contained in:
@@ -528,6 +528,78 @@ test("POST task progress preserves Codex thread collaboration summaries without
|
||||
assert.equal(serialized.includes("turn-secret-should-not-persist"), false);
|
||||
});
|
||||
|
||||
test("POST task progress preserves Codex stream event counters without leaking raw deltas", async () => {
|
||||
const task = await data.queueMasterAgentTask({
|
||||
taskId: "route-progress-stream-events-task",
|
||||
projectId: "group-progress-test",
|
||||
taskType: "dispatch_execution",
|
||||
requestMessageId: "msg-route-progress-stream-events",
|
||||
requestText: "检查 Codex 流式增量",
|
||||
executionPrompt: "检查 Codex 流式增量",
|
||||
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" }],
|
||||
streamEvents: {
|
||||
status: "streaming",
|
||||
agentDeltaCount: 2,
|
||||
planDeltaCount: 1,
|
||||
reasoningDeltaCount: 3,
|
||||
toolProgressCount: 1,
|
||||
commandOutputChunkCount: 4,
|
||||
terminalInteractionCount: 1,
|
||||
fileOutputChunkCount: 1,
|
||||
delta: "secret delta should-not-persist",
|
||||
text: "secret text should-not-persist",
|
||||
output: "secret output should-not-persist",
|
||||
content: "secret content should-not-persist",
|
||||
command: "cat secret should-not-persist",
|
||||
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?.streamEvents, {
|
||||
status: "streaming",
|
||||
agentDeltaCount: 2,
|
||||
planDeltaCount: 1,
|
||||
reasoningDeltaCount: 3,
|
||||
toolProgressCount: 1,
|
||||
commandOutputChunkCount: 4,
|
||||
terminalInteractionCount: 1,
|
||||
fileOutputChunkCount: 1,
|
||||
});
|
||||
const serialized = JSON.stringify(progress);
|
||||
assert.equal(serialized.includes("should-not-persist"), false);
|
||||
assert.equal(serialized.includes("turn-secret"), false);
|
||||
});
|
||||
|
||||
test("POST task progress preserves Codex tool activity summaries without leaking raw payloads", async () => {
|
||||
const task = await data.queueMasterAgentTask({
|
||||
taskId: "route-progress-tool-activity-task",
|
||||
|
||||
Reference in New Issue
Block a user