fix: 增加 result tool call 摘要
This commit is contained in:
@@ -72,7 +72,7 @@ async function assertBackendPreflight(client: ManagerClient): Promise<void> {
|
||||
|
||||
async function assertEventContractAndCompletedSemantics(client: ManagerClient, context: SelfTestContext, managerUrl: string): Promise<void> {
|
||||
const happy = await createRunWithCommand(client, context, "hello event contract", "selftest-event-contract", 15_000);
|
||||
await client.post(`/api/v1/runs/${happy.runId}/events`, { type: "tool_call", payload: { method: "selftest/tool", item: { command: "echo ok" } } });
|
||||
await client.post(`/api/v1/runs/${happy.runId}/events`, { type: "tool_call", payload: { method: "item/completed", type: "commandExecution", toolName: "commandExecution", itemId: "call_selftest_hwpod", command: "authorization=Bearer selftest-redacted-value hwpod build --hwpod-id d601-f103-v2", cwd: "/workspace/hwlab", status: "completed", exitCode: 0, processId: "1234" } });
|
||||
await client.post(`/api/v1/runs/${happy.runId}/events`, { type: "diff", payload: { filesChanged: 1, summary: "selftest diff" } });
|
||||
const result = await runOnce({ managerUrl, runId: happy.runId, codexCommand: context.fakeCodexCommand, codexArgs: context.fakeCodexArgs, codexHome: context.codexHome, env: { CODEX_HOME: context.codexHome }, oneShot: true });
|
||||
assert.equal(result.terminalStatus, "completed");
|
||||
@@ -86,6 +86,15 @@ async function assertEventContractAndCompletedSemantics(client: ManagerClient, c
|
||||
assert.equal(envelope.completed, true);
|
||||
assert.equal(envelope.terminalStatus, "completed");
|
||||
assert.equal(envelope.terminalSource, "command-record");
|
||||
const toolCallSummary = envelope.toolCallSummary as JsonRecord;
|
||||
assert.equal(toolCallSummary.count, 1);
|
||||
assert.deepEqual(toolCallSummary.statusCounts, { completed: 1 });
|
||||
assert.deepEqual(toolCallSummary.exitCodeCounts, { "0": 1 });
|
||||
const toolCallItems = toolCallSummary.items as JsonRecord[];
|
||||
assert.equal(toolCallItems[0]?.status, "completed");
|
||||
assert.equal(toolCallItems[0]?.exitCode, 0);
|
||||
assert.match(String(toolCallItems[0]?.command), /hwpod build/u);
|
||||
assert.doesNotMatch(String(toolCallItems[0]?.command), /selftest-redacted-value/u);
|
||||
assertNoSecretLeak({ eventsResponse, envelope });
|
||||
|
||||
const partial = await createRunWithCommand(client, context, "partial should not complete", "selftest-partial-not-completed", 15_000);
|
||||
|
||||
Reference in New Issue
Block a user