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

ci(metaharness): promote bench-recordpair-overhead to a CI regression gate (iter 25)

ruv853586bfe592
diff --git a/.github/workflows/metaharness-ci.yml b/.github/workflows/metaharness-ci.yml
index accc79a0a2..704e71426e 100644
--- a/.github/workflows/metaharness-ci.yml
+++ b/.github/workflows/metaharness-ci.yml
@@ -142,6 +142,33 @@ jobs:
cd ../../..
node plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
+ - name: Regression gate β€” iter-12 dispatch overhead < 500ns (iter 24/25)
+ # Micro-benchmark proving the iter-12 "zero default-path overhead"
+ # claim with measured numbers. Threshold 500ns chosen as ~3.5x
+ # headroom over the iter-24 baseline of ~147ns on Apple Silicon
+ # /Node 22. Fails the PR if someone accidentally inflates the
+ # route() hot path on the default path.
+ run: |
+ node plugins/ruflo-metaharness/scripts/bench-recordpair-overhead.mjs \
+ --max-overhead-ns 500 --format json > /tmp/bench-overhead.json
+ # Pretty-print the verdict
+ node -e "
+ const r = JSON.parse(require('fs').readFileSync('/tmp/bench-overhead.json'));
+ const baseline = r.results.find(x => x.label.startsWith('baseline'));
+ const env = r.results.find(x => x.label.includes('FLAG OFF'));
+ const overhead = env.meanNsPerCall - baseline.meanNsPerCall;
+ console.log('Measured overhead:', Math.round(overhead) + 'ns per route() call');
+ console.log('Threshold: 500ns. Headroom: ' + Math.round(500 - overhead) + 'ns');
+ "
+
+ - name: Upload benchmark artifact (90-day retention for trend tracking)
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: metaharness-bench-overhead-${{ github.run_id }}
+ path: /tmp/bench-overhead.json
+ retention-days: 90
+
eject-dryrun:
# ADR-150 Phase 2 β€” verify `ruflo eject` dry-run produces a valid
# plan against the ruflo repo itself, AND that the safety gate
diff --git a/plugins/ruflo-metaharness/scripts/bench-recordpair-overhead.mjs b/plugins/ruflo-metaharness/scripts/bench-recordpair-overhead.mjs
index 7d41c322b4..1f029d56f9 100755
--- a/plugins/ruflo-metaharness/scripts/bench-recordpair-overhead.mjs
+++ b/plugins/ruflo-metaharness/scripts/bench-recordpair-overhead.mjs
@@ -24,11 +24,21 @@
import { performance } from 'node:perf_hooks';
const ARGS = (() => {
- const a = { iters: 1_000_000, format: 'table' };
+ const a = {
+ iters: 1_000_000,
+ format: 'table',
+ // iter 25 β€” CI regression gate. When --max-overhead-ns N is set,
+ // exit 1 if the measured iter-12 default-path overhead exceeds N
+ // nanoseconds per call. Default threshold 500ns chosen as ~3.5Γ—
+ // headroom over the iter-24 measured baseline of ~147ns on Apple
+ // Silicon / Node 22.
+ maxOverheadNs: null,
+ };
for (let i = 2; i < process.argv.length; i++) {
const v = process.argv[i];
if (v === '--iters') a.iters = parseInt(process.argv[++i], 10);
else if (v === '--format') a.format = process.argv[++i];
+ else if (v === '--max-overhead-ns') a.maxOverheadNs = parseFloat(process.argv[++i]);
}
return a;
})();
@@ -149,6 +159,23 @@ function main() {
} else {
console.log(`⚠ Overhead ${Math.round(overhead)}ns is higher than expected; investigate engine optimization.`);
}
+
+ // CI regression gate (iter 25).
+ if (ARGS.maxOverheadNs !== null) {
+ if (!isFinite(ARGS.maxOverheadNs) || ARGS.maxOverheadNs <= 0) {
+ console.error('bench-recordpair-overhead: --max-overhead-ns must be a positive number');
+ process.exit(2);
+ }
+ console.log('');
+ if (overhead > ARGS.maxOverheadNs) {
+ console.log(`⚠ **REGRESSION**: measured ${Math.round(overhead)}ns > threshold ${ARGS.maxOverheadNs}ns`);
+ console.log(` The iter-12 dispatch wiring may have grown beyond the env-flag check.`);
+ console.log(` Inspect v3/@claude-flow/cli/src/ruvector/model-router.ts route() for new work in the default path.`);
+ process.exit(1);
+ } else {
+ console.log(`βœ“ Within regression threshold (${Math.round(overhead)}ns ≀ ${ARGS.maxOverheadNs}ns).`);
+ }
+ }
}
main();
diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh
index d53c8257bf..40e2d00ec0 100755
--- a/plugins/ruflo-metaharness/scripts/smoke.sh
+++ b/plugins/ruflo-metaharness/scripts/smoke.sh
@@ -170,7 +170,7 @@ if (!od.metaharness) { console.error('missing metaharness in optionalDependencie
if (j.dependencies && j.dependencies.metaharness) { console.error('metaharness leaked into dependencies'); process.exit(1); }
" 2>/dev/null && ok || bad "ruflo wrapper missing metaharness optionalDep"
-step "17p. bench-recordpair-overhead β€” measures iter-12 default-path cost (iter 24)"
+step "17p. bench-recordpair-overhead β€” measures + gates iter-12 default-path cost (iter 24/25)"
F="$ROOT/scripts/bench-recordpair-overhead.mjs"
miss=""
[[ -x "$F" ]] || miss="$miss not-executable"
@@ -184,6 +184,13 @@ grep -q "FLAG ON" "$F" || miss="$miss no-on-variant"
grep -q "performance.now" "$F" || miss="$miss no-perf-now"
# Reports per-call overhead in nanoseconds (the meaningful unit)
grep -q "meanNsPerCall\|ns per route" "$F" || miss="$miss no-ns-reporting"
+# iter 25 β€” CI regression gate (exits 1 above threshold)
+grep -q "max-overhead-ns" "$F" || miss="$miss no-gate-flag"
+grep -q "REGRESSION" "$F" || miss="$miss no-regression-message"
+grep -q "process.exit(1)" "$F" || miss="$miss no-fail-closed"
+# Wired into the CI workflow with a 500ns threshold
+CI="$ROOT/../../.github/workflows/metaharness-ci.yml"
+grep -q "max-overhead-ns 500" "$CI" 2>/dev/null || miss="$miss not-wired-to-ci"
[[ -z "$miss" ]] && ok || bad "$miss"
step "17o. test-mcp-tools runtime contract test (ADR-150 β€” iter 23)"