@kylecheng3146/agent-ops 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/packages/cli/src/bin.js +2 -1
- package/dist/packages/cli/src/commands/review.js +15 -1
- package/dist/packages/cli/src/commands/task.js +8 -2
- package/dist/packages/cli/src/criteria-review.js +8 -3
- package/dist/packages/cli/src/run-entry.js +1 -1
- package/dist/runtime/src/install/harness.js +1 -1
- package/dist/runtime/src/review/attestation.js +35 -13
- package/dist/runtime/src/review/criteria.js +22 -5
- package/dist/runtime/src/review/report.js +8 -4
- package/dist/runtime/src/review/runner.js +10 -2
- package/docs/en/spec/review.md +37 -3
- package/docs/zh-TW/spec/review.md +24 -4
- package/package.json +1 -1
- package/schemas/review-report.schema.json +2 -1
package/README.md
CHANGED
|
@@ -17,7 +17,9 @@ command behavior may change before 1.0.
|
|
|
17
17
|
Every new task, including DEBUG and native run parent/child tasks, waits for one
|
|
18
18
|
independent advisory review of its goal, criteria and assigned surface before
|
|
19
19
|
implementation. Read the suggestions, decide which to adopt, and record reasons
|
|
20
|
-
through `task revise`.
|
|
20
|
+
through `task revise`. The first revision that changes criteria, intent or
|
|
21
|
+
goal reruns the advisory once; surface-only revisions do not, and later
|
|
22
|
+
reruns are explicit (`review --criteria --rerun`).
|
|
21
23
|
|
|
22
24
|
The advisory has no time/token budget; explicit cancellation stops work. Genuine
|
|
23
25
|
execution errors report NOT_RUN and allow work. Detailed reports remain private;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { reviewCreatedCriteria, criteriaReviewStatus } from "./criteria-review.js";
|
|
2
|
+
import { reviewCreatedCriteria, reviewRevisedCriteria, criteriaReviewStatus } from "./criteria-review.js";
|
|
3
3
|
import { renderCriteriaReview } from "../../../runtime/src/review/criteria.js";
|
|
4
4
|
import { advancePhaseObserver, productionRunContext } from "./run-deps.js";
|
|
5
5
|
import { AgentOpsError } from "../../../runtime/src/fs/paths.js";
|
|
@@ -520,6 +520,7 @@ else {
|
|
|
520
520
|
service: taskService,
|
|
521
521
|
onTaskCreated: async (record, createdRoot) => await reviewCreatedCriteria(createdRoot ?? root, record.task),
|
|
522
522
|
criteriaStatus: async (record) => await criteriaReviewStatus(root, record.task),
|
|
523
|
+
onTaskRevised: async (record) => await reviewRevisedCriteria(root, record.task),
|
|
523
524
|
...(policyConfigHash === undefined ? {} : { policyConfigHash }),
|
|
524
525
|
...(sessionId === undefined ? {} : { sessionId }),
|
|
525
526
|
...(fromMain
|
|
@@ -2,7 +2,7 @@ import { buildReviewPacket } from "../../../../runtime/src/review/packet.js";
|
|
|
2
2
|
import { runIndependentReview } from "../../../../runtime/src/review/runner.js";
|
|
3
3
|
import { renderReviewResult } from "../../../../runtime/src/review/render.js";
|
|
4
4
|
import { reviewReportResults } from "../../../../runtime/src/review/report.js";
|
|
5
|
-
import { findPriorFailingFindings, findReviewAttestation, invalidateReviewAttestation, readReviewReportArtifact, reviewReportDigest, saveReviewAttestation, saveReviewReportArtifact } from "../../../../runtime/src/review/attestation.js";
|
|
5
|
+
import { countFailedReviewRounds, findPriorFailingFindings, REVIEW_ROUND_CAP, findReviewAttestation, invalidateReviewAttestation, readReviewReportArtifact, reviewReportDigest, saveReviewAttestation, saveReviewReportArtifact } from "../../../../runtime/src/review/attestation.js";
|
|
6
6
|
import { detectHostTarget, planReviewTargets, resolveReviewRole } from "../../../../runtime/src/review/roles.js";
|
|
7
7
|
import { evidenceMatchesContract, taskContractHash, treeContractHash, goalHash } from "../../../../runtime/src/task/contract.js";
|
|
8
8
|
import { acceptanceCoverage, coverageDigest } from "../../../../runtime/src/verify/acceptance-coverage.js";
|
|
@@ -649,6 +649,20 @@ export async function runReviewCommand(options) {
|
|
|
649
649
|
? await treeContext(options)
|
|
650
650
|
: await taskContext(options);
|
|
651
651
|
options = { ...options, noChangePaths: options.noChangePaths ?? context?.records.find(r => r.task.id === context.taskId)?.noChangePaths };
|
|
652
|
+
// Before any scope, surface or reviewer cost: a contract that keeps failing
|
|
653
|
+
// needs a new approach, not another round of one-by-one fixes.
|
|
654
|
+
if (context !== undefined && options.root !== undefined) {
|
|
655
|
+
const own = context.records.find(r => r.task.id === context.taskId).task;
|
|
656
|
+
if (await countFailedReviewRounds(options.root, context.taskId, taskContractHash(own)) >= REVIEW_ROUND_CAP) {
|
|
657
|
+
const result = { ...resultBase, status: "NOT_RUN", reason: "round-cap", taskId: context.taskId };
|
|
658
|
+
const message = "Independent review was not run.";
|
|
659
|
+
return { code: "REVIEW_NOT_RUN", status: "error", errors: [{ code: "REVIEW_NOT_RUN", message }], data: { message, result,
|
|
660
|
+
text: renderReviewResult(result) +
|
|
661
|
+
`Review failed ${REVIEW_ROUND_CAP} times under this contract. Stop fixing findings one by one: reconsider ` +
|
|
662
|
+
"the approach, then record the new plan (criteria or intent) with a reason, or ask the user how to proceed:\n" +
|
|
663
|
+
` agent-ops task revise --task ${context.taskId} --expected-contract ${taskContractHash(own)} --reason "<what changed in the approach>"\n` } };
|
|
664
|
+
}
|
|
665
|
+
}
|
|
652
666
|
const evidenceRequirements = (options.args.evidence ?? []).map((value) => {
|
|
653
667
|
const separator = value.indexOf("=");
|
|
654
668
|
return {
|
|
@@ -6,7 +6,12 @@ import { renderTaskMarkdown, safeTaskText } from "../../../../runtime/src/task/r
|
|
|
6
6
|
import { errorEnvelope, okEnvelope } from "../output.js";
|
|
7
7
|
async function withCriteriaStatus(envelope, options) {
|
|
8
8
|
const item = envelope.data?.record;
|
|
9
|
-
|
|
9
|
+
// A status read is best effort; a cancelled advisory round must still stop the caller.
|
|
10
|
+
const advice = item === undefined ? null : await options.criteriaStatus?.(item).catch((error) => {
|
|
11
|
+
if (error instanceof AgentOpsError && error.code === "CRITERIA_REVIEW_CANCELLED")
|
|
12
|
+
throw error;
|
|
13
|
+
return null;
|
|
14
|
+
});
|
|
10
15
|
return advice == null || envelope.data === null ? envelope : { ...envelope, data: { ...envelope.data, criteriaReview: advice,
|
|
11
16
|
text: envelope.data.text + "\n\n" + renderCriteriaReview(advice) } };
|
|
12
17
|
}
|
|
@@ -202,7 +207,8 @@ export async function runTaskCommand(options) {
|
|
|
202
207
|
...(origin === undefined ? {} : { origin }),
|
|
203
208
|
reason: options.args.reason, ...(options.args.baseline === undefined ? {} : { baseline: options.args.baseline })
|
|
204
209
|
});
|
|
205
|
-
|
|
210
|
+
// The revision is saved first: an advisory NOT_RUN keeps TASK_REVISED, and a cancelled round throws with it kept.
|
|
211
|
+
return await withCriteriaStatus(await withEscape(taskEnvelope(action, "TASK_REVISED", "Contract revised; obtain a fresh review, and new verification if the criteria or configuration changed.", record), origin === undefined ? undefined : await options.service.declareEscape(record.task.id), options.service), options.onTaskRevised === undefined ? options : { ...options, criteriaStatus: options.onTaskRevised });
|
|
206
212
|
}
|
|
207
213
|
if (action === "replan") {
|
|
208
214
|
const payload = await jsonFile(options.args.planFile);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { AgentOpsError } from "../../../runtime/src/fs/paths.js";
|
|
4
|
-
import { runCriteriaReview, readCriteriaReview, renderCriteriaReview } from "../../../runtime/src/review/criteria.js";
|
|
4
|
+
import { runCriteriaReview, readCriteriaReview, renderCriteriaReview, revisionReviewDue } from "../../../runtime/src/review/criteria.js";
|
|
5
5
|
import { registeredRunProofRunner } from "../../../runtime/src/verify/spawn.js";
|
|
6
6
|
import { appendLocalLog } from "../../../runtime/src/logging/local-log.js";
|
|
7
7
|
import { localStatePaths } from "../../../runtime/src/security/permissions.js";
|
|
@@ -24,7 +24,7 @@ export async function criteriaReviewStatus(root, task) {
|
|
|
24
24
|
return await readCriteriaReview(root, task, await parentScope(root, task).catch(() => undefined));
|
|
25
25
|
}
|
|
26
26
|
/** Only production creation/explicit review installs this hook; TaskService stays model-free. */
|
|
27
|
-
export async function reviewCreatedCriteria(root, task, rerun = false) {
|
|
27
|
+
export async function reviewCreatedCriteria(root, task, rerun = false, trigger) {
|
|
28
28
|
const controller = new AbortController();
|
|
29
29
|
const interrupt = (signal) => { controller.abort(signal); };
|
|
30
30
|
const int = () => interrupt("SIGINT"), term = () => interrupt("SIGTERM");
|
|
@@ -38,7 +38,7 @@ export async function reviewCreatedCriteria(root, task, rerun = false) {
|
|
|
38
38
|
const parent = await parentScope(root, task).catch(() => undefined);
|
|
39
39
|
process.stderr.write(`Criteria advisory for ${task.id}: waiting for one independent reviewer (no time budget; Ctrl-C cancels).\n`);
|
|
40
40
|
let result = await runCriteriaReview({ root, task, parent, target, model: role?.model, effort: role?.effort,
|
|
41
|
-
rerun, signal: controller.signal, runner: registeredRunProofRunner(),
|
|
41
|
+
rerun, ...(trigger === undefined ? {} : { trigger }), signal: controller.signal, runner: registeredRunProofRunner(),
|
|
42
42
|
unavailableCode: config === undefined ? "CRITERIA_REVIEW_CONFIG_UNAVAILABLE" : target === undefined && role !== undefined ? "CRITERIA_REVIEW_NO_INDEPENDENT_TARGET" : "CRITERIA_REVIEW_UNCONFIGURED",
|
|
43
43
|
log: async (report, path) => {
|
|
44
44
|
const state = localStatePaths(process.env.AGENT_OPS_HOME ?? homedir());
|
|
@@ -61,3 +61,8 @@ export async function reviewCreatedCriteria(root, task, rerun = false) {
|
|
|
61
61
|
process.removeListener("SIGTERM", term);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
/** A revise that changed what the advice judged reruns it once; otherwise it reports the current advisory. */
|
|
65
|
+
export async function reviewRevisedCriteria(root, task) {
|
|
66
|
+
const view = await criteriaReviewStatus(root, task);
|
|
67
|
+
return revisionReviewDue(view) ? await reviewCreatedCriteria(root, task, true, "revise") : view;
|
|
68
|
+
}
|
|
@@ -113,7 +113,7 @@ export function coordinatorWakeNote(state, coordinator) {
|
|
|
113
113
|
export function workerInstructionLines() {
|
|
114
114
|
return ["Keep the original goal fixed. Read this repository's AGENTS.md and use its existing verifier authority.",
|
|
115
115
|
"Plan 2–5 substantive acceptance criteria. Submit a plan request before changing product files; the supervisor creates the task with the fixed goal.",
|
|
116
|
-
"Read the criteria advisory before implementation. Decide which suggestions to adopt and use task revise with reasons (including rejected advice).
|
|
116
|
+
"Read the criteria advisory before implementation. Decide which suggestions to adopt and use task revise with reasons (including rejected advice). The first revision that changes criteria, intent or goal reruns criteria review once and waits for it; later ones do not. Formal final proof remains required.",
|
|
117
117
|
"For every mechanically testable requirement use a configured acceptance runner; explicit review-only fallback requires a recorded reason and fresh goal review.",
|
|
118
118
|
"Implement, run targeted fast checks on changed code, commit and submit action=handoff so the supervisor runs full verification outside your context window. Do not poll full-suite verification in a loop. Repair failed checks and pin mechanically testable review findings into regression criteria. Never disable a mandatory policy verifier.",
|
|
119
119
|
"Only registered run workers may write. Use isolated worktrees and supervisor-issued leases; do not launch an unregistered writing subagent.",
|
|
@@ -367,7 +367,7 @@ export function managedRules(descriptor, context) {
|
|
|
367
367
|
if (context.capabilities.includes("task"))
|
|
368
368
|
lines.push("To fix a bug, run `agent-ops task create --debug --goal <verbatim issue>` with a", "behavioral criterion whose `redCheckIds` fail at the baseline and pass on the", "candidate, then verify, review and finish as for any task. If you know where the", "bug came from, record it with `task revise --escape-of <commit> --escape-label", "<label>`; the origin is advisory and never blocks finish.", "");
|
|
369
369
|
if (context.capabilities.includes("rules")) {
|
|
370
|
-
lines.push(" Every production task creation waits for one independent criteria advisory", " before implementation (also DEBUG and native run parents/children). It has", " no time/token budget; real launch/auth/output errors report NOT_RUN and", " allow work, while explicit cancellation means stop. Read the private report,", " decide which advice to adopt, and use task revise with reasons (including", " rejections).
|
|
370
|
+
lines.push(" Every production task creation waits for one independent criteria advisory", " before implementation (also DEBUG and native run parents/children). It has", " no time/token budget; real launch/auth/output errors report NOT_RUN and", " allow work, while explicit cancellation means stop. Read the private report,", " decide which advice to adopt, and use task revise with reasons (including", " rejections). The first revise that changes criteria, intent or goal", " reruns it once and waits; surface-only revises do not. Later reruns are", " explicit only: `agent-ops review --criteria --task <id> --rerun --yes`.", " Start task creation/revise/criteria review through the trusted outer host when", " the host sandbox blocks reviewer auth/network, using the same outer-host", " invocation described below for review. Never bypass a native denial.", " This advisory never replaces verify, final two-round review or finish.", "", "For every change:", "", "1. Audit the change's surfaces first (EVIDENCE-SURFACE-001): dependents,", " duplicates, other paths to the same concept, and shared state/data", " contracts, each with recorded fixed-string queries or n/a: reason; pass", " them with `task create --surface-file <json>`. An exclusion says why", " the surface is unaffected; \"out of scope\" is not a reason. A derived", " discovery query whose hits are all incidental may be dismissed once with", " a reason in `dismissed` instead of excluding each file. Then define", " two to five mechanically verifiable acceptance criteria.", "2. Inspect the smallest relevant scope within the audited surfaces and", " preserve unrelated changes.", "3. Apply the smallest safe change.", "4. Run evidence-producing verification for every criterion.", "5. Obtain complete independent review before claiming completion, via", " `agent-ops review --task <task-id> --yes` (or the CLI's equivalent invocation).", " Never call a", " review-target CLI (agy, codex, claude) directly — direct calls skip", " the enforced read-only sandbox flags and can hang or fail on command", " permission prompts.", " Start this command through the trusted outer host runner as its first", " and only invocation. On Codex, the outer tool request must use", " `sandbox_permissions: \"require_escalated\"` so network and loopback", " are available; in that same request, unset", " `CODEX_SANDBOX_NETWORK_DISABLED` and set `AGENT_OPS_HOST` when three", " targets are configured. The Codex shell form is", " `env -u CODEX_SANDBOX_NETWORK_DISABLED AGENT_OPS_HOST=<current-host> agent-ops review --task <task-id> --yes`.", " Keep it a plain command line: to keep the output add `--output <file>`", " (the JSON envelope is written there and one line is printed) instead of", " a shell redirect, which the host can only allow by matching the whole", " command string, task id included.", " Do not run it once in the restricted sandbox and retry; changing the", " variable inside that sandbox is not elevation.", " Review runs exactly two fresh sessions: with three configured targets,", " set `AGENT_OPS_HOST` to the current CLI id so it is excluded; with two", " targets both run in configured order; with one target it runs twice.", " The first session is necessary; a PASS then requires an adversarial", " re-check carrying the first report. A first FAIL or NOT_RUN stops.", "", "Treat `.agent-ops/config.json` as verifier authority. Discovery output is", "only a proposal until a user confirms it. Repository commands require an", "exact matching trust record. Confirmed project init/update grants it", "automatically when verification commands are configured.", "");
|
|
371
371
|
}
|
|
372
372
|
if (context.capabilities.includes("task")) {
|
|
373
373
|
lines.push("Split a change that exceeds five acceptance criteria into subtasks:", "`agent-ops task create --parent <task-id>` records one, and", "`agent-ops task status --parent <task-id>` lists them. Each subtask", "carries its own criteria and verification; final review covers all", "tasks together when their worktrees are integrated;", "completing one never completes its parent.", "", ...autoRunInstruction(descriptor, context), "To review every active subtask of a parent together, run", "`agent-ops batch --parent <task-id> --yes` instead of one review per", "subtask. It needs what review needs: start it through the trusted outer", "host runner as its first and only invocation, with the same Codex", "elevation, and keep `--output <file>` instead of a shell redirect. It", "verifies, one task at a time, each task that lacks fresh evidence, and", "reviews a few tasks at once. Do not commit or edit the worktree while it", "runs: a moved HEAD voids every verify and review in the batch.", "For subagents in separate worktrees, use `task advance` instead.", "", "Delegate a subtask whose scope spans unknown files, broad scans, or an", "independent workstream instead of doing it inline. Name the bounded", "scope, the artifact to return, and the acceptance criteria it serves.", subagentInstruction(descriptor), "Read every returned artifact back yourself: integration, verification,", "and review stay with the coordinator.", "", "One writer at a time. `agent-ops verify` and `agent-ops review`", "fingerprint the working tree and report UNKNOWN when anything else", "writes it during the run, so delegate edits to one subagent at a time,", "or give each writer its own Git worktree and merge before verifying.", "Read-only delegation has no such limit and may run in parallel.", "", "Parallel conversations in one repository each need their own worktree.", "When `.agent-ops/config.json` sets `worktree.mode` to `auto`, run", "`agent-ops task create` from the main checkout before your first edit:", "it creates this session's worktree and puts the task there (`agent-ops", "worktree add <name> --session <session-id>` does the same without a", "task). Work only inside the printed path", "(Claude Code: EnterWorktree with that path; otherwise use it as every", "command's working directory). Commit, then run verify and review for", "each task with the printed `--base`; do not run `task complete` in the", "worktree. Leave it (Claude Code: ExitWorktree with action keep) and run", "`agent-ops worktree finish <name>` from the main checkout: it completes", "every task in the worktree, subtasks first, then merges. A finish that", "reports an incomplete task names it; verify or review that task again", "in the worktree and finish again. A finish that reports a conflict is", "resolved once, as a new task whose criteria cover both intents; if its", "verification or review fails, reset as instructed and report.", "", "For a session with writing subagents, record each child task's complete", "modification intent with `task create --intent <text>` before editing.", "Each child commits and runs local `verify --task` in its own worktree.", "From the main checkout run `agent-ops task advance --task <parent-id>", "--session <session-id> --yes` through the trusted outer host runner,", "unsetting `CODEX_SANDBOX_NETWORK_DISABLED` on Codex. Advance integrates", "child commits and intent into the coordinator worktree, verifies every", "task on the final candidate, then runs one two-round tree review.", "Only `NOT_RUN / scope-too-large` falls back to per-task two-round review;", "a substantive FAIL must be fixed. After PASS, advance writes a local", "receipt under the main checkout's Git common directory and calls finish.", "If the target moves, it retries the final gate once. An unresolved", "failure preserves worktrees and cannot be reported as finished.", "");
|
|
@@ -444,13 +444,11 @@ function blockingFindings(artifact) {
|
|
|
444
444
|
return findings;
|
|
445
445
|
}
|
|
446
446
|
/**
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* record is ignored: these are a hint for the next reviewer, and without them
|
|
451
|
-
* the review simply runs as it always has.
|
|
447
|
+
* This task's decided reviews: PASS, or FAIL with a report. NOT_RUN artifacts
|
|
448
|
+
* decide nothing and are skipped, as is any unreadable record: callers use
|
|
449
|
+
* these as hints, and without them review simply runs as it always has.
|
|
452
450
|
*/
|
|
453
|
-
|
|
451
|
+
async function decidedTaskReviews(root, taskId) {
|
|
454
452
|
const directory = join(root, ...REVIEW_ATTESTATION_DIRECTORY.split("/"));
|
|
455
453
|
let names;
|
|
456
454
|
try {
|
|
@@ -460,7 +458,7 @@ export async function findPriorFailingFindings(root, taskId) {
|
|
|
460
458
|
return [];
|
|
461
459
|
}
|
|
462
460
|
// ponytail: linear scan of every report; index by task if the directory grows large.
|
|
463
|
-
|
|
461
|
+
const decided = [];
|
|
464
462
|
for (const name of names) {
|
|
465
463
|
// `<fingerprint>` or `<fingerprint>.<task id>`, then the suffix.
|
|
466
464
|
const key = name.slice(0, -REVIEW_REPORT_ARTIFACT_SUFFIX.length);
|
|
@@ -475,23 +473,47 @@ export async function findPriorFailingFindings(root, taskId) {
|
|
|
475
473
|
continue;
|
|
476
474
|
}
|
|
477
475
|
const value = JSON.parse(source);
|
|
478
|
-
const decided = value.status === "PASS" ||
|
|
479
|
-
(value.status === "FAIL" && value.report !== undefined);
|
|
480
476
|
if (![1, 2].includes(value?.schemaVersion) ||
|
|
481
477
|
value.sourceFingerprint !== fingerprint ||
|
|
482
478
|
value.taskId !== taskId ||
|
|
483
|
-
!
|
|
479
|
+
!(value.status === "PASS" || (value.status === "FAIL" && value.report !== undefined)) ||
|
|
484
480
|
!Number.isFinite(Date.parse(value.createdAt))) {
|
|
485
481
|
continue;
|
|
486
482
|
}
|
|
487
|
-
|
|
488
|
-
latest = value;
|
|
489
|
-
}
|
|
483
|
+
decided.push(value);
|
|
490
484
|
}
|
|
491
485
|
catch {
|
|
492
486
|
continue;
|
|
493
487
|
}
|
|
494
488
|
}
|
|
489
|
+
return decided;
|
|
490
|
+
}
|
|
491
|
+
/** After this many failed reviews of one contract, review stops and asks for a rethink. */
|
|
492
|
+
export const REVIEW_ROUND_CAP = 3;
|
|
493
|
+
/**
|
|
494
|
+
* Failed reviews of this task under its current contract since its latest
|
|
495
|
+
* PASS. Each source fingerprint keeps one report, so re-reviewing unchanged
|
|
496
|
+
* code does not add a round; a contract revision starts the count again.
|
|
497
|
+
*/
|
|
498
|
+
export async function countFailedReviewRounds(root, taskId, contractHash) {
|
|
499
|
+
const reviews = await decidedTaskReviews(root, taskId);
|
|
500
|
+
const lastPass = Math.max(-Infinity, ...reviews.filter(review => review.status === "PASS")
|
|
501
|
+
.map(review => Date.parse(review.createdAt)));
|
|
502
|
+
return reviews.filter(review => review.status === "FAIL" && review.taskContractHash === contractHash &&
|
|
503
|
+
Date.parse(review.createdAt) > lastPass).length;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Blocking findings of this task's most recent decided review, when that
|
|
507
|
+
* review failed. A newer PASS settles the earlier findings, so none are
|
|
508
|
+
* returned.
|
|
509
|
+
*/
|
|
510
|
+
export async function findPriorFailingFindings(root, taskId) {
|
|
511
|
+
let latest;
|
|
512
|
+
for (const value of await decidedTaskReviews(root, taskId)) {
|
|
513
|
+
if (latest === undefined || Date.parse(value.createdAt) > Date.parse(latest.createdAt)) {
|
|
514
|
+
latest = value;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
495
517
|
if (latest?.status !== "FAIL") {
|
|
496
518
|
return [];
|
|
497
519
|
}
|
|
@@ -74,13 +74,14 @@ async function readReport(path, root) {
|
|
|
74
74
|
if (Buffer.byteLength(source) > 512 * 1024)
|
|
75
75
|
throw new Error("Advisory artifact exceeds limit.");
|
|
76
76
|
const value = JSON.parse(source);
|
|
77
|
-
if (!record(value) || Object.keys(value).some(key => !["kind", "taskId", "attemptId", "snapshotHash", "snapshot", "status", "code", "startedAt", "durationMs", "invocations", "ownerPid", "ownerIdentity", "target", "advice", "usage"].includes(key)) ||
|
|
77
|
+
if (!record(value) || Object.keys(value).some(key => !["kind", "taskId", "attemptId", "snapshotHash", "snapshot", "status", "code", "startedAt", "durationMs", "invocations", "ownerPid", "ownerIdentity", "target", "advice", "usage", "trigger"].includes(key)) ||
|
|
78
78
|
value.kind !== "criteria-advisory" || !validText(value.taskId) || typeof value.attemptId !== "string" || !/^[a-f0-9-]{36}$/u.test(value.attemptId) ||
|
|
79
79
|
!Number.isSafeInteger(value.ownerPid) || value.ownerPid < 1 ||
|
|
80
80
|
(value.ownerIdentity !== null && !validText(value.ownerIdentity)) ||
|
|
81
81
|
!validText(value.code) || !validText(value.startedAt) || !Number.isFinite(Date.parse(value.startedAt)) ||
|
|
82
82
|
!Number.isSafeInteger(value.durationMs) || value.durationMs < 0 || ![0, 1].includes(value.invocations) ||
|
|
83
83
|
(value.target !== undefined && !["agy", "claude", "codex"].includes(String(value.target))) ||
|
|
84
|
+
(value.trigger !== undefined && !["create", "rerun", "revise"].includes(String(value.trigger))) ||
|
|
84
85
|
(value.usage !== undefined && (!record(value.usage) || Object.entries(value.usage).some(([key, n]) => !["inputTokens", "outputTokens", "cacheReadTokens", "cacheWriteTokens", "totalTokens", "costUsd"].includes(key) || typeof n !== "number" || !Number.isFinite(n) || n < 0))) ||
|
|
85
86
|
typeof value.snapshotHash !== "string" || !/^[a-f0-9]{64}$/u.test(value.snapshotHash) || !record(value.snapshot) ||
|
|
86
87
|
!["RUNNING", "COMPLETED", "NOT_RUN", "CANCELLED"].includes(String(value.status)) ||
|
|
@@ -101,12 +102,28 @@ async function ownerAlive(report) {
|
|
|
101
102
|
return error.code !== "ESRCH";
|
|
102
103
|
}
|
|
103
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* The surface audit is reviewed but is not what the advice is about: classifying
|
|
107
|
+
* one more discovery hit must not make the criteria look unreviewed. The stored
|
|
108
|
+
* snapshot is redacted, so the current one is redacted the same way.
|
|
109
|
+
*/
|
|
110
|
+
function criteriaCore(snapshot) {
|
|
111
|
+
const { surface: _surface, ...core } = snapshot;
|
|
112
|
+
return canonicalJson(core);
|
|
113
|
+
}
|
|
114
|
+
function coreChanged(report, snapshot) {
|
|
115
|
+
return criteriaCore(report.snapshot) !== criteriaCore(redactData(snapshot));
|
|
116
|
+
}
|
|
117
|
+
/** One automatic round after a substantive revise; after it only an explicit --rerun makes another due. */
|
|
118
|
+
export function revisionReviewDue(view) {
|
|
119
|
+
return view !== null && view.stale && view.report.trigger !== "revise" && view.report.status !== "RUNNING";
|
|
120
|
+
}
|
|
104
121
|
export async function readCriteriaReview(root, task, parent) {
|
|
105
122
|
try {
|
|
106
123
|
const path = reportPath(root, task.id), report = await readReport(path, root);
|
|
107
124
|
if (report === null || report.taskId !== task.id)
|
|
108
125
|
return null;
|
|
109
|
-
return { report, reportPath: path, stale: report
|
|
126
|
+
return { report, reportPath: path, stale: coreChanged(report, criteriaSnapshot(task, parent)), warnings: [] };
|
|
110
127
|
}
|
|
111
128
|
catch {
|
|
112
129
|
return null;
|
|
@@ -119,7 +136,7 @@ export function renderCriteriaReview(view) {
|
|
|
119
136
|
"Private report: " + view.reportPath, (report.advice === undefined ? undefined : safeTaskText(report.advice.summary)) ?? "No completed advice is available.",
|
|
120
137
|
...(report.advice?.recommendations ?? []).map(r => `[${safeTaskText(r.criterionId)}] ${safeTaskText(r.issue)}\nSuggestion: ${safeTaskText(r.recommendation)}\nWhy: ${safeTaskText(r.reason)}`),
|
|
121
138
|
...(report.advice?.limitations ?? []).map(s => "Limitation: " + safeTaskText(s)), ...view.warnings,
|
|
122
|
-
"Advisory only. Decide which suggestions to adopt; use task revise and record reasons, including rejections.
|
|
139
|
+
"Advisory only. Decide which suggestions to adopt; use task revise and record reasons, including rejections. The first revise that changes criteria, intent or goal reruns this review once; later ones need an explicit --rerun. Final verification and two-round review are still required."
|
|
123
140
|
].join("\n");
|
|
124
141
|
}
|
|
125
142
|
function cancelled(signal) {
|
|
@@ -134,10 +151,10 @@ export async function runCriteriaReview(options) {
|
|
|
134
151
|
let report = { kind: "criteria-advisory", taskId: task.id, attemptId: randomUUID(), snapshotHash,
|
|
135
152
|
snapshot: redactData(snapshot), status: "RUNNING", code: "CRITERIA_REVIEW_RUNNING",
|
|
136
153
|
startedAt: new Date().toISOString(), durationMs: 0, invocations: 0, ownerPid: process.pid, ownerIdentity: await nativeProcessIdentity(process.pid),
|
|
137
|
-
...(options.target === undefined ? {} : { target: options.target }) };
|
|
154
|
+
...(options.target === undefined ? {} : { target: options.target }), trigger: options.trigger ?? (options.rerun ? "rerun" : "create") };
|
|
138
155
|
const newAttempt = report;
|
|
139
156
|
const warnings = [];
|
|
140
|
-
const view = () => ({ report, reportPath: path, stale: report
|
|
157
|
+
const view = () => ({ report, reportPath: path, stale: coreChanged(report, snapshot), warnings });
|
|
141
158
|
let claimed = false;
|
|
142
159
|
try {
|
|
143
160
|
for (;;) {
|
|
@@ -64,7 +64,8 @@ function location(value, path, errors) {
|
|
|
64
64
|
}
|
|
65
65
|
function finding(value, path, errors) {
|
|
66
66
|
if (!isRecord(value) || !exactFields(value, [
|
|
67
|
-
"severity", "blocking", "title", "details", "locations", "evidence", "recommendation", "criterionIds"
|
|
67
|
+
"severity", "blocking", "title", "details", "locations", "evidence", "recommendation", "criterionIds",
|
|
68
|
+
...("origin" in value ? ["origin"] : [])
|
|
68
69
|
], path, errors)) {
|
|
69
70
|
return undefined;
|
|
70
71
|
}
|
|
@@ -73,8 +74,10 @@ function finding(value, path, errors) {
|
|
|
73
74
|
!Array.isArray(value.locations) || value.locations.length > MAX_ARRAY ||
|
|
74
75
|
!textArray(value.evidence) || value.evidence.length === 0 || !isText(value.recommendation) ||
|
|
75
76
|
!textArray(value.criterionIds) || new Set(value.criterionIds).size !== value.criterionIds.length ||
|
|
76
|
-
(value.
|
|
77
|
-
(value.
|
|
77
|
+
(value.origin !== undefined && value.origin !== "introduced" && value.origin !== "pre-existing") ||
|
|
78
|
+
(value.origin === "pre-existing" ? value.blocking !== false :
|
|
79
|
+
(value.severity === "critical" && value.blocking !== true) ||
|
|
80
|
+
(value.severity === "minor" && value.blocking !== false))) {
|
|
78
81
|
invalid(errors, path, "INVALID_FINDING", "Finding is invalid.");
|
|
79
82
|
return undefined;
|
|
80
83
|
}
|
|
@@ -90,7 +93,8 @@ function finding(value, path, errors) {
|
|
|
90
93
|
locations: locations,
|
|
91
94
|
evidence: [...value.evidence],
|
|
92
95
|
recommendation: value.recommendation,
|
|
93
|
-
criterionIds: [...value.criterionIds]
|
|
96
|
+
criterionIds: [...value.criterionIds],
|
|
97
|
+
...(value.origin === undefined ? {} : { origin: value.origin })
|
|
94
98
|
};
|
|
95
99
|
}
|
|
96
100
|
export function validateReviewReport(value, requestedCriterionIds, changedFiles) {
|
|
@@ -22,6 +22,12 @@ const CONTRACT_INSTRUCTIONS = [
|
|
|
22
22
|
"every changed path is still required and is checked on your reply.",
|
|
23
23
|
"Report every blocking defect you find in this one reply, not only the " +
|
|
24
24
|
"first: each defect left for a later round costs another full review.",
|
|
25
|
+
"A defect is pre-existing when it is present identically at the base and " +
|
|
26
|
+
"this change did not introduce, expose, worsen or depend on it. Report " +
|
|
27
|
+
"only pre-existing defects you meet while reading for this review; do not " +
|
|
28
|
+
"search for them. Give each one origin 'pre-existing' and blocking false, " +
|
|
29
|
+
"whatever its severity: it goes to followup, not to this change. Every " +
|
|
30
|
+
"other finding has origin 'introduced'.",
|
|
25
31
|
"Every FAIL criterion must have at least one blocking finding whose " +
|
|
26
32
|
"criterionIds includes it. Blocking findings may reference only FAIL " +
|
|
27
33
|
"criteria.",
|
|
@@ -30,7 +36,8 @@ const CONTRACT_INSTRUCTIONS = [
|
|
|
30
36
|
"summary:string,evidence:string[]}],findings:[{severity:'critical'|" +
|
|
31
37
|
"'important'|'minor',blocking:boolean,title:string,details:string," +
|
|
32
38
|
"locations:[{path:string,line?:integer}],evidence:string[]," +
|
|
33
|
-
"recommendation:string,criterionIds:string[]
|
|
39
|
+
"recommendation:string,criterionIds:string[]," +
|
|
40
|
+
"origin?:'introduced'|'pre-existing'}],residualRisks:string[]," +
|
|
34
41
|
"changedFilesInspected:string[],supportingFilesInspected:string[]}. " +
|
|
35
42
|
"All descriptive strings and evidence arrays must be non-empty."
|
|
36
43
|
];
|
|
@@ -290,7 +297,8 @@ export function redactReviewReport(report) {
|
|
|
290
297
|
})),
|
|
291
298
|
evidence: finding.evidence.map((value) => safeTaskText(redactSecrets(value))),
|
|
292
299
|
recommendation: safeTaskText(redactSecrets(finding.recommendation)),
|
|
293
|
-
criterionIds: finding.criterionIds.map((value) => safeTaskText(redactSecrets(value)))
|
|
300
|
+
criterionIds: finding.criterionIds.map((value) => safeTaskText(redactSecrets(value))),
|
|
301
|
+
...(finding.origin === undefined ? {} : { origin: finding.origin })
|
|
294
302
|
})),
|
|
295
303
|
residualRisks: report.residualRisks.map((value) => safeTaskText(redactSecrets(value))),
|
|
296
304
|
changedFilesInspected: report.changedFilesInspected.map((value) => safeTaskText(redactSecrets(value))),
|
package/docs/en/spec/review.md
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
- Trigger: Production task criteria become ready before implementation.
|
|
6
6
|
- Action: Await one scoped advisory and let the writer record adoption/rejection reasons.
|
|
7
7
|
- Evidence: Private snapshot report plus safe local status/usage log; no completion attestation.
|
|
8
|
-
- Positive: `
|
|
9
|
-
- Negative: `
|
|
8
|
+
- Positive: `Adopting advice rewrites a criterion; that revise reruns the advisory once and shows the new advice.`
|
|
9
|
+
- Negative: `Re-review every revise, including surface-only ones, or treat advice as final PASS proof.`
|
|
10
10
|
|
|
11
11
|
Every production task creation (including DEBUG, replan children and native run root/child tasks) MUST wait for one independent criteria advisory before implementation. A fresh session uses one configured independent-review target, preferring a different target from the host. It receives only the original goal, assigned intent/covers, criteria and surface audit in an empty disposable workspace. It MUST NOT inspect repository files or run tests. Missing goals are insufficient information; child completeness is scoped to its assignment. Verification materials/import validity remain deferred until implementation; reasoned review-only acceptance is valid.
|
|
12
12
|
|
|
13
13
|
The advisory has no agent-ops execution deadline, stall cutoff or token budget. Provider limitations, genuine launch/auth/output errors and explicit cancellation remain effective. Errors produce NOT_RUN and permit work; cancellation preserves the task and MUST stop implementation. Native review processes remain registered and stoppable. Normal verification and final two-round review retain their existing deadlines and gates.
|
|
14
14
|
|
|
15
|
-
Task creation shows advice and a private report reference. The writer decides which recommendations to adopt and records acceptance/rejection reasons through task revise (a same-criteria revision may record rejected advice). Requirements that are ambiguous or expand scope require user clarification. Reports bind the original task/goal/criteria/surface snapshot
|
|
15
|
+
Task creation shows advice and a private report reference. The writer decides which recommendations to adopt and records acceptance/rejection reasons through task revise (a same-criteria revision may record rejected advice). Requirements that are ambiguous or expand scope require user clarification. Reports bind the original task/goal/criteria/surface snapshot and record their trigger (`create`, `rerun` or `revise`; absent on older reports). Task status and revise show a report as stale when the goal, intent, criteria or assigned scope change; a surface-only change leaves it current. The first saved revision that makes the current report stale, when that report was not itself revise-triggered, MUST wait for one automatic fresh round (trigger `revise`) and show its advice; the revision is kept whether that round completes, reports NOT_RUN or is cancelled. Further revisions MUST NOT automatically re-review until an explicit rerun. Repeated initial requests reuse the first attempt, including NOT_RUN; outside that one automatic round, only explicit `agent-ops review --criteria --task <id> --rerun --yes` starts another fresh single round. Without --rerun the same command reads/waits for the current attempt.
|
|
16
16
|
|
|
17
17
|
Detailed redacted reports remain private in `.agent-ops/reviews/criteria-<task-id>*.json`; the local log contains only status, duration, counts, reported usage and report reference. CLI invocation counts are distinct from provider model calls, which may be unreported. Report/log failures MUST NOT roll back a task or fabricate evidence. These advisory artifacts MUST NOT satisfy verify, final review or finish.
|
|
18
18
|
|
|
@@ -112,6 +112,40 @@ successful refutation MUST make the run FAIL.
|
|
|
112
112
|
replays the recorded queries and reads every listed `valueChanges` consumer;
|
|
113
113
|
this is the only exception to "do not survey the repository".
|
|
114
114
|
|
|
115
|
+
## REVIEW-ORIGIN-001
|
|
116
|
+
|
|
117
|
+
A defect the change did not cause MUST NOT block the change; it MUST be
|
|
118
|
+
reported as `origin: "pre-existing"` with `blocking: false` and flow to the
|
|
119
|
+
followup ledger.
|
|
120
|
+
|
|
121
|
+
- Trigger: A reviewer meets a defect while reading for the review.
|
|
122
|
+
- Action: Mark it pre-existing only when it is present identically at the base
|
|
123
|
+
and the change did not introduce, expose, worsen or depend on it. Report only
|
|
124
|
+
defects met on the normal read path; do not search for old ones.
|
|
125
|
+
- Evidence: The report validator rejects a pre-existing finding with
|
|
126
|
+
`blocking: true` at any severity, including critical. A finding without
|
|
127
|
+
`origin` means introduced and keeps the old severity rules, so stored reports
|
|
128
|
+
stay valid. Nonblocking findings of a delivered PASS reach followup as before.
|
|
129
|
+
- Positive: `A critical injection in an untouched helper is reported as pre-existing, nonblocking, and collected into followup.`
|
|
130
|
+
- Negative: `A caller in an unchanged file breaks because of this change and is marked pre-existing because its lines were not edited.`
|
|
131
|
+
|
|
132
|
+
## REVIEW-ROUNDS-001
|
|
133
|
+
|
|
134
|
+
Review MUST stop after three failed reviews of one task contract and ask for a
|
|
135
|
+
new approach instead of another fix round.
|
|
136
|
+
|
|
137
|
+
- Trigger: `review` (directly or through `batch`, `task advance` or a run) for a
|
|
138
|
+
task with three or more FAIL reports bound to its current task contract hash
|
|
139
|
+
and newer than its latest PASS.
|
|
140
|
+
- Action: Return NOT_RUN `round-cap` before resolving scope or starting any
|
|
141
|
+
reviewer, printing the exact `task revise` command. Reconsider the approach and
|
|
142
|
+
revise the criteria or intent with a reason, or ask the user.
|
|
143
|
+
- Evidence: NOT_RUN reports never count; each source fingerprint keeps one
|
|
144
|
+
report, so re-reviewing unchanged code adds nothing; a contract revision or a
|
|
145
|
+
newer PASS starts the count again. The cap is a constant, not configuration.
|
|
146
|
+
- Positive: `Third FAIL on the same contract; the agent revises the intent to a different design and reviews again.`
|
|
147
|
+
- Negative: `Keep committing one fix per finding through a fifth review of the same contract.`
|
|
148
|
+
|
|
115
149
|
## REVIEW-HOST-001
|
|
116
150
|
|
|
117
151
|
A host that cannot provide network and loopback capability MUST fail closed
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# 審查
|
|
2
2
|
|
|
3
|
-
English source version: 2026-10-
|
|
3
|
+
English source version: 2026-10-27. Revalidate: when the English specification changes.
|
|
4
4
|
|
|
5
5
|
## REVIEW-CRITERIA-001
|
|
6
6
|
|
|
7
7
|
- Trigger: 正式 task 的 criteria 就緒、尚未開始實作。
|
|
8
8
|
- Action: 等待一輪限定範圍的 advisory,由 writer 記錄採納或拒絕理由。
|
|
9
9
|
- Evidence: 私人快照報告與安全 local 狀態/用量 log;不產生完成證明。
|
|
10
|
-
- Positive:
|
|
11
|
-
- Negative: `每次 revise
|
|
10
|
+
- Positive: `依建議改寫 criterion;該次 revise 自動重跑一輪 advisory 並顯示新建議。`
|
|
11
|
+
- Negative: `每次 revise(包含只改 surface)都重審,或把建議當正式 PASS 證明。`
|
|
12
12
|
|
|
13
13
|
每個正式 task 建立入口(含 DEBUG、replan 新子任務及 native run root/child)MUST 在首次實作前等待一輪獨立 criteria advisory。使用設定的 independent-review target 與全新 session,優先選擇不同於 host 的 target;只提供原始 goal、指派 intent/covers、criteria 與 surface audit,並在空白暫存工作區執行。MUST NOT 掃描 repository 或跑測試。缺 goal 須明示資訊不足;子任務只對指派範圍判完整性。材料是否存在、是否載入產品程式留待實作驗證;有理由的 review-only 條件合法。
|
|
14
14
|
|
|
15
15
|
advisory 不設 agent-ops 執行 deadline、stall cutoff 或 token budget。provider 限制、真正啟動/認證/輸出錯誤與人工取消仍有效。錯誤回報 NOT_RUN 後可繼續;人工取消保留 task 並 MUST 停止實作。native 審查程序仍受註冊與停止機制管理。一般 verify 與正式雙輪 review 的既有時間限制及 gate 保持有效。
|
|
16
16
|
|
|
17
|
-
task 建立回應呈現建議與私人報告位置。writer 自行判斷採納,透過 task revise 記錄採納及拒絕理由(可用相同 criteria 修訂記錄拒絕建議)。需求歧義或擴大範圍才向使用者澄清。報告綁定 task/goal/criteria/surface
|
|
17
|
+
task 建立回應呈現建議與私人報告位置。writer 自行判斷採納,透過 task revise 記錄採納及拒絕理由(可用相同 criteria 修訂記錄拒絕建議)。需求歧義或擴大範圍才向使用者澄清。報告綁定 task/goal/criteria/surface 快照,並記錄觸發來源(`create`、`rerun` 或 `revise`;舊報告沒有此欄位)。goal、intent、criteria 或指派範圍改變後,status 與 revise 顯示報告已過期;只改 surface 時報告仍視為最新。第一次讓目前報告過期的已儲存修訂,若該報告本身不是 revise 觸發,MUST 等待一輪自動的新審查(觸發來源 `revise`)並顯示建議;不論該輪完成、回報 NOT_RUN 或被取消,修訂都會保留。之後的修訂 MUST NOT 自動重審,直到明確 rerun 為止。重複初審請求重用第一次嘗試,包含 NOT_RUN;除了那一輪自動審查,只有明確執行 `agent-ops review --criteria --task <id> --rerun --yes` 才開始新的一輪。省略 --rerun 時讀取/等待目前嘗試。
|
|
18
18
|
|
|
19
19
|
詳細報告經遮蔽後私存於 `.agent-ops/reviews/criteria-<task-id>*.json`;local log 只記狀態、耗時、數量、可得用量及報告參照。CLI 呼叫數與 provider 模型呼叫數分開,後者可能未回報。報告/log 故障 MUST NOT 回滾 task 或偽造證據。advisory 產物 MUST NOT 滿足 verify、正式 review 或 finish。
|
|
20
20
|
|
|
@@ -100,6 +100,26 @@ PASS MUST 交給第二個規劃的 target 嘗試反駁,且反駁成立時 MUST
|
|
|
100
100
|
- Note: 只有一個設定 target 時,會在全新 session 再呼叫同一 target。FAIL 已是終局,不再複查。
|
|
101
101
|
- Note: 有 surface 的 task,第二輪也會在 `surface-coverage` 下搜尋未列出的 surface 與情境:檢查五個固定情境維度,每個軸向最多可新增 3 個 `git grep -F` 查詢。第一輪重放記錄的查詢並閱讀每個列出的 `valueChanges` consumer;這是「不要普查 repository」唯一的例外。
|
|
102
102
|
|
|
103
|
+
## REVIEW-ORIGIN-001
|
|
104
|
+
|
|
105
|
+
不是本次變更造成的缺陷 MUST NOT 擋下變更;MUST 以 `origin: "pre-existing"`、`blocking: false` 回報,並流入 followup ledger。
|
|
106
|
+
|
|
107
|
+
- Trigger: reviewer 在審查閱讀過程中碰到缺陷。
|
|
108
|
+
- Action: 只有當缺陷在 base 以相同形式存在,且本次變更沒有引入、暴露、加劇或依賴它時,才標為 pre-existing。只回報正常閱讀路徑上碰到的缺陷;不主動搜尋舊問題。
|
|
109
|
+
- Evidence: report validator 拒絕任何 severity(包含 critical)的 pre-existing finding 帶 `blocking: true`。沒有 `origin` 的 finding 視為 introduced,沿用原本的 severity 規則,因此既有 report 仍然有效。已交付 PASS 的 nonblocking finding 照舊進入 followup。
|
|
110
|
+
- Positive: `未改動 helper 裡的 critical injection 標為 pre-existing、nonblocking,並收進 followup。`
|
|
111
|
+
- Negative: `未改動檔案中的 caller 因本次變更而壞掉,卻因為那幾行沒被修改就標為 pre-existing。`
|
|
112
|
+
|
|
113
|
+
## REVIEW-ROUNDS-001
|
|
114
|
+
|
|
115
|
+
同一份 task contract 的 review 失敗三次後 MUST 停止,要求換方案,而不是再修一輪。
|
|
116
|
+
|
|
117
|
+
- Trigger: 對某 task 執行 `review`(直接執行,或經由 `batch`、`task advance`、run),且該 task 在目前 task contract hash 下、最近一次 PASS 之後已有三份以上 FAIL report。
|
|
118
|
+
- Action: 在解析 scope 或啟動任何 reviewer 之前回傳 NOT_RUN `round-cap`,並印出完整的 `task revise` 指令。重新檢討做法,附上理由修訂 criteria 或 intent,或詢問使用者。
|
|
119
|
+
- Evidence: NOT_RUN report 不計入;每個 source fingerprint 只保留一份 report,所以對未改動的程式碼重跑不會增加次數;contract 修訂或較新的 PASS 會讓計數歸零。上限是常數,不是設定項。
|
|
120
|
+
- Positive: `同一份 contract 第三次 FAIL;agent 把 intent 改成另一種設計後再審。`
|
|
121
|
+
- Negative: `同一份 contract 審到第五次,仍然每個 finding 修一個 commit。`
|
|
122
|
+
|
|
103
123
|
## REVIEW-HOST-001
|
|
104
124
|
|
|
105
125
|
Host 缺少 network 或 loopback 能力時,MUST 在任何 reviewer invocation 前
|
package/package.json
CHANGED
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"locations": { "type": "array", "items": { "$ref": "#/$defs/location" } },
|
|
42
42
|
"evidence": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/text" } },
|
|
43
43
|
"recommendation": { "$ref": "#/$defs/text" },
|
|
44
|
-
"criterionIds": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/text" } }
|
|
44
|
+
"criterionIds": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/text" } },
|
|
45
|
+
"origin": { "enum": ["introduced", "pre-existing"] }
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|