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): weekly cron computes structural drift vs prior week (iter 69)

ruv1a18c190eccc
diff --git a/.github/workflows/oia-audit-weekly.yml b/.github/workflows/oia-audit-weekly.yml
index 651da7ce20..73a2dd040d 100644
--- a/.github/workflows/oia-audit-weekly.yml
+++ b/.github/workflows/oia-audit-weekly.yml
@@ -66,3 +66,72 @@ jobs:
name: oia-audit-${{ github.run_id }}
path: /tmp/oia-audit.json
retention-days: 90
+
+ # iter 69 — close the loop: the weekly cron has always claimed
+ # "Accumulated artifacts enable drift detection over time" (line 13)
+ # but the diff step was never wired. Iter-67's --baseline-file
+ # fastpath made it cheap (~1.4s). Now every Sunday's run diffs
+ # against the most recent prior weekly artifact and surfaces the
+ # structural distance + alert.
+ - name: Download prior week's audit artifact (if any)
+ id: prior-artifact
+ continue-on-error: true
+ run: |
+ set +e
+ # List recent successful runs of this workflow, pick the most
+ # recent one BEFORE this run, then download its artifact.
+ PREV_RUN=$(gh run list \
+ --workflow=oia-audit-weekly.yml \
+ --status=success \
+ --limit=10 \
+ --json databaseId,headSha \
+ --jq ".[] | select(.databaseId != ${{ github.run_id }}) | .databaseId" \
+ | head -1)
+ if [ -z "$PREV_RUN" ]; then
+ echo "No prior successful run found — first weekly audit. Skipping drift step."
+ echo "has_prior=false" >> $GITHUB_OUTPUT
+ exit 0
+ fi
+ echo "Downloading prior audit from run $PREV_RUN..."
+ gh run download "$PREV_RUN" \
+ --name "oia-audit-${PREV_RUN}" \
+ --dir /tmp/prior \
+ && echo "has_prior=true" >> $GITHUB_OUTPUT \
+ && ls -la /tmp/prior/
+ env:
+ GH_TOKEN: ${{ github.token }}
+
+ - name: Compute structural drift vs prior week (iter 69)
+ if: steps.prior-artifact.outputs.has_prior == 'true'
+ run: |
+ set -e
+ # iter-67 fastest path: --baseline-file skips audit-list + memory roundtrip
+ node plugins/ruflo-metaharness/scripts/drift-from-history.mjs \
+ --baseline-file /tmp/prior/oia-audit.json \
+ --dry-run \
+ --threshold 0.85 \
+ --format json \
+ > /tmp/drift-trend.json || true
+ # Extract verdict for the workflow summary
+ VERDICT=$(node -e "
+ const j = JSON.parse(require('fs').readFileSync('/tmp/drift-trend.json'));
+ console.log(j.drift?.structuralDistance?.verdict || 'unavailable');
+ ")
+ OVERALL=$(node -e "
+ const j = JSON.parse(require('fs').readFileSync('/tmp/drift-trend.json'));
+ console.log(j.drift?.structuralDistance?.overall ?? 'n/a');
+ ")
+ ALERT=$(node -e "
+ const j = JSON.parse(require('fs').readFileSync('/tmp/drift-trend.json'));
+ console.log(j.alert?.triggered ? 'TRIGGERED' : 'OK');
+ ")
+ echo "## Drift vs prior week: \`$VERDICT\` (similarity=$OVERALL)" >> $GITHUB_STEP_SUMMARY
+ echo "Alert status: \`$ALERT\`" >> $GITHUB_STEP_SUMMARY
+
+ - name: Upload drift trend artifact
+ if: steps.prior-artifact.outputs.has_prior == 'true'
+ uses: actions/upload-artifact@v4
+ with:
+ name: drift-trend-${{ github.run_id }}
+ path: /tmp/drift-trend.json
+ retention-days: 90
diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh
index 45d307076f..f915a807d5 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 "17z32. weekly cron computes drift vs prior artifact (iter 69)"
+miss=""
+F="$ROOT/../../.github/workflows/oia-audit-weekly.yml"
+# New drift-detection steps present
+grep -q "Download prior week's audit artifact" "$F" 2>/dev/null || miss="$miss no-download-step"
+grep -q "Compute structural drift vs prior week" "$F" 2>/dev/null || miss="$miss no-drift-step"
+grep -q "Upload drift trend artifact" "$F" 2>/dev/null || miss="$miss no-trend-upload"
+# Uses iter-67 fastest path
+grep -q "drift-from-history.mjs" "$F" 2>/dev/null || miss="$miss no-drift-script"
+grep -q -- "--baseline-file" "$F" 2>/dev/null || miss="$miss no-baseline-file-arg"
+# Has prior-artifact step output
+grep -q "has_prior=true\|has_prior=false" "$F" 2>/dev/null || miss="$miss no-conditional-output"
+# Summary line for visibility
+grep -q "Drift vs prior week" "$F" 2>/dev/null || miss="$miss no-summary-line"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
step "17z31. roundtrip Stage 8 — drift-from-history end-to-end (iter 68)"
miss=""
F="$ROOT/scripts/test-pipeline-roundtrip.mjs"