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

fix(metaharness): 5 smoke contract failures (iter 124)

ruv0215e7b63342
diff --git a/plugins/ruflo-metaharness/scripts/mcp-scan.mjs b/plugins/ruflo-metaharness/scripts/mcp-scan.mjs
index 6dc3c84b2c..8ca1311f5a 100755
--- a/plugins/ruflo-metaharness/scripts/mcp-scan.mjs
+++ b/plugins/ruflo-metaharness/scripts/mcp-scan.mjs
@@ -53,13 +53,24 @@ function main() {
// diff actually works. If a future upstream version DOES emit
// findings[], the parsed-text findings are overridden.
const parsed = parseMcpScanText(r.stdout);
+ // iter 124 β€” normalize finding shape so consumers see a stable contract.
+ // Upstream [email protected] JSON path emits {id, severity, title, detail};
+ // our parseMcpScanText emits {severity, message}. Project both into a
+ // unified {severity, message, title?, detail?} so audit-trend's fingerprint
+ // diff and test-mcp-tools' assertions don't care which path produced them.
+ const rawFindings = Array.isArray(r.json?.findings) ? r.json.findings : parsed.findings;
+ const findings = rawFindings.map((f) => ({
+ ...f,
+ message: typeof f.message === 'string' && f.message
+ ? f.message
+ : (f.title || f.detail || ''),
+ }));
const payload = {
...(r.json ?? {}),
- findings: Array.isArray(r.json?.findings) ? r.json.findings : parsed.findings,
+ findings,
summary: r.json?.summary ?? parsed.summary,
rawStdout: r.stdout.slice(0, 400),
};
- const findings = payload.findings;
const threshold = SEVERITY_RANK[ARGS.failOn];
// iter 63 β€” rankSeverity() safe lookup. Pre-iter-63 `undefined >= 3`
// was false β†’ unknown-severity findings (e.g., warn / error) were
diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh
index d5d26ee48d..ce5e7222bd 100755
--- a/plugins/ruflo-metaharness/scripts/smoke.sh
+++ b/plugins/ruflo-metaharness/scripts/smoke.sh
@@ -1502,8 +1502,14 @@ grep -q "iter-51-marker" "$F" 2>/dev/null || miss="$miss no-jaccard-mutation"
grep -q "drift detected β€” verdict !== near-identical" "$F" 2>/dev/null || miss="$miss no-verdict-flip"
grep -q "drift detected β€” distance > 0" "$F" 2>/dev/null || miss="$miss no-distance-positive"
grep -q "drift alert at threshold" "$F" 2>/dev/null || miss="$miss no-drift-alert"
-# Runtime: 31/31 (was 25/25 pre-iter-51)
-node "$F" 2>&1 | grep -q "31 passed, 0 failed" || miss="$miss roundtrip-not-31"
+# Runtime: assertion count has grown as stages added (was 25β†’31→… β†’ 66 at
+# iter 79). Smoke gates on "0 failed" with a passed count β‰₯ 31, not the
+# specific number β€” keeps the gate from breaking every time a new stage
+# adds assertions.
+ROUNDTRIP_OUT=$(node "$F" 2>&1)
+echo "$ROUNDTRIP_OUT" | grep -qE "^[0-9]+ passed, 0 failed$" || miss="$miss roundtrip-has-failures"
+ROUNDTRIP_COUNT=$(echo "$ROUNDTRIP_OUT" | grep -oE "^[0-9]+ passed" | grep -oE "[0-9]+" | head -1)
+[[ "${ROUNDTRIP_COUNT:-0}" -ge 31 ]] || miss="$miss roundtrip-count-regressed:$ROUNDTRIP_COUNT"
[[ -z "$miss" ]] && ok || bad "$miss"
step "17z13. mcp-scan findings parsed from text β†’ audit-trend diff works (iter 50)"
@@ -1720,10 +1726,15 @@ node "$F" >/dev/null 2>&1 || miss="$miss unit-tests-fail"
step "17z. ADR-152 Β§3.1 deep integration β€” oia-audit fingerprint + audit-trend structuralDistance (iter 38)"
miss=""
-# oia-audit captures score + genome AND surfaces a fingerprint{score,genome}
+# oia-audit captures score + genome AND surfaces a fingerprint{score,genome}.
+# iter 56 refactored sequential runOne(...) β†’ parallel
+# runMetaharnessAsync(['score'/'genome', path]); accept either form so smoke
+# survives the refactor.
OIA="$ROOT/scripts/oia-audit.mjs"
-grep -q "score = runOne(\['score'" "$OIA" 2>/dev/null || miss="$miss no-score-capture"
-grep -q "genome = runOne(\['genome'" "$OIA" 2>/dev/null || miss="$miss no-genome-capture"
+grep -qE "score = runOne\\(\\['score'|runMetaharnessAsync\\(\\['score', path\\]\\)" "$OIA" 2>/dev/null \
+ || miss="$miss no-score-capture"
+grep -qE "genome = runOne\\(\\['genome'|runMetaharnessAsync\\(\\['genome', path\\]\\)" "$OIA" 2>/dev/null \
+ || miss="$miss no-genome-capture"
grep -q "fingerprint: {" "$OIA" 2>/dev/null || miss="$miss no-fingerprint-field"
# audit-trend imports the production similarity module and surfaces a verdict
AT="$ROOT/scripts/audit-trend.mjs"
@@ -2075,8 +2086,10 @@ F="$ROOT/scripts/audit-trend.mjs"
miss=""
[[ -x "$F" ]] || miss="$miss not-executable"
node --check "$F" 2>/dev/null || miss="$miss syntax-error"
-# Severity rank present + correct ordering
-grep -q "SEVERITY_RANK = { clean: 0, low: 1, medium: 2, high: 3 }" "$F" || miss="$miss no-severity-rank"
+# Severity rank present + correct ordering β€” iter 63 refactored to shared
+# SEVERITY_RANK from _harness.mjs; accept either the import OR the literal.
+grep -qE "SEVERITY_RANK.*from.*_harness|SEVERITY_RANK = \{ clean: 0, low: 1, medium: 2, high: 3 \}" "$F" \
+ || miss="$miss no-severity-rank"
# Both file-input AND memory-key-input paths
grep -q "baseline-key\|baselineKey" "$F" || miss="$miss no-mem-key-input"
grep -q "current-key\|currentKey" "$F" || miss="$miss no-current-key"
diff --git a/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs b/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
index 6badf0a17d..88690fcdbd 100755
--- a/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
+++ b/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
@@ -135,8 +135,11 @@ async function main() {
input = { dryRun: true, threshold: 0.5 };
}
- // 30s budget per tool by default; 90s for chain-tools like drift_from_history.
- const timeoutMs = tool.name === 'metaharness_drift_from_history' ? 90_000 : 30_000;
+ // iter 124 β€” bumped default 30s β†’ 60s. The first MCP tool that shells
+ // out via npx pays the cold-cache warmup cost (~25s observed), which
+ // pushed metaharness_audit_list past the prior 30s budget intermittently.
+ // 90s for chain-tools like drift_from_history that compose 3 subprocesses.
+ const timeoutMs = tool.name === 'metaharness_drift_from_history' ? 90_000 : 60_000;
const handlerPromise = tool.handler(input);
const timeoutPromise = new Promise((_, reject) =>
setTimeout(() => reject(new Error(`${timeoutMs / 1000}s handler timeout`)), timeoutMs));