Files
ruflo/scripts
rUvandr 38112e0042 feat(mods): learning-loop gaming defences — taints, re-verify, anomaly gate (ADR-503) (#4590)
* feat(learning-loop): gaming defences for verified outcomes (ADR-503)

The verified-outcome loop (ADR-502) trusts a verifier's exit status, but the
model chooses what that verifier checks. Four downgrade-only layers:

- mod: a verified-success record carries taints when the turn edited a test
  file (edited-tests), a verifier config (edited-verifier-config), or decided
  on a weakened/narrowed command (narrowed-verifier); a per-process session
  token is written on every record. The outcome word never changes.
- CLI: a success with a taint not listed in .claude-flow/config.json
  learningLoop.allowTaint is counted under `tainted` and never reaches SONA.
- CLI: opt-in re-verify (learningLoop.reverify, off by default) re-runs a
  rotating allowlisted manifest check in a temp detached git worktree at HEAD
  with a timeout; failure, timeout or error downgrades to unknown. Only an
  explicit verified-ingest re-verifies; hot callers defer.
- CLI: anomaly gate holds would-be lessons that are perfect-and-tainted,
  only-narrowed, or from one session, listed as `held: <id> (<reason>)`.

Adds scripts/eval-learning-loop.mjs (manual, plan-only unless --run).

Co-Authored-By: RuFlo <ruv@ruv.net>

* docs(adr): ADR-503 status names PR #4590

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(learning-loop): shell edits of tests taint; test the real re-verify runner (ADR-503)

- A Bash command that writes, moves or deletes a test file or verifier
  config (rm, mv, cp, tee, truncate, sed -i/perl -i, output redirection,
  git rm/checkout/restore/...) now sets edited-tests /
  edited-verifier-config like an Edit of that file. Before this change,
  Edit src/a.ts + `sed -i 's/it(/it.skip(/' src/a.test.ts` + `npm test`
  produced an untainted verified-success. Downgrade-only: reads and test
  runs earn nothing.
- gitWorktreeRunner is now tested against a throwaway git repo: pass,
  fail, missing script, timeout (hung script's process verified dead),
  non-repo error. After each run only the main worktree remains and no
  ruflo-reverify-* dir is left. A negative control (kill only the direct
  child) makes the timeout test fail.
- ADR-503 implementation notes record both, plus the interpreter-write gap.

Co-Authored-By: RuFlo <ruv@ruv.net>

* test(learning-loop): give the hung-check re-verify test an 8s budget for cold CI runners

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(ruflo-mods): 0.9.0 for ADR-503

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-29 18:57:12 -04:00
..
2026-10-20 02:11:26 -04:00
2026-01-04 19:30:59 +00:00