Skip to content

Commit 9c4659e

Browse files
committed
Teach verification order in instructions, gate message, and docs
1 parent 9e5584b commit 9c4659e

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎docs/TASK-PASSPORT.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,18 @@ historical so they are not mistaken for active instructions.
200200

201201
The normal human-facing sequence is: start the task, keep status/scope/next actions current, record verification with evidence, print a handoff when another agent or chat may continue, then finalize only after verification is final.
202202

203+
The verification order matters: iterate checks while verification is `pending`
204+
and fix freely; when no edits remain, commit the in-scope changes and confirm
205+
the commit changed nothing (clean tree, hooks silent) before recording the
206+
final verdict. From there the task has two endings. With no external wait, end
207+
with one `task finalize --status passed` call carrying evidence and the commit
208+
hash, so no `verifying` window opens. With an external wait (review, PR merge,
209+
re-score), record `passed`, then `task park`; after the external result,
210+
finalize — or return verification to `pending` if changes are needed. A
211+
recorded final verdict moves the task to `verifying` and freezes code changes;
212+
to commit already-verified changes from there, set verification back to
213+
`pending`, commit, then re-record the verdict.
214+
203215
Temporary work switching uses `task park`, not `task finalize`. Parking keeps a
204216
passport open and switchable while unrelated work becomes current. Finalization
205217
means the task is complete, failed, or explicitly accepted as-is.

‎src/core/gate.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function collectGateFiles(root: string, options: GateOptions): { files: string[]
192192

193193
function taskNotActiveMessage(status: TaskStatus): string {
194194
if (status === "verifying") {
195-
return "Current task is verifying. Finish or record verification before editing code, or park it for unrelated work.";
195+
return "Current task is verifying: a final verdict is recorded and code changes are frozen. Finalize the task; to commit already-verified changes, set verification to pending, commit, then re-record the verdict. Park the task for unrelated work.";
196196
}
197197
if (status === "parked") {
198198
return "Current task is parked. Switch to it, or start the task this work belongs to.";

‎src/integrations/install.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ Task lifecycle gate:
8585
- treat review mode as a scope check, not an automatic new Task Passport: keep reviews that verify the current active/verifying task inside that task as evidence/checkpoint; park, switch, or start a separate review task only for unrelated reviews
8686
- park deferred work with \`task_park\`/\`task park\`, or switch/close only when appropriate, before starting unrelated work
8787
- do not finalize a task just to free the current slot; finalization means verification is passed, failed, or explicitly accepted as complete
88-
- finalize after the task's changes are committed; park a verified task that is still waiting for review or commit instead of closing it
88+
- verification order: iterate checks with verification pending and fix freely; when no edits remain, commit the in-scope changes and confirm the commit changed nothing (clean tree, hooks silent) before recording the final verdict
89+
- no external wait: end with one \`task_finalize\` call carrying the final status, evidence, and commit hash, so no verifying window opens
90+
- external wait (review, PR merge, re-score): record \`passed\` via \`task_update_verification\`, then \`task_park\`; after the external result finalize, or return verification to pending if changes are needed
91+
- a recorded final verdict moves the task to verifying and freezes code changes; to commit already-verified changes from there, set verification back to pending, commit, then re-record the verdict
8992
- keep next actions current: clear or replace a stale plan (\`task update --clear-next-actions\`) before finalizing, so closed passports read as history, not as open work
9093
- if a task still has next actions and must pause for unrelated work, park it instead of using \`task_finalize\`/\`task finalize --status accepted\`; force accepted finalization only when the remaining next actions are intentionally historical
9194
- do not mutate a review task into implementation work

‎tests/agentpack.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,9 @@ test("previews and writes project-local MCP client install files", () => {
24542454
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /checkpoint mode: summarize what was decided/);
24552455
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /Task lifecycle gate/);
24562456
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /declare a write scope when starting a task/);
2457-
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /finalize after the task's changes are committed/);
2457+
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /commit the in-scope changes and confirm the commit changed nothing/);
2458+
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /one `task_finalize` call carrying the final status, evidence, and commit hash/);
2459+
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /record `passed` via `task_update_verification`, then `task_park`/);
24582460
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /keep next actions current: clear or replace a stale plan/);
24592461
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /verifying, blocked, closed/);
24602462
assert.match(readFileSync(path.join(dir, "AGENTS.md"), "utf8"), /keep reviews that verify the current active\/verifying task inside that task/);
@@ -2696,7 +2698,7 @@ test("pending verification returns lifecycle to active instead of getting stuck
26962698
assert.equal(passedPassport.status, "verifying", "a final verdict moves the lifecycle to verifying");
26972699
const warnOutput = run(dir, ["task", "gate", "--file", "src/a.ts"]);
26982700
assert.match(warnOutput, /Gate: warn \(mode: warn\)/, "the gate warns while a final verdict is under review");
2699-
assert.match(warnOutput, /Current task is verifying\. Finish or record verification before editing code, or park it for unrelated work\./);
2701+
assert.match(warnOutput, /Current task is verifying: a final verdict is recorded and code changes are frozen\. Finalize the task; to commit already-verified changes, set verification to pending, commit, then re-record the verdict\./);
27002702

27012703
assert.match(run(dir, ["task", "verify"]), /Updated verification for task .* \(pending\)/);
27022704
const pendingPassport = JSON.parse(run(dir, ["task", "passport"]));

0 commit comments

Comments
 (0)