From eeb80bbbddbcce9c4845495671d8ad1731621e40 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Sun, 17 May 2026 16:08:05 +0200 Subject: [PATCH] fix: register 6 detector gates + add adversarial-finding kind + watchdog log rotation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- scripts/sf-autonomous-watchdog.sh | 7 +++++++ src/resources/extensions/sf/self-feedback.js | 4 ++++ .../sf/uok/gate-registry-bootstrap.js | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/scripts/sf-autonomous-watchdog.sh b/scripts/sf-autonomous-watchdog.sh index 44fdd1ef1..50396f779 100755 --- a/scripts/sf-autonomous-watchdog.sh +++ b/scripts/sf-autonomous-watchdog.sh @@ -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 diff --git a/src/resources/extensions/sf/self-feedback.js b/src/resources/extensions/sf/self-feedback.js index e828d147b..dac6b314a 100644 --- a/src/resources/extensions/sf/self-feedback.js +++ b/src/resources/extensions/sf/self-feedback.js @@ -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]+)*$/; diff --git a/src/resources/extensions/sf/uok/gate-registry-bootstrap.js b/src/resources/extensions/sf/uok/gate-registry-bootstrap.js index 9e58ef75d..8502567da 100644 --- a/src/resources/extensions/sf/uok/gate-registry-bootstrap.js +++ b/src/resources/extensions/sf/uok/gate-registry-bootstrap.js @@ -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 };