Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

feat(metaharness): weekly cron uses iter-78 alert-on-new-severity (iter 79)

ruvf7383595e710
diff --git a/.github/workflows/oia-audit-weekly.yml b/.github/workflows/oia-audit-weekly.yml
index 648e038d8e..c9ceea5080 100644
--- a/.github/workflows/oia-audit-weekly.yml
+++ b/.github/workflows/oia-audit-weekly.yml
@@ -112,10 +112,14 @@ jobs:
run: |
set -e
# iter-67 fastest path: --baseline-file skips audit-list + memory roundtrip
+ # iter 79 β€” also gate on new HIGH-severity findings. Catches the
+ # case where structure stayed similar but a security regression
+ # appeared (e.g., new mcp-scan HIGH finding). Either gate can fire.
node plugins/ruflo-metaharness/scripts/drift-from-history.mjs \
--baseline-file /tmp/prior/oia-audit.json \
--dry-run \
--threshold 0.85 \
+ --alert-on-new-severity high \
--format json \
> /tmp/drift-trend.json || true
# Extract verdict for the workflow summary
diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh
index 0c2f82c1e9..7ae5588bfc 100755
--- a/plugins/ruflo-metaharness/scripts/smoke.sh
+++ b/plugins/ruflo-metaharness/scripts/smoke.sh
@@ -191,6 +191,22 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \
grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough"
[[ -z "$miss" ]] && ok || bad "$miss"
+step "17z42. weekly cron uses --alert-on-new-severity + Stage 12 verifies (iter 79)"
+miss=""
+# Weekly cron wires the gate
+W="$ROOT/../../.github/workflows/oia-audit-weekly.yml"
+grep -q -- "--alert-on-new-severity high" "$W" 2>/dev/null || miss="$miss no-cron-wired"
+# Roundtrip Stage 12 added
+F="$ROOT/scripts/test-pipeline-roundtrip.mjs"
+grep -q "Stage 12 β€” --alert-on-new-severity orthogonal gate" "$F" 2>/dev/null || miss="$miss no-stage-12"
+grep -q "Stage 12: --alert-on-new-severity info triggers" "$F" 2>/dev/null || miss="$miss no-trigger-assert"
+grep -q "Stage 12: reasons mention new-finding severity" "$F" 2>/dev/null || miss="$miss no-reason-assert"
+grep -q "Stage 12: elevatedFindings non-empty" "$F" 2>/dev/null || miss="$miss no-elevated-assert"
+grep -q "Stage 12: alert.newSeverityThreshold echoed" "$F" 2>/dev/null || miss="$miss no-threshold-echo"
+# Runtime: roundtrip passes (β‰₯66)
+node "$F" 2>&1 | grep -qE "(6[6-9]|[7-9][0-9]+) passed, 0 failed" || miss="$miss roundtrip-fewer-than-66"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
step "17z41. drift-from-history --alert-on-new-severity gate (iter 78)"
miss=""
F="$ROOT/scripts/drift-from-history.mjs"
diff --git a/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs b/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs
index 37b3a44d6e..f07cd34694 100755
--- a/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs
+++ b/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs
@@ -522,6 +522,53 @@ try {
assert(trend11c.delta?.findings?.clearedCount === 0,
`Stage 11c: identical findings β†’ clearedCount === 0`);
+ // ──────────────────────────────────────────────────────────────
+ // STAGE 12 (iter 79) β€” --alert-on-new-severity orthogonal gate
+ //
+ // Iter 78 added the gate. Iter 79 wires it into the weekly cron.
+ // This stage verifies the gate fires correctly through the
+ // drift-from-history wrapper:
+ // - baseline has no findings + current has 1 medium finding
+ // - --threshold 0.5 (similarity stays above)
+ // - --alert-on-new-severity medium should trigger
+ //
+ // Catches the "structural similarity high but new security
+ // finding" case that iter-78 closed.
+ // ──────────────────────────────────────────────────────────────
+ console.log('\nStage 12 β€” --alert-on-new-severity orthogonal gate (iter 79)');
+
+ // Re-use baseClean (no findings) from Stage 11
+ // Run drift-from-history with --alert-on-new-severity info
+ // (real ruflo audit has 1 INFO finding β†’ introduced=1)
+ const stage12Run = runNode('drift-from-history.mjs', [
+ '--baseline-file', baseCleanPath,
+ '--dry-run',
+ '--threshold', '0.5',
+ '--alert-on-new-severity', 'info',
+ '--format', 'json',
+ ], 120_000);
+ const m12 = /\{[\s\S]*\}/.exec(stage12Run.stdout);
+ assert(m12 !== null, 'Stage 12: drift-from-history produced JSON');
+ const stage12 = JSON.parse(m12[0]);
+
+ // The orthogonal gate fires
+ assert(stage12.alert?.triggered === true,
+ 'Stage 12: --alert-on-new-severity info triggers on ruflo current INFO finding');
+ // Reason mentions severity, not similarity (structural is fine at threshold 0.5)
+ const reasons = stage12.alert?.reasons ?? [];
+ const hasSeverityReason = reasons.some((r) => /finding\(s\) at or above/.test(r));
+ assert(hasSeverityReason,
+ `Stage 12: reasons mention new-finding severity (got ${JSON.stringify(reasons)})`);
+ // elevatedFindings populated
+ assert(Array.isArray(stage12.alert?.elevatedFindings) && stage12.alert.elevatedFindings.length >= 1,
+ `Stage 12: elevatedFindings non-empty (got ${stage12.alert?.elevatedFindings?.length})`);
+ // CLI exit reflects the alert
+ assert(stage12Run.status === 1,
+ `Stage 12: drift-from-history exit=1 on severity alert (got ${stage12Run.status})`);
+ // newSeverityThreshold echoed in payload
+ assert(stage12.alert?.newSeverityThreshold === 'info',
+ 'Stage 12: alert.newSeverityThreshold echoed');
+
} finally {
try { rmSync(tmp, { recursive: true, force: true }); } catch { /* ignore */ }
}