Files
boshu2__agentops/scripts/check-compile-oscillation.sh
T
Boden Fuller e458cfa7a8 fix(cli): remove remaining --oscillation-sweep callsites missed by soc-1q1x
Cycle 181's dead-code sweep removed the `--oscillation-sweep` flag from
`ao defrag` but only audited Go callers — it missed 7 shell/yaml/doc
callsites. CI caught it: `validate-flywheel-proof` failed on
`scripts/proof-run.sh` Phase 6 with "Error: unknown flag:
--oscillation-sweep" (the nightly dream-cycle proof shells `ao defrag
--oscillation-sweep`).

Functional fixes (these errored at runtime):
- .github/workflows/nightly.yml — knowledge-cycle defrag step
- scripts/nightly-dream-cycle.sh — dream-cycle defrag invocation

Stale-string fix:
- scripts/check-compile-oscillation.sh — error message referenced the
  removed flag (the jq check itself still works via `// []` default)

Doc references updated:
- docs/contracts/dream-run-contract.md
- skills/compile/references/phases.md
- skills-codex/compile/SKILL.md + references/phases.md (codex hashes regen)

Verified: `ao defrag --prune --dedup` exits 0. The
`skills/validation/references/*` mentions of `--oscillation-sweep` are
intentionally kept — they describe the removal as the origin story of
the new release-readiness gate.

Root cause: the cycle-181 commit message claimed "all callers" but the
audit was Go-only. The CI `validate-flywheel-proof` gate is what should
have caught this pre-merge — and would have, if the full pre-push gate's
flywheel-proof check had exercised the nightly dream path. Follow-up:
the dead-code-sweep checklist should grep scripts/, .github/, and docs/
for removed CLI surface, not just source-language callers.
2026-05-15 07:21:34 -04:00

41 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# check-compile-oscillation.sh — Gate: No evolve goals are oscillating in the
# most recent defrag report.
#
# Exit 0 = PASS, Exit 1 = FAIL
#
# Looks at .agents/defrag/latest.json first. When missing and COMPILE_OUTPUT_DIR
# is unset, falls back to the freshest Dream overnight preview at
# .agents/overnight/<run>/defrag/latest.json (same shape). This keeps the gate
# green on machines that have run Dream but not a manual `ao defrag`.
set -euo pipefail
AGENTS_DIR="${AGENTS_DIR:-.agents}"
DEFRAG_LATEST="${COMPILE_OUTPUT_DIR:-$AGENTS_DIR}/defrag/latest.json"
if [[ ! -f "$DEFRAG_LATEST" && -z "${COMPILE_OUTPUT_DIR:-}" ]]; then
overnight_root="$AGENTS_DIR/overnight"
if [[ -d "$overnight_root" ]]; then
fallback="$(find "$overnight_root" -path '*/defrag/latest.json' -type f -printf '%T@ %p\n' 2>/dev/null \
| sort -n | tail -n 1 | awk '{print $2}')"
if [[ -n "$fallback" && -f "$fallback" ]]; then
echo "INFO: $DEFRAG_LATEST not found; falling back to overnight preview $fallback"
DEFRAG_LATEST="$fallback"
fi
fi
fi
if [[ ! -f "$DEFRAG_LATEST" ]]; then
echo "FAIL: $DEFRAG_LATEST not found — run 'ao defrag' first"
exit 1
fi
if ! jq -e "(.oscillation.oscillating_goals // []) | length == 0" "$DEFRAG_LATEST" >/dev/null 2>&1; then
count=$(jq -r "(.oscillation.oscillating_goals // []) | length" "$DEFRAG_LATEST" 2>/dev/null || echo "?")
echo "FAIL: $count oscillating goal(s) in $DEFRAG_LATEST"
exit 1
fi
echo "PASS: no oscillating goals in $DEFRAG_LATEST"
exit 0