loopforge 3.2.1 → 3.6.0
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 +67 -67
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +7 -34
- package/dist/audit.js.map +1 -1
- package/dist/canonical-state.d.ts +71 -4
- package/dist/canonical-state.d.ts.map +1 -1
- package/dist/canonical-state.js +176 -9
- package/dist/canonical-state.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -18
- package/dist/cli.js.map +1 -1
- package/dist/cognitive-facts.d.ts +17 -0
- package/dist/cognitive-facts.d.ts.map +1 -0
- package/dist/cognitive-facts.js +99 -0
- package/dist/cognitive-facts.js.map +1 -0
- package/dist/committed-round.d.ts +59 -0
- package/dist/committed-round.d.ts.map +1 -0
- package/dist/committed-round.js +222 -0
- package/dist/committed-round.js.map +1 -0
- package/dist/enforcement-gate.d.ts +4 -2
- package/dist/enforcement-gate.d.ts.map +1 -1
- package/dist/enforcement-gate.js +339 -301
- package/dist/enforcement-gate.js.map +1 -1
- package/dist/engine.d.ts +16 -4
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +63 -15
- package/dist/engine.js.map +1 -1
- package/dist/evidence-claims.d.ts.map +1 -1
- package/dist/evidence-claims.js +21 -39
- package/dist/evidence-claims.js.map +1 -1
- package/dist/evidence-provider.d.ts +29 -0
- package/dist/evidence-provider.d.ts.map +1 -1
- package/dist/evidence-provider.js +93 -16
- package/dist/evidence-provider.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/loop-compiler.d.ts +21 -4
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +244 -66
- package/dist/loop-compiler.js.map +1 -1
- package/dist/loop-projection.d.ts +5 -25
- package/dist/loop-projection.d.ts.map +1 -1
- package/dist/loop-projection.js +18 -134
- package/dist/loop-projection.js.map +1 -1
- package/dist/loop-store.d.ts +5 -2
- package/dist/loop-store.d.ts.map +1 -1
- package/dist/loop-store.js.map +1 -1
- package/dist/mcp/round-lifecycle.d.ts +6 -8
- package/dist/mcp/round-lifecycle.d.ts.map +1 -1
- package/dist/mcp/round-lifecycle.js +61 -52
- package/dist/mcp/round-lifecycle.js.map +1 -1
- package/dist/mcp/server.js +3 -3
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +14 -3
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +174 -52
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/tools.d.ts +12 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +160 -52
- package/dist/mcp/tools.js.map +1 -1
- package/dist/policy-metrics.d.ts +0 -7
- package/dist/policy-metrics.d.ts.map +1 -1
- package/dist/policy-metrics.js +15 -55
- package/dist/policy-metrics.js.map +1 -1
- package/dist/policy.d.ts +22 -20
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +24 -38
- package/dist/policy.js.map +1 -1
- package/dist/prompt-assembler.d.ts.map +1 -1
- package/dist/prompt-assembler.js +120 -140
- package/dist/prompt-assembler.js.map +1 -1
- package/dist/protocol.d.ts +57 -23
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +10 -4
- package/dist/protocol.js.map +1 -1
- package/dist/replay.d.ts.map +1 -1
- package/dist/replay.js +21 -22
- package/dist/replay.js.map +1 -1
- package/dist/round-contract.d.ts +64 -0
- package/dist/round-contract.d.ts.map +1 -0
- package/dist/round-contract.js +80 -0
- package/dist/round-contract.js.map +1 -0
- package/dist/round-coordinator.d.ts +5 -3
- package/dist/round-coordinator.d.ts.map +1 -1
- package/dist/round-coordinator.js +33 -29
- package/dist/round-coordinator.js.map +1 -1
- package/dist/round-driver.d.ts +0 -1
- package/dist/round-driver.d.ts.map +1 -1
- package/dist/round-driver.js +0 -1
- package/dist/round-driver.js.map +1 -1
- package/dist/round-transaction.d.ts +0 -1
- package/dist/round-transaction.d.ts.map +1 -1
- package/dist/round-transaction.js +0 -1
- package/dist/round-transaction.js.map +1 -1
- package/dist/self-eval.d.ts +29 -34
- package/dist/self-eval.d.ts.map +1 -1
- package/dist/self-eval.js +112 -148
- package/dist/self-eval.js.map +1 -1
- package/dist/verification-gate.d.ts +53 -12
- package/dist/verification-gate.d.ts.map +1 -1
- package/dist/verification-gate.js +462 -90
- package/dist/verification-gate.js.map +1 -1
- package/dist/workspace.d.ts +29 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +61 -0
- package/dist/workspace.js.map +1 -0
- package/loop_policy.json +5 -13
- package/package.json +1 -1
- package/skills/perception/SKILL.md +135 -136
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
* modified). Flags become hard constraints — the agent
|
|
13
13
|
* must respond in the next round.
|
|
14
14
|
*/
|
|
15
|
-
import { getPolicy } from "./policy.js";
|
|
15
|
+
import { getPolicy, isConfiguredCommand } from "./policy.js";
|
|
16
16
|
import { makeVerificationFlag, makeVerificationResult } from "./protocol.js";
|
|
17
17
|
import { jaccardSimilarity, tokenize, entryRound as sharedEntryRound, isRecord } from "./token-utils.js";
|
|
18
18
|
import { deriveSubGoalId } from "./loop-compiler.js";
|
|
19
|
+
import { committedRoundsFromEntries, machineGitMotionSeries } from "./committed-round.js";
|
|
20
|
+
import { contractRoundEvaluations, contractDoneWhenSatisfied, contractItemMatches, deriveActiveRoundContract, } from "./round-contract.js";
|
|
21
|
+
import { stableStringify } from "./canonical-state.js";
|
|
19
22
|
import { deriveClaimView, resolveRoundFiles } from "./evidence-claims.js";
|
|
20
|
-
import { effectiveSuccess } from "./self-eval.js";
|
|
23
|
+
import { effectiveSuccess, parseRoundContract } from "./self-eval.js";
|
|
21
24
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
22
25
|
// v2.12: Check-name constants — single source of truth so the enforcement
|
|
23
26
|
// gate and audit can reference checks without string-literal drift.
|
|
@@ -37,14 +40,57 @@ export const CHECK_RETRACT_FRESH_CONSTRAINT = "retract_fresh_constraint";
|
|
|
37
40
|
export const CHECK_EVIDENCE_INTEGRITY = "evidence_integrity";
|
|
38
41
|
export const CHECK_REQUIRED_COMMAND_FAILED = "required_command_failed";
|
|
39
42
|
export const CHECK_COMMAND_EVIDENCE_MISMATCH = "command_evidence_mismatch";
|
|
43
|
+
/** v3.3: Verification domain integrity — a command entrypoint (run-tests.sh,
|
|
44
|
+
* package.json, …) changed in the same round the command ran. The runtime
|
|
45
|
+
* executed a script the agent just rewrote, so the observation has no
|
|
46
|
+
* stable baseline: error. Test-file changes are normal dev activity (TDD):
|
|
47
|
+
* warn-only, see CHECK_TEST_FILES_MODIFIED. */
|
|
48
|
+
export const CHECK_VERIFICATION_ENTRYPOINT_MODIFIED = "verification_entrypoint_modified";
|
|
49
|
+
/** v3.3: Test files changed in the same round a verification command passed.
|
|
50
|
+
* Warn-only — the command result stays usable. */
|
|
51
|
+
export const CHECK_TEST_FILES_MODIFIED = "test_files_modified";
|
|
40
52
|
export const CHECK_INTENT_DRIFT = "intent_drift";
|
|
41
53
|
export const CHECK_SUBGOAL_DRIFT = "subgoal_drift";
|
|
42
54
|
export const CHECK_BACKTRACK_WORKSPACE_NOT_RESTORED = "backtrack_workspace_not_restored";
|
|
43
55
|
export const CHECK_CRITERIA_CLAIMS_UNVERIFIED = "criteria_claims_unverified";
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
// v3.3 — Round Contract checks. v3.4: split by target. The submission's own
|
|
57
|
+
// round_contract is a PROPOSAL for the NEXT round and is checked only
|
|
58
|
+
// structurally at declaration (underspecified / unverifiable). Execution
|
|
59
|
+
// conformance (scope drift / premature boundary) targets the ACTIVE
|
|
60
|
+
// contract — the contract the round actually executed under, derived from
|
|
61
|
+
// the committed evals of earlier rounds (round-contract.ts). All checks are
|
|
62
|
+
// silent when their target is absent: contract-less rounds behave exactly
|
|
63
|
+
// as before these checks existed, and round 1 (no committed rounds → no
|
|
64
|
+
// active contract) never produces declaration off-by-one noise.
|
|
65
|
+
/** Contract proposed with an empty done_when — nothing is promised, so
|
|
66
|
+
* nothing can be verified at the boundary. Warn: the contract can be fixed
|
|
67
|
+
* by re-declaring next round. */
|
|
68
|
+
export const CHECK_ROUND_UNDERSPECIFIED = "round_underspecified";
|
|
69
|
+
/** done_when items exist but verification_plan is empty or names commands
|
|
70
|
+
* that are not configured AND enabled in policy.evidence.commands — the
|
|
71
|
+
* completion claims could never be machine-checked. Warn. */
|
|
72
|
+
export const CHECK_ROUND_UNVERIFIABLE = "round_unverifiable";
|
|
73
|
+
/** The round's actual git changes include files outside the ACTIVE
|
|
74
|
+
* contract's declared scope. Warn + drift_clarification exemption
|
|
75
|
+
* (R7-style). */
|
|
76
|
+
export const CHECK_ROUND_SCOPE_DRIFT = "round_scope_drift";
|
|
77
|
+
/** success claimed under the ACTIVE contract whose done_when items are
|
|
78
|
+
* either claimed met without machine-verified evidence or silently dropped
|
|
79
|
+
* (not in success_criteria_met NOR success_criteria_remaining). Error. */
|
|
80
|
+
export const CHECK_PREMATURE_BOUNDARY = "premature_boundary";
|
|
81
|
+
/** v3.5: Closing a Round Contract is a success-class claim and must be
|
|
82
|
+
* machine-backed. The eval's met claims satisfy every done_when of the
|
|
83
|
+
* ACTIVE contract but its verification_plan commands did not pass this
|
|
84
|
+
* round. Error; warn under evidence.machine_backed_success "warn"; never
|
|
85
|
+
* downgraded by no_change_reason (all done_when met contradicts "no
|
|
86
|
+
* change"). Fail-open: plan names no longer configured+enabled are not
|
|
87
|
+
* required (cannot observe). */
|
|
88
|
+
export const CHECK_CONTRACT_COMPLETION_UNVERIFIED = "contract_completion_unverified";
|
|
89
|
+
/** v3.5: The ACTIVE contract is still open (not completed, not blocked)
|
|
90
|
+
* while a different contract was proposed — the proposal is ignored until
|
|
91
|
+
* the active one closes. Warn: the walker still ignores it; this only
|
|
92
|
+
* surfaces the otherwise-silent state. */
|
|
93
|
+
export const CHECK_CONTRACT_PREMATURE = "contract_premature";
|
|
48
94
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
49
95
|
// Helpers
|
|
50
96
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -64,11 +110,88 @@ function entryViolations(entry) {
|
|
|
64
110
|
return viols.filter((v) => typeof v === "string");
|
|
65
111
|
return [];
|
|
66
112
|
}
|
|
113
|
+
// ── v3.3: Round Contract scope matching ─────────────────────────────────────
|
|
114
|
+
/** Normalize a contract scope entry: backslashes → forward slashes, strip
|
|
115
|
+
* leading "./", trim, strip trailing slashes. "." / "./" / "" normalize to
|
|
116
|
+
* "" = the repository root (everything is in scope). */
|
|
117
|
+
export function normalizeScopeEntry(path) {
|
|
118
|
+
let s = path.replace(/\\/g, "/").trim();
|
|
119
|
+
while (s.startsWith("./"))
|
|
120
|
+
s = s.slice(2);
|
|
121
|
+
if (s === "." || s === "")
|
|
122
|
+
return "";
|
|
123
|
+
while (s.endsWith("/"))
|
|
124
|
+
s = s.slice(0, -1);
|
|
125
|
+
return s;
|
|
126
|
+
}
|
|
127
|
+
/** Whether a git-diff file path falls inside any declared scope entry:
|
|
128
|
+
* exact file match, or the file lives under a declared directory. The ""
|
|
129
|
+
* entry (repo root) matches everything. Git paths are always workspace-
|
|
130
|
+
* relative with forward slashes. */
|
|
131
|
+
export function isFileInScope(file, scope) {
|
|
132
|
+
const normalizedFile = normalizeScopeEntry(file);
|
|
133
|
+
for (const entry of scope) {
|
|
134
|
+
const normalized = normalizeScopeEntry(entry);
|
|
135
|
+
if (normalized === "" || normalizedFile === normalized ||
|
|
136
|
+
normalizedFile.startsWith(normalized + "/")) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
/** Git-diff files outside the declared scope (the round_scope_drift signal). */
|
|
143
|
+
export function collectOutOfScopeFiles(files, scope) {
|
|
144
|
+
return files.filter((file) => !isFileInScope(file, scope));
|
|
145
|
+
}
|
|
146
|
+
/** v3.3: Detect verification-domain tampering for a command snapshot.
|
|
147
|
+
* entrypointModified — a workspace file the command depends on
|
|
148
|
+
* (snapshot.data.entrypointFiles) changed this round: the runtime executed
|
|
149
|
+
* a script the agent just rewrote, so the "machine observation" has no
|
|
150
|
+
* stable baseline. testFilesModified — the round changed test files
|
|
151
|
+
* (isTestFile): normal in TDD, so warn-only; the command result stays
|
|
152
|
+
* usable. Pure snapshot derivation — no fs access (this module is pure). */
|
|
153
|
+
function commandTampered(snapshot, gitSnapshot) {
|
|
154
|
+
if (!gitSnapshot)
|
|
155
|
+
return { entrypointModified: false, testFilesModified: false };
|
|
156
|
+
const gitFiles = new Set(gitSnapshot.files);
|
|
157
|
+
const entrypoints = isRecord(snapshot.data) &&
|
|
158
|
+
Array.isArray(snapshot.data.entrypointFiles)
|
|
159
|
+
? snapshot.data.entrypointFiles.filter((f) => typeof f === "string")
|
|
160
|
+
: [];
|
|
161
|
+
const entrypointModified = entrypoints.some((file) => gitFiles.has(file));
|
|
162
|
+
const testFilesModified = [...gitFiles].some((file) => isTestFile(file));
|
|
163
|
+
return { entrypointModified, testFilesModified };
|
|
164
|
+
}
|
|
67
165
|
function passedAfterCommand(snapshots) {
|
|
166
|
+
const git = snapshots.find((snapshot) => snapshot.provider === "git") ?? null;
|
|
68
167
|
return snapshots.find((snapshot) => isRecord(snapshot.data) &&
|
|
69
168
|
snapshot.data.kind === "command" &&
|
|
70
169
|
snapshot.data.phase === "after" &&
|
|
71
|
-
snapshot.data.status === "passed"
|
|
170
|
+
snapshot.data.status === "passed" &&
|
|
171
|
+
// v3.3: a command whose entrypoint changed this round is not machine
|
|
172
|
+
// evidence — exclude it so providerStatus degrades to unavailable.
|
|
173
|
+
!commandTampered(snapshot, git).entrypointModified) ?? null;
|
|
174
|
+
}
|
|
175
|
+
/** v3.5: Names of commands observed passing in the after-phase this round.
|
|
176
|
+
* Tampered commands (entrypoint changed this round) are not machine
|
|
177
|
+
* evidence and are excluded — the same rule passedAfterCommand applies. */
|
|
178
|
+
function passedPlanCommandNames(snapshots) {
|
|
179
|
+
const git = snapshots.find((snapshot) => snapshot.provider === "git") ?? null;
|
|
180
|
+
const names = new Set();
|
|
181
|
+
for (const snapshot of snapshots) {
|
|
182
|
+
if (!isRecord(snapshot.data))
|
|
183
|
+
continue;
|
|
184
|
+
if (snapshot.data.kind !== "command")
|
|
185
|
+
continue;
|
|
186
|
+
if (snapshot.data.phase !== "after" || snapshot.data.status !== "passed")
|
|
187
|
+
continue;
|
|
188
|
+
if (commandTampered(snapshot, git).entrypointModified)
|
|
189
|
+
continue;
|
|
190
|
+
const name = snapshot.data.commandName;
|
|
191
|
+
if (typeof name === "string" && name.length > 0)
|
|
192
|
+
names.add(name);
|
|
193
|
+
}
|
|
194
|
+
return names;
|
|
72
195
|
}
|
|
73
196
|
/** v3.2: Derive the machine-verification status of a round. The verification
|
|
74
197
|
* capability is modeled explicitly (verified / unavailable / absent) instead
|
|
@@ -99,9 +222,17 @@ export function deriveEvidenceStatus(selfEval, evidenceSnapshots) {
|
|
|
99
222
|
reportedFilesMatch = reportedSet.length === actualSet.length &&
|
|
100
223
|
reportedSet.every((file, index) => file === actualSet[index]);
|
|
101
224
|
}
|
|
225
|
+
// v3.3: git observation alone is no longer "verified" — the machine seeing
|
|
226
|
+
// file changes is not the machine verifying success. Only a passed
|
|
227
|
+
// after-phase command (observed by the runtime itself) upgrades a round.
|
|
228
|
+
// Any other snapshot presence is "unavailable": the machine saw activity
|
|
229
|
+
// (or nothing at all this round) but could not verify the success claim,
|
|
230
|
+
// so R8 warns and trust drops (v3.6: merged success_unverified semantics).
|
|
102
231
|
const providerStatus = evidenceSnapshots.length === 0
|
|
103
232
|
? "absent"
|
|
104
|
-
:
|
|
233
|
+
: commandVerified
|
|
234
|
+
? "verified"
|
|
235
|
+
: "unavailable";
|
|
105
236
|
return {
|
|
106
237
|
providerStatus,
|
|
107
238
|
gitObserved,
|
|
@@ -110,43 +241,9 @@ export function deriveEvidenceStatus(selfEval, evidenceSnapshots) {
|
|
|
110
241
|
reportedFilesMatch,
|
|
111
242
|
};
|
|
112
243
|
}
|
|
113
|
-
/**
|
|
114
|
-
* each of the last `lookback` committed rounds, rebuilt from the feedback
|
|
115
|
-
* entries' roundEvidence snapshots (already persisted at commit). Returns
|
|
116
|
-
* null when fewer than `lookback` rounds carry git snapshots — the machine
|
|
117
|
-
* signal is unavailable and callers (R4/R5 on the heuristic path) keep
|
|
118
|
-
* their legacy skip. The snapshot shape is parsed defensively here because
|
|
119
|
-
* this module must not import round-transaction (import cycle). */
|
|
244
|
+
/** Per-round machine progress over decoded committed history. */
|
|
120
245
|
export function machineProgressSeries(vaultEntries, currentRound, lookback) {
|
|
121
|
-
|
|
122
|
-
for (const entry of vaultEntries) {
|
|
123
|
-
const tid = String(entry.task_id ?? "");
|
|
124
|
-
if (!tid.endsWith(":feedback"))
|
|
125
|
-
continue;
|
|
126
|
-
const rnd = entryRound(entry);
|
|
127
|
-
if (rnd <= 0 || rnd >= currentRound)
|
|
128
|
-
continue;
|
|
129
|
-
const rt = isRecord(entry.loop_lineage)
|
|
130
|
-
? entry.loop_lineage.round_transaction
|
|
131
|
-
: null;
|
|
132
|
-
const snapshot = isRecord(rt) ? rt.snapshot : null;
|
|
133
|
-
const roundEvidence = isRecord(snapshot) ? snapshot.roundEvidence : null;
|
|
134
|
-
if (!Array.isArray(roundEvidence))
|
|
135
|
-
continue;
|
|
136
|
-
const git = roundEvidence.find((value) => isRecord(value) && value.provider === "git");
|
|
137
|
-
if (!git)
|
|
138
|
-
continue;
|
|
139
|
-
const gitFiles = git.files;
|
|
140
|
-
byRound.set(rnd, Array.isArray(gitFiles) && gitFiles.length > 0);
|
|
141
|
-
}
|
|
142
|
-
if (byRound.size < lookback)
|
|
143
|
-
return null;
|
|
144
|
-
const sorted = [...byRound.keys()].sort((a, b) => a - b);
|
|
145
|
-
const recent = sorted.slice(-lookback);
|
|
146
|
-
// Continuity: the recent rounds must be the actual last `lookback` rounds.
|
|
147
|
-
if (recent[0] < currentRound - lookback)
|
|
148
|
-
return null;
|
|
149
|
-
return recent.map((round) => byRound.get(round));
|
|
246
|
+
return machineGitMotionSeries(committedRoundsFromEntries(vaultEntries, currentRound), currentRound, lookback);
|
|
150
247
|
}
|
|
151
248
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
152
249
|
// Individual checks — each returns a VerificationFlag or null
|
|
@@ -222,9 +319,9 @@ function checkUnverifiedCriteriaClaims(selfEval, claimView) {
|
|
|
222
319
|
"(no passing test evidence or command snapshot)",
|
|
223
320
|
});
|
|
224
321
|
}
|
|
225
|
-
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
322
|
+
/** Declared outcome vs the core success flag. A declared success with
|
|
323
|
+
* success=false is a self-contradiction (error); a declared non-success with
|
|
324
|
+
* success=true is an inconsistent claim (warn). Also: outcome==="blocked"
|
|
228
325
|
* without a blocker description gets a warn so the next prompt asks for it. */
|
|
229
326
|
function checkOutcomeConsistency(selfEval) {
|
|
230
327
|
const outcome = selfEval.outcome;
|
|
@@ -300,50 +397,45 @@ function checkRetroactiveClaims(selfEval, vaultEntries, currentRound) {
|
|
|
300
397
|
}));
|
|
301
398
|
}
|
|
302
399
|
}
|
|
303
|
-
|
|
400
|
+
// v3.3.1: return every offending claim's flag — a single truncated flag
|
|
401
|
+
// hid all but the first problem until the next round.
|
|
402
|
+
return flags.length > 0 ? flags : null;
|
|
304
403
|
}
|
|
305
|
-
/** v2.12: success
|
|
306
|
-
* completion but
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
|
|
404
|
+
/** v2.12/v3.6: success without a machine-verified observation. The agent
|
|
405
|
+
* claims completion but the runtime observed no machine evidence for it.
|
|
406
|
+
* v3.6: the trigger is the runtime-derived providerStatus (verified /
|
|
407
|
+
* unavailable / absent) — the v3.2 success_unverified check merged here.
|
|
408
|
+
* ProviderStatus "verified" requires an UNTAMPERED passed after-command, so
|
|
409
|
+
* an entrypoint-tampered command no longer counts as machine evidence
|
|
410
|
+
* (that coverage previously lived in success_unverified alone); the check
|
|
411
|
+
* never self-skips on the heuristic-extraction path. Severity follows
|
|
412
|
+
* evidence.machine_backed_success — "required" rejects (error), "warn"
|
|
413
|
+
* tolerates with a warn (round commits, success excluded from the
|
|
414
|
+
* trajectory, trust drops). A declared no_change_reason is the honest
|
|
415
|
+
* escape hatch: it downgrades to info. no_change_reason is honored HERE
|
|
416
|
+
* ONLY — contract checks refuse it (v3.6). */
|
|
417
|
+
function checkSuccessWithoutVerifiedEvidence(selfEval, status) {
|
|
310
418
|
if (!effectiveSuccess(selfEval))
|
|
311
419
|
return null;
|
|
312
|
-
if (
|
|
420
|
+
if (status.providerStatus === "verified")
|
|
313
421
|
return null;
|
|
314
422
|
const noChange = typeof selfEval.no_change_reason === "string" &&
|
|
315
423
|
selfEval.no_change_reason.trim().length > 0;
|
|
424
|
+
// v3.3: severity follows evidence.machine_backed_success — "required"
|
|
425
|
+
// rejects (error), "warn" tolerates with a warn (round commits, success
|
|
426
|
+
// excluded from the trajectory, trust drops). no_change_reason stays info.
|
|
427
|
+
const severity = noChange
|
|
428
|
+
? "info"
|
|
429
|
+
: getPolicy().evidence.machine_backed_success === "warn"
|
|
430
|
+
? "warn"
|
|
431
|
+
: "error";
|
|
316
432
|
return makeVerificationFlag({
|
|
317
|
-
severity
|
|
433
|
+
severity,
|
|
318
434
|
field: "success",
|
|
319
435
|
check: CHECK_SUCCESS_WITHOUT_VERIFIED_EVIDENCE,
|
|
320
436
|
detail: noChange
|
|
321
437
|
? "success with zero verified claims (no_change_reason declared)"
|
|
322
|
-
:
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
/** v3.2: success declared but no machine-verified observation this round.
|
|
326
|
-
* Unlike R8 (which keys off the agent's SELF-REPORTED test_results), this
|
|
327
|
-
* keys off the runtime-derived providerStatus: git diff observed, or a
|
|
328
|
-
* passed after-command. Warn-level by design — the round commits, but its
|
|
329
|
-
* success never enters the trajectory (and trust drops). A declared
|
|
330
|
-
* no_change_reason is the honest escape hatch, mirroring R8.
|
|
331
|
-
* Crucially this check does NOT self-skip on the heuristic-extraction path:
|
|
332
|
-
* an unstructured success claim without machine observation is flagged
|
|
333
|
-
* exactly the same — the check degrades, it never disappears. */
|
|
334
|
-
function checkSuccessUnverified(selfEval, status) {
|
|
335
|
-
if (!effectiveSuccess(selfEval))
|
|
336
|
-
return null;
|
|
337
|
-
if (typeof selfEval.no_change_reason === "string" &&
|
|
338
|
-
selfEval.no_change_reason.trim().length > 0)
|
|
339
|
-
return null;
|
|
340
|
-
if (status.providerStatus === "verified")
|
|
341
|
-
return null;
|
|
342
|
-
return makeVerificationFlag({
|
|
343
|
-
severity: "warn",
|
|
344
|
-
field: "success",
|
|
345
|
-
check: CHECK_SUCCESS_UNVERIFIED,
|
|
346
|
-
detail: `success declared but no machine-verified observation this round (providerStatus: ${status.providerStatus})`,
|
|
438
|
+
: `success declared but no machine-verified observation this round (providerStatus: ${status.providerStatus})`,
|
|
347
439
|
});
|
|
348
440
|
}
|
|
349
441
|
function checkDuplicateConstraintDiscovery(selfEval, prevSelfEval, olderViolations) {
|
|
@@ -740,6 +832,48 @@ function checkCommandEvidenceIntegrity(selfEval, evidenceSnapshots) {
|
|
|
740
832
|
}
|
|
741
833
|
return null;
|
|
742
834
|
}
|
|
835
|
+
/** v3.3: Verification domain integrity — command entrypoints and test files
|
|
836
|
+
* changed in the same round the command ran. Entrypoint modification
|
|
837
|
+
* invalidates the machine observation (error: the runtime executed a script
|
|
838
|
+
* the agent just rewrote). Test-file changes are normal dev activity (warn:
|
|
839
|
+
* confirm the tests still verify the task claims). Fail-open when the git
|
|
840
|
+
* snapshot is missing or the command has no resolvable entrypoint. */
|
|
841
|
+
function checkVerificationDomainIntegrity(evidenceSnapshots) {
|
|
842
|
+
const git = evidenceSnapshots.find((snapshot) => snapshot.provider === "git") ?? null;
|
|
843
|
+
if (!git)
|
|
844
|
+
return null;
|
|
845
|
+
for (const snapshot of evidenceSnapshots) {
|
|
846
|
+
if (!isRecord(snapshot.data) || snapshot.data.kind !== "command")
|
|
847
|
+
continue;
|
|
848
|
+
if (snapshot.data.phase !== "after")
|
|
849
|
+
continue;
|
|
850
|
+
const { entrypointModified, testFilesModified } = commandTampered(snapshot, git);
|
|
851
|
+
if (!entrypointModified && !testFilesModified)
|
|
852
|
+
continue;
|
|
853
|
+
const name = typeof snapshot.data.commandName === "string"
|
|
854
|
+
? snapshot.data.commandName
|
|
855
|
+
: snapshot.provider;
|
|
856
|
+
if (entrypointModified) {
|
|
857
|
+
return makeVerificationFlag({
|
|
858
|
+
severity: "error",
|
|
859
|
+
field: "execution_evidence",
|
|
860
|
+
check: CHECK_VERIFICATION_ENTRYPOINT_MODIFIED,
|
|
861
|
+
detail: `Verification command "${name}" entrypoint changed this round — ` +
|
|
862
|
+
"its result cannot be trusted as machine evidence. Keep the " +
|
|
863
|
+
"verification command stable or resubmit the same round with the " +
|
|
864
|
+
"entrypoint unchanged.",
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
return makeVerificationFlag({
|
|
868
|
+
severity: "warn",
|
|
869
|
+
field: "execution_evidence",
|
|
870
|
+
check: CHECK_TEST_FILES_MODIFIED,
|
|
871
|
+
detail: `Test files changed in the same round command "${name}" passed — ` +
|
|
872
|
+
"confirm the tests still verify the task claims.",
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
return null;
|
|
876
|
+
}
|
|
743
877
|
/** v2.2: Check if the agent's declared next_action aligns with any pending
|
|
744
878
|
* or in_progress sub-goal. When 3+ pending sub-goals exist but the agent
|
|
745
879
|
* plans work unrelated to any of them, it may indicate task drift.
|
|
@@ -881,13 +1015,225 @@ function checkBacktrackGitHeadRestore(evidenceSnapshots, backtrackTargetGitHead)
|
|
|
881
1015
|
});
|
|
882
1016
|
}
|
|
883
1017
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1018
|
+
// v3.3 — Round Contract checks (all silent when no contract is declared)
|
|
1019
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1020
|
+
/** A PROPOSAL that promises nothing is a wasted round's worth of trust:
|
|
1021
|
+
* done_when empty means the boundary can never be machine-checked.
|
|
1022
|
+
* v3.4: declaration-quality check on the submission's own proposal — never
|
|
1023
|
+
* on the (derived) active contract. */
|
|
1024
|
+
function checkRoundUnderspecified(selfEval) {
|
|
1025
|
+
const contract = selfEval.round_contract;
|
|
1026
|
+
if (!contract)
|
|
1027
|
+
return null;
|
|
1028
|
+
if (contract.done_when.length > 0)
|
|
1029
|
+
return null;
|
|
1030
|
+
return makeVerificationFlag({
|
|
1031
|
+
severity: "warn",
|
|
1032
|
+
field: "round_contract",
|
|
1033
|
+
check: CHECK_ROUND_UNDERSPECIFIED,
|
|
1034
|
+
detail: "Round Contract declared with an empty done_when — nothing is " +
|
|
1035
|
+
"promised, so completion cannot be verified. Declare what must be " +
|
|
1036
|
+
"true when the round is done.",
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
/** done_when items whose verification_plan cannot run (empty plan, or names
|
|
1040
|
+
* outside the configured, enabled evidence.commands) can never be
|
|
1041
|
+
* machine-checked at the boundary. v3.4: declaration-quality check on the
|
|
1042
|
+
* submission's own proposal. */
|
|
1043
|
+
function checkRoundUnverifiable(selfEval) {
|
|
1044
|
+
const contract = selfEval.round_contract;
|
|
1045
|
+
if (!contract)
|
|
1046
|
+
return null;
|
|
1047
|
+
if (contract.done_when.length === 0)
|
|
1048
|
+
return null;
|
|
1049
|
+
if (contract.verification_plan.length > 0 &&
|
|
1050
|
+
contract.verification_plan.every((name) => isConfiguredCommand(name))) {
|
|
1051
|
+
return null;
|
|
1052
|
+
}
|
|
1053
|
+
const unknown = contract.verification_plan.filter((name) => !isConfiguredCommand(name));
|
|
1054
|
+
const detail = contract.verification_plan.length === 0
|
|
1055
|
+
? "done_when items declared but verification_plan is empty — no command " +
|
|
1056
|
+
"can back the completion claims"
|
|
1057
|
+
: `verification_plan names commands that are not configured and enabled ` +
|
|
1058
|
+
`in evidence.commands: ${unknown.slice(0, 3).join(", ")}`;
|
|
1059
|
+
return makeVerificationFlag({
|
|
1060
|
+
severity: "warn",
|
|
1061
|
+
field: "round_contract",
|
|
1062
|
+
check: CHECK_ROUND_UNVERIFIABLE,
|
|
1063
|
+
detail: detail + ". Name only configured, enabled evidence.commands, or drop " +
|
|
1064
|
+
"done_when items that cannot be machine-verified.",
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
/** The round changed files outside the ACTIVE contract's declared scope.
|
|
1068
|
+
* Git diff files are the machine-authoritative "what actually changed" set.
|
|
1069
|
+
* v3.4: targets the contract the round actually executed under — derived
|
|
1070
|
+
* from committed evals, never the submission's own proposal. Silent when
|
|
1071
|
+
* no active contract exists (round 1 and whole-task rounds: the agent
|
|
1072
|
+
* executed the original task, not a contract boundary). */
|
|
1073
|
+
function checkRoundScopeDrift(activeContract, evidenceSnapshots) {
|
|
1074
|
+
if (!activeContract)
|
|
1075
|
+
return null;
|
|
1076
|
+
if (activeContract.scope.length === 0)
|
|
1077
|
+
return null;
|
|
1078
|
+
const git = evidenceSnapshots.find((snapshot) => snapshot.provider === "git");
|
|
1079
|
+
if (!git)
|
|
1080
|
+
return null; // git unavailable → cannot observe → fail open
|
|
1081
|
+
const outOfScope = collectOutOfScopeFiles(git.files, activeContract.scope);
|
|
1082
|
+
if (outOfScope.length === 0)
|
|
1083
|
+
return null;
|
|
1084
|
+
return makeVerificationFlag({
|
|
1085
|
+
severity: "warn",
|
|
1086
|
+
field: "round_contract",
|
|
1087
|
+
check: CHECK_ROUND_SCOPE_DRIFT,
|
|
1088
|
+
detail: `Files changed outside the active contract's declared scope` +
|
|
1089
|
+
(outOfScope.length > 5
|
|
1090
|
+
? ` (${outOfScope.length} total, showing 5): ${outOfScope.slice(0, 5).join(", ")}`
|
|
1091
|
+
: `: ${outOfScope.join(", ")}`) +
|
|
1092
|
+
`. Revert them or extend the contract scope and explain in drift_clarification.`,
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
/** success claimed under the ACTIVE contract whose done_when items were not
|
|
1096
|
+
* honestly and verifiably completed: claimed met with no machine-verified
|
|
1097
|
+
* evidence this round, or silently dropped (present in neither
|
|
1098
|
+
* success_criteria_met nor success_criteria_remaining).
|
|
1099
|
+
* v3.4: targets the derived ACTIVE contract (the round's real boundary) —
|
|
1100
|
+
* a proposal declared on a round without an active contract is never
|
|
1101
|
+
* checked for conformance against work the round did not do under it.
|
|
1102
|
+
* v3.5.1: a fully-met posture (every done_when claimed satisfied) is owned
|
|
1103
|
+
* by contract_completion_unverified — this check stays for mixed and
|
|
1104
|
+
* silently-dropped success claims only.
|
|
1105
|
+
* v3.6: no_change_reason never downgrades this check — the escape hatch
|
|
1106
|
+
* belongs to the R8 success-claim family alone; a declared "no change"
|
|
1107
|
+
* contradicts silently dropping contract done_when items. */
|
|
1108
|
+
function checkPrematureBoundary(activeContract, selfEval, claimView) {
|
|
1109
|
+
if (!activeContract || activeContract.done_when.length === 0)
|
|
1110
|
+
return null;
|
|
1111
|
+
if (!effectiveSuccess(selfEval))
|
|
1112
|
+
return null;
|
|
1113
|
+
const ev = selfEval.execution_evidence;
|
|
1114
|
+
const met = ev?.success_criteria_met ?? [];
|
|
1115
|
+
// v3.5.1: full-met → the completion check owns the posture (it also fires
|
|
1116
|
+
// on success=false, so nothing is lost — and under machine_backed_success
|
|
1117
|
+
// "warn" the same tolerance applies on both sides).
|
|
1118
|
+
if (contractDoneWhenSatisfied(activeContract, met))
|
|
1119
|
+
return null;
|
|
1120
|
+
const remaining = ev?.success_criteria_remaining ?? [];
|
|
1121
|
+
const problems = [];
|
|
1122
|
+
for (const item of activeContract.done_when) {
|
|
1123
|
+
// Shared matcher with the lifecycle walker (round-contract.ts) — the
|
|
1124
|
+
// compile-side closure decision and this conformance check can never
|
|
1125
|
+
// disagree on what counts as a satisfied item.
|
|
1126
|
+
const isMet = met.some((m) => contractItemMatches(item, m));
|
|
1127
|
+
const isRemaining = remaining.some((r) => contractItemMatches(item, r));
|
|
1128
|
+
if (isMet) {
|
|
1129
|
+
// Claimed met — needs round-level machine verification. The v3.3
|
|
1130
|
+
// claim model is round-uniform: any verified claim backs the round,
|
|
1131
|
+
// so zero verified claims = none of them are backed.
|
|
1132
|
+
if (claimView.verifiedCount === 0) {
|
|
1133
|
+
problems.push(`"${item.slice(0, 80)}" claimed met without machine-verified evidence`);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
else if (!isRemaining) {
|
|
1137
|
+
// Neither met nor remaining — silently dropped while success is
|
|
1138
|
+
// claimed. Honest reporting would list it in remaining (R1's domain).
|
|
1139
|
+
problems.push(`"${item.slice(0, 80)}" neither met nor listed as remaining`);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
if (problems.length === 0)
|
|
1143
|
+
return null;
|
|
1144
|
+
return makeVerificationFlag({
|
|
1145
|
+
severity: "error",
|
|
1146
|
+
field: "round_contract",
|
|
1147
|
+
check: CHECK_PREMATURE_BOUNDARY,
|
|
1148
|
+
detail: `Round Contract boundary claimed prematurely: ${problems.slice(0, 3).join("; ")}. ` +
|
|
1149
|
+
`Run the contract's verification_plan commands and report real output, ` +
|
|
1150
|
+
`or set success=false and list the items in success_criteria_remaining.`,
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
/** v3.5: Closing a Round Contract is a success-class claim and must be
|
|
1154
|
+
* machine-backed. When the eval's met claims satisfy EVERY done_when of
|
|
1155
|
+
* the ACTIVE contract (the walker's close condition), each verification_plan
|
|
1156
|
+
* command must have been observed passing (after-phase command snapshot,
|
|
1157
|
+
* untampered) in the same round. Fires regardless of the success flag —
|
|
1158
|
+
* a claim-based closure that the machine cannot back must not advance the
|
|
1159
|
+
* contract state machine. Severity follows evidence.machine_backed_success
|
|
1160
|
+
* (the R8 tolerance switch). Deliberately no no_change_reason downgrade:
|
|
1161
|
+
* all done_when met contradicts "no change". Fail-open: a plan name that
|
|
1162
|
+
* is no longer a configured, enabled command cannot be observed and is
|
|
1163
|
+
* not required. The check observes that the commands ran, not what they
|
|
1164
|
+
* verified — R-C1's claim model remains the content bound. */
|
|
1165
|
+
function checkContractCompletionUnverified(activeContract, selfEval, evidenceSnapshots) {
|
|
1166
|
+
if (!activeContract || activeContract.verification_plan.length === 0)
|
|
1167
|
+
return null;
|
|
1168
|
+
const met = selfEval.execution_evidence?.success_criteria_met ?? [];
|
|
1169
|
+
if (!contractDoneWhenSatisfied(activeContract, met))
|
|
1170
|
+
return null; // walker does not close
|
|
1171
|
+
const required = activeContract.verification_plan
|
|
1172
|
+
.filter((name) => isConfiguredCommand(name));
|
|
1173
|
+
if (required.length === 0)
|
|
1174
|
+
return null; // fail open — cannot observe
|
|
1175
|
+
const passed = passedPlanCommandNames(evidenceSnapshots);
|
|
1176
|
+
const missing = required.filter((name) => !passed.has(name));
|
|
1177
|
+
if (missing.length === 0)
|
|
1178
|
+
return null;
|
|
1179
|
+
const severity = getPolicy().evidence.machine_backed_success === "warn"
|
|
1180
|
+
? "warn"
|
|
1181
|
+
: "error";
|
|
1182
|
+
return makeVerificationFlag({
|
|
1183
|
+
severity,
|
|
1184
|
+
field: "round_contract",
|
|
1185
|
+
check: CHECK_CONTRACT_COMPLETION_UNVERIFIED,
|
|
1186
|
+
detail: `Round Contract completion claimed (every done_when met), but verification_plan ` +
|
|
1187
|
+
`command${missing.length > 1 ? "s" : ""} did not pass this round: ` +
|
|
1188
|
+
`${missing.slice(0, 3).join(", ")}. Closing a contract is a success-class claim — ` +
|
|
1189
|
+
`fix the underlying failure so the command${missing.length > 1 ? "s" : ""} pass and ` +
|
|
1190
|
+
`resubmit; no_change_reason does not apply to completion claims.`,
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
/** v3.5: A different contract proposed while the ACTIVE contract is still
|
|
1194
|
+
* open. The walker ignores the premature proposal — this warn only makes
|
|
1195
|
+
* the ignored state visible to the agent. Silent when the eval closes the
|
|
1196
|
+
* active contract (all done_when met, or outcome=blocked — checked FIRST,
|
|
1197
|
+
* mirroring the walker), when no proposal is submitted, or when the
|
|
1198
|
+
* proposal equals the active contract (a restate). Equality is
|
|
1199
|
+
* key-order-insensitive and normalized through parseRoundContract on both
|
|
1200
|
+
* sides so committed-raw vs parsed-submission key-set drift cannot cause
|
|
1201
|
+
* spurious warns. */
|
|
1202
|
+
function checkContractPremature(activeContract, selfEval) {
|
|
1203
|
+
if (!activeContract)
|
|
1204
|
+
return null;
|
|
1205
|
+
const met = selfEval.execution_evidence?.success_criteria_met ?? [];
|
|
1206
|
+
if (contractDoneWhenSatisfied(activeContract, met))
|
|
1207
|
+
return null; // closed
|
|
1208
|
+
if (selfEval.outcome === "blocked")
|
|
1209
|
+
return null; // closed
|
|
1210
|
+
const proposal = selfEval.round_contract;
|
|
1211
|
+
if (!proposal)
|
|
1212
|
+
return null;
|
|
1213
|
+
const same = stableStringify(parseRoundContract(activeContract)) ===
|
|
1214
|
+
stableStringify(parseRoundContract(proposal));
|
|
1215
|
+
if (same)
|
|
1216
|
+
return null; // restate → continue
|
|
1217
|
+
return makeVerificationFlag({
|
|
1218
|
+
severity: "warn",
|
|
1219
|
+
field: "round_contract",
|
|
1220
|
+
check: CHECK_CONTRACT_PREMATURE,
|
|
1221
|
+
detail: "The ACTIVE Round Contract is still open (not all done_when met, not blocked) " +
|
|
1222
|
+
"while a different contract was proposed — it is ignored until the active " +
|
|
1223
|
+
"contract is completed or blocked. Restate the active contract unchanged to " +
|
|
1224
|
+
"continue it.",
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
884
1228
|
// Main entry point
|
|
885
1229
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
886
1230
|
/** Verify a SelfEvaluation against the loop's cross-round lineage.
|
|
887
1231
|
*
|
|
888
1232
|
* @param selfEval The agent's self-evaluation for the current round.
|
|
889
1233
|
* @param currentRound The current round number (1-based).
|
|
890
|
-
* @param vaultEntries Vault entries for this loop (
|
|
1234
|
+
* @param vaultEntries Vault entries for this loop (committed lineage
|
|
1235
|
+
* entries AND :feedback entries — the feedback
|
|
1236
|
+
* entries feed the ACTIVE-contract derivation).
|
|
891
1237
|
* @param prevSelfEval The agent's self-evaluation from the previous round
|
|
892
1238
|
* (null for round 1).
|
|
893
1239
|
* @param evidenceSnapshots v1.18: Evidence snapshots from configured providers.
|
|
@@ -910,24 +1256,34 @@ backtrackTargetGitHead) {
|
|
|
910
1256
|
for (const v of entryViolations(entry))
|
|
911
1257
|
olderViolations.push(v);
|
|
912
1258
|
}
|
|
1259
|
+
// v3.4: The ACTIVE contract this round executed under — derived from the
|
|
1260
|
+
// committed :feedback evals of earlier rounds. The submission's own
|
|
1261
|
+
// round_contract is a PROPOSAL for the next round and never participates
|
|
1262
|
+
// (the eval under verification is not yet committed, so it structurally
|
|
1263
|
+
// cannot influence the derivation).
|
|
1264
|
+
const activeContract = deriveActiveRoundContract(contractRoundEvaluations(committedRoundsFromEntries(vaultEntries, currentRound)));
|
|
913
1265
|
// v2.12: Derived claim provenance — which reported criteria completions
|
|
914
1266
|
// are backed by machine evidence (pure derivation, not persisted).
|
|
915
1267
|
const claimView = deriveClaimView(selfEval, evidenceSnapshots);
|
|
916
1268
|
// v3.2: Runtime machine-verification status (git observed / command passed /
|
|
917
|
-
// absent).
|
|
1269
|
+
// absent). v3.6: feeds the merged R8 check (providerStatus lens) that
|
|
1270
|
+
// never self-skips.
|
|
918
1271
|
const evidenceStatus = deriveEvidenceStatus(selfEval, evidenceSnapshots);
|
|
919
1272
|
// Run all checks
|
|
1273
|
+
// v3.3.1: a check may return several flags (checkRetroactiveClaims raises
|
|
1274
|
+
// one per offending claim) — the previous single-flag contract truncated
|
|
1275
|
+
// the list at the first problem, hiding every other bad retroactive claim
|
|
1276
|
+
// from the agent until the next round.
|
|
920
1277
|
const checks = [
|
|
921
1278
|
() => checkProgressRegression(selfEval, prevSelfEval),
|
|
922
1279
|
() => checkEmptyChangeWithPassing(selfEval),
|
|
923
1280
|
() => checkSuccessWithRemainingCriteria(selfEval),
|
|
924
|
-
// v2.12: success
|
|
925
|
-
(
|
|
926
|
-
|
|
927
|
-
() => checkSuccessUnverified(selfEval, evidenceStatus),
|
|
1281
|
+
// v2.12/v3.6: success without a machine-verified observation — the merged
|
|
1282
|
+
// success_unverified semantics (runtime providerStatus lens, tamper-aware)
|
|
1283
|
+
() => checkSuccessWithoutVerifiedEvidence(selfEval, evidenceStatus),
|
|
928
1284
|
// v2.12: criteria met but none machine-verified (mild criterion-specific rule)
|
|
929
1285
|
() => checkUnverifiedCriteriaClaims(selfEval, claimView),
|
|
930
|
-
//
|
|
1286
|
+
// Declared outcome vs the required core success flag.
|
|
931
1287
|
() => checkOutcomeConsistency(selfEval),
|
|
932
1288
|
// v2.12: retroactive claims against prior rounds
|
|
933
1289
|
() => checkRetroactiveClaims(selfEval, vaultEntries, currentRound),
|
|
@@ -939,6 +1295,9 @@ backtrackTargetGitHead) {
|
|
|
939
1295
|
() => checkRequiredCommandEvidence(selfEval, evidenceSnapshots),
|
|
940
1296
|
// v2.0: Cross-validate agent-reported test_results against command output
|
|
941
1297
|
() => checkCommandEvidenceIntegrity(selfEval, evidenceSnapshots),
|
|
1298
|
+
// v3.3: Verification domain integrity — command entrypoint / test files
|
|
1299
|
+
// changed in the same round the command ran
|
|
1300
|
+
() => checkVerificationDomainIntegrity(evidenceSnapshots),
|
|
942
1301
|
// v2.1: Detect intent-action drift — agent said X but did Y
|
|
943
1302
|
() => checkIntentDrift(selfEval, prevSelfEval, vaultEntries),
|
|
944
1303
|
// v2.2: Detect sub-goal drift — next_action doesn't align with pending sub-goals
|
|
@@ -947,11 +1306,24 @@ backtrackTargetGitHead) {
|
|
|
947
1306
|
() => checkBacktrackWorkspaceRestore(selfEval, backtrackSkippedFiles),
|
|
948
1307
|
// v2.12: Post-backtrack git HEAD restore check
|
|
949
1308
|
() => checkBacktrackGitHeadRestore(evidenceSnapshots, backtrackTargetGitHead),
|
|
1309
|
+
// v3.3: Round Contract checks. v3.4: split by target — structural
|
|
1310
|
+
// (warn) at proposal declaration, conformance against the derived
|
|
1311
|
+
// ACTIVE contract (scope_drift warn / premature_boundary error).
|
|
1312
|
+
// v3.5: + completion machine-backing (error) and premature-replacement
|
|
1313
|
+
// visibility (warn).
|
|
1314
|
+
() => checkRoundUnderspecified(selfEval),
|
|
1315
|
+
() => checkRoundUnverifiable(selfEval),
|
|
1316
|
+
() => checkRoundScopeDrift(activeContract, evidenceSnapshots),
|
|
1317
|
+
() => checkPrematureBoundary(activeContract, selfEval, claimView),
|
|
1318
|
+
() => checkContractCompletionUnverified(activeContract, selfEval, evidenceSnapshots),
|
|
1319
|
+
() => checkContractPremature(activeContract, selfEval),
|
|
950
1320
|
];
|
|
951
1321
|
for (const run of checks) {
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
954
|
-
flags.push(
|
|
1322
|
+
const result = run();
|
|
1323
|
+
if (Array.isArray(result))
|
|
1324
|
+
flags.push(...result);
|
|
1325
|
+
else if (result)
|
|
1326
|
+
flags.push(result);
|
|
955
1327
|
}
|
|
956
1328
|
// Determine verdict from the most severe flag present
|
|
957
1329
|
const hasError = flags.some((f) => f.severity === "error");
|