fix: clarify caserun hwpod job polling

This commit is contained in:
Codex Agent
2026-06-06 23:50:53 +08:00
parent 6fdcac6ccf
commit 53aafde5bd
4 changed files with 8 additions and 5 deletions
+2 -1
View File
@@ -465,7 +465,8 @@ test("case run orchestrates agent prompt, diff capture, and compile evidence wit
assert.match(prompt, /hwpod-ctl spec validate --spec \.hwlab\/hwpod-spec\.yaml/u);
assert.match(prompt, /standard hwpod\/hwpod-ctl commands/u);
assert.match(prompt, /hwpod job status <jobId> --spec \.hwlab\/hwpod-spec\.yaml/u);
assert.match(prompt, / shell timeout\/head\/pipe /u);
assert.match(prompt, / shell sleep\/&&\/timeout\/watch\/head\/pipe/u);
assert.match(prompt, /separate short `hwpod job status <jobId> --spec \.hwlab\/hwpod-spec\.yaml` commands/u);
const diff = await readFile(path.join(cwd, ".state", "hwlab-cli", "caserun", "run-agent-flow", "agent-diff.patch"), "utf8");
assert.match(diff, /printf\("hello"\)/u);
assert.equal(requests.some((item) => item.url === "http://web.test/v1/agent/sessions"), true);
+2 -2
View File
@@ -1043,7 +1043,7 @@ async function renderAgentTaskPrompt(run: PreparedCaseRun, agentTask: PreparedAg
"如果 .hwlab/hwpod-spec.yaml 缺失或内容明显不是本次 case,请报告 CaseRun workspace setup 错误,不要自行编造或迁移 spec。",
"若 case prompt 要求源码修改,必须只改 subjectWorktreePath;若 prompt 未要求源码修改,则保持 subject 源码不变。",
"不要运行 CaseRun 答案执行器;你本人必须通过 hwpod/hwpod-ctl 标准入口触发编译验证。",
"hwpod build/download 是长任务短连接入口;不要再用 shell timeout/head/pipe 包住它们。记录返回 JSON 里的 jobId/job_id,再用 hwpod job status <jobId> --spec .hwlab/hwpod-spec.yaml 做有限轮询。"
"hwpod build/download 是长任务短连接入口;不要再用 shell sleep/&&/timeout/watch/head/pipe 或 shell loop 包住它们。记录返回 JSON 里的 jobId/job_id,再用独立的 hwpod job status <jobId> --spec .hwlab/hwpod-spec.yaml 短命令做有限轮询。"
].filter(Boolean);
return [
`# HWPOD CaseRun Code Agent Task`,
@@ -1070,7 +1070,7 @@ async function renderAgentTaskPrompt(run: PreparedCaseRun, agentTask: PreparedAg
`- Run \`hwpod-ctl spec validate --spec .hwlab/hwpod-spec.yaml\`.`,
`- Run \`hwpod inspect --spec .hwlab/hwpod-spec.yaml\`.`,
`- Follow the case task using standard hwpod/hwpod-ctl commands. Run build/download/UART steps only when the case explicitly asks for them, and report returned JSON/job/artifact/serial summaries.`,
`- For hwpod build/download, keep the HWPOD command unwrapped so it can return async JSON; then poll the returned job id with \`hwpod job status <jobId> --spec .hwlab/hwpod-spec.yaml\` a bounded number of times.`,
`- For hwpod build/download, keep the HWPOD command unwrapped so it can return async JSON; then poll the returned job id with separate short \`hwpod job status <jobId> --spec .hwlab/hwpod-spec.yaml\` commands a bounded number of times. Do not wrap status polling with shell sleep, &&, timeout, watch, head, pipes, or shell loops.`,
`- CaseRun will inspect git diff under subjectWorktreePath after your turn completes and may run a runner post-check compile as separate evidence.`,
`- CaseRun records trace/session/conversation, agent commandExecution, workspace diff and Keil build evidence without auto-grading them.`
].join("\n");