fix: support case-level caserun agent timeouts

This commit is contained in:
Codex Agent
2026-06-06 20:50:56 +08:00
parent 844d4a3683
commit 991beeded6
3 changed files with 44 additions and 9 deletions
+7
View File
@@ -275,6 +275,7 @@ test("case run orchestrates agent prompt, diff capture, and compile evidence wit
title: "D601-F103-V2 Keil compile-only CaseRun",
hwpodSpec: "hwpod-spec.yaml",
subject: { repoLocalPath: SUBJECT_REPO_LOCAL_PATH, commitId: SUBJECT_COMMIT_ID, subdir: "projects/01_baseline" },
agentTask: { workspace: "subjectWorktree", prompt: "Make a tiny source change through HWPOD.", timeoutMs: 234000, pollIntervalMs: 10 },
runtime: { apiUrl: "http://api.test", webUrl: "http://web.test" }
}, null, 2), "utf8");
await writeFile(path.join(caseDir, "hwpod-spec.yaml"), hwpodSpecText(), "utf8");
@@ -304,6 +305,8 @@ test("case run orchestrates agent prompt, diff capture, and compile evidence wit
assert.equal(runState.agent.sessionId, "ses_case_run");
assert.equal(runState.agent.conversationId, "cnv_case_d601-f103-v2-compile_run-agent-flow");
assert.equal(runState.agent.threadId, "thread-case");
assert.equal(runState.agent.timeoutMs, 234000);
assert.equal(runState.agent.pollIntervalMs, 250);
assert.match(runState.agent.traceId, /^trc_case_/u);
assert.match(runState.agent.nextPollCommand, /client agent result trc_case_/u);
assert.equal(runState._control.stage, "agent-running");
@@ -324,11 +327,14 @@ test("case run orchestrates agent prompt, diff capture, and compile evidence wit
assert.equal(result.payload.evidence.ok, undefined);
assert.equal(result.payload.agent.stageStatus, "completed");
assert.equal(result.payload.agent.traceId.startsWith("trc_case_"), true);
assert.equal(result.payload.agent.timeoutMs, 234000);
assert.ok(result.payload.agentTrace.hwpodBuildCommandCount >= 1);
assert.ok(result.payload.evidence.agentTrace.commandCount > 0);
assert.ok(result.payload.evidence.agentTrace.commandCount <= 30);
assert.ok(result.payload.evidence.agentTrace.hwpodCommandCount >= 3);
assert.equal(result.payload.evidence.agentTrace.keilJobCandidates.includes("20260605_203835_798515c0"), true);
assert.equal(result.payload.evidence.agentTask.timeoutMs, 234000);
assert.equal(result.payload.agent.polls <= 3, true);
assert.equal(result.payload.evidence.agentTrace.commands.some((item: any) => /^hwpod-ctl spec validate --spec \.hwlab\/hwpod-spec\.yaml/u.test(item.normalizedCommand ?? "")), true);
assert.equal(result.payload.evidence.agentTrace.commands.some((item: any) => /^hwpod inspect --spec \.hwlab\/hwpod-spec\.yaml/u.test(item.normalizedCommand ?? "")), true);
assert.equal(result.payload.evidence.agentTrace.commands.some((item: any) => /^hwpod build --spec \.hwlab\/hwpod-spec\.yaml/u.test(item.normalizedCommand ?? "")), true);
@@ -370,6 +376,7 @@ test("case run orchestrates agent prompt, diff capture, and compile evidence wit
assert.equal(manifest.trace.conversationId, "cnv_case_d601-f103-v2-compile_run-agent-flow");
assert.equal(manifest.trace.agentRun.runId, "run_agent_trace");
assert.equal(manifest.prompt.sha256, result.payload.evidence.agent.promptSha256);
assert.equal(manifest.subject.commitId, SUBJECT_COMMIT_ID);
assert.equal(manifest.diff.sha256, result.payload.evidence.agentDiff.diffPatchSha256);
assert.equal(manifest.readableAgent.renderer, "tools/src/hwlab-cli/trace-renderer:traceDisplayRows");
assert.equal(manifest.readableAgent.messagesPath, "agent-messages.json");