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): dispatcher propagates flags to subprocess (iter 42)

ruv2eac7904297c
diff --git a/.github/workflows/metaharness-ci.yml b/.github/workflows/metaharness-ci.yml
index 6595ec8591..97ccfe5a26 100644
--- a/.github/workflows/metaharness-ci.yml
+++ b/.github/workflows/metaharness-ci.yml
@@ -284,3 +284,39 @@ jobs:
echo "✓ structural-distance alert correctly exited non-zero (got $?)"
fi
+ - name: Performance gate — sub-10μs mean per similarity() call (iter 41)
+ # CI runners are slower than Apple-Silicon baseline (~0.4μs); 10μs
+ # ceiling gives ~25× headroom while still catching ~10× regressions.
+ # 100k iters keeps the job fast (~50ms total work).
+ run: |
+ node plugins/ruflo-metaharness/scripts/bench-similarity.mjs \
+ --iters 100000 \
+ --max-mean-us 10
+
+ - name: Build CLI dist (for dispatcher round-trip)
+ run: |
+ cd v3/@claude-flow/cli
+ npm install --no-audit --no-fund --ignore-scripts --silent
+ npm run build
+
+ - name: CLI dispatcher round-trip — `node bin/cli.js metaharness similarity` (iter 36)
+ # Proves the iter-36 SUBCOMMANDS entry actually dispatches at the
+ # CLI surface, not just at the script. Closes the gap between
+ # "the script works in isolation" and "the user-facing command works".
+ run: |
+ set -e
+ OUT=$(node v3/@claude-flow/cli/bin/cli.js metaharness similarity \
+ --a /tmp/a.json --b /tmp/b.json --format json)
+ echo "$OUT" | head -20
+ echo "$OUT" | grep -q '"overall"' || { echo "FAIL: dispatcher did not emit overall"; exit 1; }
+ echo "$OUT" | grep -q '"adr": "ADR-152"' || { echo "FAIL: dispatcher output missing ADR tag"; exit 1; }
+ echo "✓ CLI dispatcher round-trip green"
+
+ - name: CLI help lists similarity subcommand
+ # Anti-regression on the help text (iter 36 added this line).
+ run: |
+ set -e
+ OUT=$(node v3/@claude-flow/cli/bin/cli.js metaharness 2>&1 || true)
+ echo "$OUT" | grep -q "similarity" || { echo "FAIL: help text dropped similarity"; exit 1; }
+ echo "✓ help text references similarity subcommand"
+
diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh
index c9f7b7c3a3..4488e9e747 100755
--- a/plugins/ruflo-metaharness/scripts/smoke.sh
+++ b/plugins/ruflo-metaharness/scripts/smoke.sh
@@ -191,6 +191,19 @@ 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 "17z5. CLI dispatcher round-trips flags (iter 42 — fixes existing bug)"
+miss=""
+DISP="$ROOT/../../v3/@claude-flow/cli/src/commands/metaharness.ts"
+# Reconstruction logic literal markers (anti-deletion)
+grep -q "reconstructedFlags" "$DISP" 2>/dev/null || miss="$miss no-reconstruction"
+grep -q "ctxFlags" "$DISP" 2>/dev/null || miss="$miss no-ctx-flags-read"
+grep -q "toKebab" "$DISP" 2>/dev/null || miss="$miss no-kebab-helper"
+# SKIP_KEYS list documents which flags don't propagate
+grep -q "SKIP_KEYS" "$DISP" 2>/dev/null || miss="$miss no-skip-set"
+# Comment explains the fix
+grep -q "iter 42" "$DISP" 2>/dev/null || miss="$miss no-iter42-marker"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
step "17z4. bench-similarity.mjs — perf characterization + regression gate (iter 41)"
F="$ROOT/scripts/bench-similarity.mjs"
miss=""
diff --git a/v3/@claude-flow/cli/src/commands/metaharness.ts b/v3/@claude-flow/cli/src/commands/metaharness.ts
index e8add5ab19..8a8326aa8d 100644
--- a/v3/@claude-flow/cli/src/commands/metaharness.ts
+++ b/v3/@claude-flow/cli/src/commands/metaharness.ts
@@ -117,7 +117,43 @@ export const metaharnessCommand: Command = {
async action(context: CommandContext): Promise<CommandResult> {
const args = (context as { args?: string[] }).args || [];
const subcommand = args[0];
- const subArgs = args.slice(1);
+ const positionalRest = args.slice(1);
+
+ // iter 42 — round-trip parsed flags back into argv so the
+ // subprocess receives them. Without this the CLI parser consumes
+ // `--a foo` into `flags.a` and the script sees an empty argv,
+ // emitting a graceful-but-wrong "missing arg" payload (the iter-36
+ // bug surfaced during iter-42 dispatcher round-trip testing).
+ const ctxFlags = (context as { flags?: Record<string, unknown> }).flags || {};
+ const reconstructedFlags: string[] = [];
+ const SKIP_KEYS = new Set([
+ '_', // parser's positional bucket
+ 'config', // global CLI flag (--config <path>); consumed before dispatch
+ 'verbose', 'v',
+ 'quiet', 'q',
+ 'help', 'h',
+ ]);
+ // Parser normalizes kebab-case → camelCase (--per-dimension → perDimension).
+ // Plugin scripts expect kebab-case at argv, so we re-kebab here.
+ const toKebab = (s: string): string =>
+ s.replace(/([A-Z])/g, (m) => `-${m.toLowerCase()}`);
+ for (const [key, value] of Object.entries(ctxFlags)) {
+ if (SKIP_KEYS.has(key)) continue;
+ if (value === undefined || value === null) continue;
+ // Always use --kebab even for single-char keys: similarity.mjs
+ // matches literal `--a` / `--b` via argv loop, not via a parser.
+ // Reconstructing as short-form (`-a`) would silently misroute.
+ const flag = `--${toKebab(key)}`;
+ if (typeof value === 'boolean') {
+ if (value === true) reconstructedFlags.push(flag);
+ // false → omit (--no-X handled by users invoking explicit --no- form)
+ } else if (Array.isArray(value)) {
+ for (const v of value) reconstructedFlags.push(flag, String(v));
+ } else {
+ reconstructedFlags.push(flag, String(value));
+ }
+ }
+ const subArgs = [...positionalRest, ...reconstructedFlags];
if (!subcommand || subcommand === 'help' || subcommand === '--help' || subcommand === '-h') {
output.writeln(output.bold('npx ruflo metaharness <subcommand> [options]'));