fix: register 6 detector gates + add adversarial-finding kind + watchdog log rotation

Three concrete fixes from open self-feedback assessment 2026-05-17:

- uok/gate-registry-bootstrap.js: register all 6 R081 detector gates
  (same-unit-loop, zero-progress, repeated-feedback-kind, artifact-flap,
  stale-lock, periodic-detector-sweep) alongside drift-detection and
  iter-completion-reconciler. Closes the gap reported by
  sf-mp9udspu-fsf7si — bootstrap previously registered 2 of 8 gates.

- self-feedback.js ALLOWED_KIND_DOMAINS: add `adversarial-finding`.
  Closes gap reported by sf-mp9u4i25-fczmcj — R075 (autonomous
  adversarial review) challenge unit had no kind to file findings under.

- sf-autonomous-watchdog.sh: delete watchdog-run-*.log files older than
  60 minutes at each cycle start. Without rotation .sf/ grew to 1.9 GB
  in 24h (today's snapshot). 60 min retention captures last cycle for
  post-incident triage; older state is already in DB + iterations.jsonl.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-17 16:08:05 +02:00
parent 077fd0a2a7
commit eeb80bbbdd
3 changed files with 30 additions and 0 deletions

View file

@ -36,6 +36,13 @@ while true; do
rm -f .sf/runtime/autonomous-solver/active.json 2>/dev/null
echo '{"ids":[],"dispatchedAt":null}' > .sf/runtime/self-feedback-inline-fix.json
# Log rotation: delete watchdog-run-*.log files older than 60 minutes.
# Without this, .sf/ grew to 1.9 GB in 24h (observed 2026-05-17 — each
# cycle's stderr is 100-300 MB and is rarely useful after the cycle
# completes). Keep the last hour for post-incident triage; older
# cycles' state is already reflected in DB + iterations.jsonl.
find .sf -maxdepth 1 -name "watchdog-run-*.log" -mmin +60 -delete 2>/dev/null || true
# #wiggums: pre-flight smoke test — `sf --version` must succeed before
# starting an autonomous cycle. If it fails, dist is broken (e.g.
# missing export, syntax error) and there's no point looping. Pause

View file

@ -485,6 +485,10 @@ const ALLOWED_KIND_DOMAINS = new Set([
"brittle-predicate",
"git-empty-pathspec",
"advisory-downgrade",
// adversarial-finding: R075 autonomous-adversarial-review domain. Without
// this, R075 challenge units have no kind to file their findings under
// (gap reported by sf-mp9u4i25-fczmcj on 2026-05-17).
"adversarial-finding",
]);
const KIND_SEGMENT_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;

View file

@ -1,6 +1,16 @@
import { driftDetectionGate } from "./drift-detection-gate.js";
import { iterCompletionReconcilerGate } from "../sf-db/iteration-completion-reconciler.js";
import { getGateRegistry } from "./gate-registry.js";
// R081 detector gates — all 6 retrofitted from the detector function exports.
// Wired here so they are routed through UokGateRegistry rather than imported
// as bare functions by auto/loop.js + uok/auto-runaway-guard.js (the latter
// still uses bare-function imports during the R081→R119 wiring transition).
import { sameUnitLoopGate } from "../detectors/same-unit-loop.js";
import { zeroProgressGate } from "../detectors/zero-progress.js";
import { repeatedFeedbackKindGate } from "../detectors/repeated-feedback-kind.js";
import { artifactFlapGate } from "../detectors/artifact-flap.js";
import { staleLockGate } from "../detectors/stale-lock.js";
import { periodicDetectorSweepGate } from "../detectors/periodic-runner.js";
/**
* gate-registry-bootstrap.js register ADR-0075 UOK gates that are liftable.
@ -22,5 +32,14 @@ const registry = getGateRegistry();
// SKIP planning-flow-gate: execute() closes over persistGate arguments from guided-flow.js.
registry.register(driftDetectionGate);
registry.register(iterCompletionReconcilerGate);
// R081 detector gates — 6 total. All ctx-driven (no host-file closure), so
// they register cleanly. Closes the gap reported by sf-mp9udspu-fsf7si
// ("UOK gate bootstrap registers only 2 of 6+ detector gates").
registry.register(sameUnitLoopGate);
registry.register(zeroProgressGate);
registry.register(repeatedFeedbackKindGate);
registry.register(artifactFlapGate);
registry.register(staleLockGate);
registry.register(periodicDetectorSweepGate);
export { registry as gateRegistry };