fix: 回填 result envelope failureKind

This commit is contained in:
AgentRun Codex
2026-06-11 09:42:36 +08:00
parent a3c8138172
commit b4c48b724d
3 changed files with 77 additions and 4 deletions
+8
View File
@@ -394,6 +394,10 @@ async function runFailureDoesNotTerminalRunCase(options: { client: ManagerClient
assert.equal(["claimed", "running"].includes(String(run.status)), true, "command failure must keep the reusable run/session non-terminal");
assert.equal(run.terminalStatus, null);
assert.equal(run.failureKind, null);
const runEnvelope = await options.client.get(`/api/v1/runs/${item.runId}/result?commandId=${item.commandId}`) as JsonRecord;
assert.equal(runEnvelope.failureKind, "provider-http-error", "run result must inherit terminal command failureKind even when reusable run stays non-terminal");
const commandEnvelope = await options.client.get(`/api/v1/runs/${item.runId}/commands/${item.commandId}/result`) as JsonRecord;
assert.equal(commandEnvelope.failureKind, "provider-http-error", "command result must expose provider HTTP failureKind from terminal command/events");
}
async function runFailureCase(options: { client: ManagerClient; managerUrl: string; context: SelfTestContext; mode: string; expectedStatus: TerminalStatus; expectedFailureKind: FailureKind; timeoutMs?: number; expectRetryError?: boolean }): Promise<void> {
@@ -509,6 +513,10 @@ async function runSpawnFailureCase(options: { client: ManagerClient; managerUrl:
assert.ok(events.items?.some((event) => event.type === "error"), "spawn failure");
const command = await options.client.get(`/api/v1/runs/${item.runId}/commands/${item.commandId}`) as { state?: string };
assert.equal(command.state, "failed", "spawn failure");
const commandEnvelope = await options.client.get(`/api/v1/runs/${item.runId}/commands/${item.commandId}/result`) as JsonRecord;
assert.equal(commandEnvelope.failureKind, "backend-spawn-failed", "spawn failure command result kind");
const runEnvelope = await options.client.get(`/api/v1/runs/${item.runId}/result?commandId=${item.commandId}`) as JsonRecord;
assert.equal(runEnvelope.failureKind, "backend-spawn-failed", "spawn failure run result kind");
assertNoSecretLeak(events);
}