π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(witness): fail marker-preserving hash drift in strict mode
Rudy Celekli0702af81584b
diff --git a/plugins/ruflo-core/scripts/witness/verify.mjs b/plugins/ruflo-core/scripts/witness/verify.mjsindex e0df1a51e2..5727a5edc4 100644--- a/plugins/ruflo-core/scripts/witness/verify.mjs+++ b/plugins/ruflo-core/scripts/witness/verify.mjs@@ -5,11 +5,12 @@* Project-agnostic β works without ruflo CLI being installed.** Usage:- * node verify.mjs --manifest <path> [--root <path>] [--source-only] [--json]+ * node verify.mjs --manifest <path> [--root <path>] [--source-only] [--json] [--strict]** Exit codes:- * 0 β signature valid + all fixes pass or drift (marker present)- * 1 β signature invalid OR any fix regressed/missing (real failure)+ * 0 β signature valid + all fixes pass or drift (marker present);+ * with --strict, all fixes must pass without drift+ * 1 β signature invalid OR any fix regressed/missing, or drift with --strict* 2 β bad arguments / file not found OR precondition not met* (e.g. dist files not built during full-tree verification).* Issue #1880: scheduled runners use this to distinguish a@@ -28,6 +29,10 @@ import {import { fileSha256, fileContains } from './lib.mjs';const args = parseArgs(process.argv.slice(2));+if (args.help) {+ console.log('Usage: node verify.mjs --manifest <path> [--root <path>] [--source-only] [--json] [--strict]');+ process.exit(0);+}if (!args.manifest) { console.error('--manifest <path> required'); process.exit(2); }const manifestPath = resolve(args.manifest);@@ -36,6 +41,7 @@ if (!existsSync(manifestPath)) { console.error(`not found: ${manifestPath}`); prconst repoRoot = resolve(args.root ?? process.cwd());const asJson = !!args.json;const sourceOnly = !!args['source-only'];+const strict = !!args.strict;const witness = JSON.parse(readFileSync(manifestPath, 'utf8'));@@ -114,7 +120,8 @@ if (!sourceOnly && ((allMissing && referencesDist) || (missingOnlyDist && summar}const ok = sig.signatureValid && sig.manifestHashOk && sig.publicKeyReproducible- && summary.regressed === 0 && summary.missing === 0;+ && summary.regressed === 0 && summary.missing === 0+ && (!strict || summary.drift === 0);if (asJson) {console.log(JSON.stringify(@@ -207,7 +214,7 @@ function parseArgs(argv) {const out = {};for (let i = 0; i < argv.length; i++) {const a = argv[i];- if (a === '--json' || a === '--help') { out[a.slice(2)] = true; continue; }+ if (a === '--json' || a === '--help' || a === '--strict') { out[a.slice(2)] = true; continue; }if (a.startsWith('--')) {const key = a.slice(2);const next = argv[i + 1];diff --git a/plugins/ruflo-core/skills/witness/SKILL.md b/plugins/ruflo-core/skills/witness/SKILL.mdindex 90884b0ca3..0db27c9699 100644--- a/plugins/ruflo-core/skills/witness/SKILL.md+++ b/plugins/ruflo-core/skills/witness/SKILL.md@@ -50,8 +50,15 @@ node plugins/ruflo-core/scripts/witness/verify.mjs \# Generated dist/ entries are explicitly reported as skipped.node plugins/ruflo-core/scripts/witness/verify.mjs \--manifest verification.md.json --source-only++# For a CI hash tripwire, also fail when a file changes but its marker remains.+node plugins/ruflo-core/scripts/witness/verify.mjs \+ --manifest verification.md.json --source-only --strict```+Without `--strict`, marker-preserving SHA drift is reported but exits 0.+`--strict` makes that drift exit 1 without changing signature or missing-file checks.+## Temporal queries (ADR-103)```bashdiff --git a/scripts/smoke-witness-verify-precondition.mjs b/scripts/smoke-witness-verify-precondition.mjsindex bb2a208e3e..5457235b14 100644--- a/scripts/smoke-witness-verify-precondition.mjs+++ b/scripts/smoke-witness-verify-precondition.mjs@@ -6,7 +6,8 @@* 1. cryptographically verify a signed manifest without node_modules;* 2. validate every source marker while explicitly skipping generated dist/;* 3. reject a tampered signature and a regressed source marker; and- * 4. retain exit 2 for legacy full-tree checks when dist has not been built.+ * 4. preserve advisory drift by default but fail it with --strict; and+ * 5. retain exit 2 for legacy full-tree checks when dist has not been built.*/import { spawnSync } from 'node:child_process';@@ -94,6 +95,12 @@ try {&& sourceResult?.signature?.publicKeyReproducible === true,`signature=${JSON.stringify(sourceResult?.signature)}`,);+ const strictClean = run(tmp, REAL_MANIFEST, '--source-only', '--strict');+ record(+ '--strict accepts an unchanged source tree',+ strictClean.status === 0 && parseOutput(strictClean)?.summary?.drift === 0,+ `exit=${strictClean.status}, output=${strictClean.stdout.slice(0, 300)}`,+ );console.log('\nCase 2: signature tampering fails closed');const tampered = structuredClone(witness);@@ -108,13 +115,33 @@ try {`exit=${badSignature.status}, output=${badSignature.stdout.slice(0, 300)}`,);- console.log('\nCase 3: source marker regression fails closed');+ console.log('\nCase 3: --strict fails SHA drift without changing default behavior');const markerFix = sourceFixes.find((fix) => existsSync(resolve(tmp, fix.file)));if (!markerFix) {record('manifest has a locally present source entry', false);} else {const markerPath = resolve(tmp, markerFix.file);const source = readFileSync(markerPath, 'utf8');+ writeFileSync(markerPath, `${source}\n`);+ const advisoryDrift = run(tmp, REAL_MANIFEST, '--source-only');+ const strictDrift = run(tmp, REAL_MANIFEST, '--source-only', '--strict');+ const advisoryResult = parseOutput(advisoryDrift);+ const strictResult = parseOutput(strictDrift);+ record(+ 'marker-preserving SHA drift still exits 0 by default',+ advisoryDrift.status === 0 && advisoryResult?.ok === true+ && advisoryResult?.summary?.drift >= 1,+ `exit=${advisoryDrift.status}, summary=${JSON.stringify(advisoryResult?.summary)}`,+ );+ record(+ '--strict exits 1 and reports the same drift',+ strictDrift.status === 1 && strictResult?.ok === false+ && strictResult?.summary?.drift === advisoryResult?.summary?.drift,+ `exit=${strictDrift.status}, summary=${JSON.stringify(strictResult?.summary)}`,+ );+ writeFileSync(markerPath, source);++ console.log('\nCase 4: source marker regression fails closed');writeFileSync(markerPath, source.replace(markerFix.marker, 'ruflo-regressed-marker'));const regression = run(tmp, REAL_MANIFEST, '--source-only');const result = parseOutput(regression);@@ -126,7 +153,7 @@ try {writeFileSync(markerPath, source);}- console.log('\nCase 4: legacy full-tree verification retains precondition exit');+ console.log('\nCase 5: legacy full-tree verification retains precondition exit');const full = run(tmp);const fullResult = parseOutput(full);record(@@ -134,6 +161,12 @@ try {full.status === 2 && fullResult?.precondition === 'dist-not-built',`exit=${full.status}, output=${(full.stdout + full.stderr).slice(0, 300)}`,);+ const help = spawnSync(process.execPath, [VERIFY, '--help'], { encoding: 'utf8' });+ record(+ '--help prints usage without requiring a manifest',+ help.status === 0 && help.stdout.includes('--strict'),+ `exit=${help.status}, output=${(help.stdout + help.stderr).slice(0, 300)}`,+ );} finally {rmSync(tmp, { recursive: true, force: true });}