Skip to content

Commit eb96c53

Browse files
committed
fix(pi-auto-dag): include final gate review counters
1 parent 939061b commit eb96c53

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

packages/pi-auto-dag/src/pr-lifecycle.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,17 @@ async function ensureFinalReviewer(
379379
issue,
380380
integration_head: state.integration_head,
381381
command: issue.testing,
382+
attempt: current.attempts,
383+
review_round: current.review_rounds,
382384
instruction,
383385
} : {
384386
type: promptMode === "resume" ? "auto_dag_resend" : "auto_dag_final_check_update",
385387
run_id: state.run_id,
386388
issue_id: issue.id,
387389
integration_head: state.integration_head,
388390
command: issue.testing,
391+
attempt: current.attempts,
392+
review_round: current.review_rounds,
389393
instruction,
390394
}, options);
391395
if (needsInstruction) {

packages/pi-auto-dag/test/pr-lifecycle.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,18 @@ test("a failed final gate requires a completed owner resolution and a fresh revi
223223
state = await lifecycle.resume(project.root, reviewEvent(state, "final-check", "approved", []));
224224
assert.equal(state.tasks["final-check"].status, "reviewing");
225225
assert.equal(await git(project.root, "show", "HEAD:repair.txt"), "fixed");
226+
const finalReviewer = state.tasks["final-check"].reviewer_agent!;
227+
const prompts = () => herdr.calls
228+
.filter((call) => call.command === "herdr" && call.args[0] === "agent" && call.args[1] === "prompt" && call.args[2] === finalReviewer)
229+
.map((call) => JSON.parse(call.args[3]));
230+
const fullPrompt = prompts().find((value) => value.type === "auto_dag_final_check");
231+
assert.equal(fullPrompt.attempt, state.tasks["final-check"].attempts);
232+
assert.equal(fullPrompt.review_round, state.tasks["final-check"].review_rounds);
233+
state = await lifecycle.resume(project.root);
234+
const compactPrompt = prompts().at(-1);
235+
assert.equal(compactPrompt.type, "auto_dag_resend");
236+
assert.equal(compactPrompt.attempt, state.tasks["final-check"].attempts);
237+
assert.equal(compactPrompt.review_round, state.tasks["final-check"].review_rounds);
226238

227239
state = await lifecycle.resume(project.root, reviewEvent(state, "final-check", "approved", []));
228240
assert.equal(state.phase, "completed");

0 commit comments

Comments
 (0)