Skip to content

docs: autonomous iteration & self-correction methodology (No Silent Degradation) + Mac launcher - #145

Merged
FluffyAIcode merged 3 commits into
mainfrom
AgentMemory/autonomous-iteration-methodology-2815
Jun 17, 2026
Merged

docs: autonomous iteration & self-correction methodology (No Silent Degradation) + Mac launcher#145
FluffyAIcode merged 3 commits into
mainfrom
AgentMemory/autonomous-iteration-methodology-2815

Conversation

@FluffyAIcode

@FluffyAIcode FluffyAIcode commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Why

Root-causes the ~month-long failure where dev ran on an effectively verifier-only config (proposer/f_θ silently bypassed), AND a newly-surfaced failure: the full engine produces garbage + throughput collapse on long generation. Delivers the methodology and turns its §4/§4b into an executable, fail-loud gate so neither can recur silently.

1. Methodology — docs/kakeya-autonomous-iteration-and-self-correction.md

§0 No Silent Degradation. §1 anti-pattern catalog (A–E) + git -S forensics. §2 North Star invariants. §3 self-correcting loop (PASS/FAIL/BLOCKED). §4 liveness contract. §4b quality contract. §5 agent rules. §6 wiring. §7 living summary + known limitation.

2. §4 liveness gate (proposer/f_θ/fallback) — implemented, wired, verified

assert_liveness(): proposer ran (blocks>0), f_θ ran when intended (f_theta_ran), fallbacks_taken==[], from runtime signals. Verified: local walker fails a degraded report (exit 1) & passes a live one; Mac M4 on-device gate PASSED a live run (evidence_gate_exit_code=0, f_theta_ran=True, blocks=2/4).

3. §4b quality gate (the long-decode failure liveness can't see) — NEW

The full engine produced garbage + 0.31 tok/s on a 780-token answer while the liveness gate passed (blocks=340>0, f_θ ran). Root cause confirmed in code: restoration is prefill-amortized for the prompt, covering only ≤ window (64) decode tokens; longer generations evict unrestored positions → degenerate. assert_quality() adds:

  • RESTORATION_COVERAGE — restored run with tokens > window (the structural cause).
  • OUTPUT_DEGENERATE — runaway-repeat text (the symptom).

Verified: a PoW-style report (tokens=780 > window=64, repeated * * *) now FAILS the walker (CI + on-device) with both codes (exit 1).

kakeya_quality_gate_catches_degeneration.log

Honest engine status: the Mac full engine is usable today only for ≤ window (64) decode tokens; longer generations degenerate. The gate now fails loud beyond that. The fix is continuous decode-time restoration (re-restore positions evicted during decode, as the CUDA engine does) — tracked as the open engineering work in §7, not a gate matter.

4. Also (completes #144)

scripts/run_kakeya_mac.sh launcher + mlx-kakeya-launcher-smoke preset.

Testing

  • pytest tests/inference_engine/bench/test_k3_report_gate.py tests/inference_engine/bridge/test_manifest.py — 81 passed; 100% coverage on both modules.
  • ✅ Walker fails degraded (liveness) AND degenerate/coverage-exceeded (quality) reports; passes live ones.
  • ✅ Mac M4 on-device liveness gate passed a live run.
  • ⚠️ pytest -m integration on Mac M4 red — pre-existing self-hosted-runner infra issue, unrelated.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

…egradation) + Mac launcher

Root-causes the month-long verifier-only dead end (silent fallback/simplification:
proposer/f_θ bypassed while keeping the 'fused' label) and gives an automatable,
self-correcting iteration loop to make it impossible to repeat:
- §0 one rule: No Silent Degradation — system under test is the intended system
  or the run is INVALID.
- §4 machine-checkable liveness contract (blocks>0 proves proposer; f_theta_ran
  proves f_θ; fallbacks_taken==[]; recall floor; KV bounded) asserted by a
  fail-loud gate (generalize k3_report_gate).
- §3 run→gate→diagnose→re-run loop with only PASS/FAIL/BLOCKED (no
  'simplified-and-done'); §5 agent rules; §6 wiring; §7 living summary.
Also restores scripts/run_kakeya_mac.sh + mlx-kakeya-launcher-smoke (left behind
by the #144 squash).

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
cursoragent and others added 2 commits June 17, 2026 10:08
…adation (proposer/f_θ/fallback)

Turns the methodology's §4 from doc into an executable defense:
- k3_report_gate.assert_liveness(): asserts proposer ran (blocks>0), f_θ ran when
  intended (f_theta_ran on every turn), and fallbacks_taken==[] — from RUNTIME
  signals, not from flags. Missing liveness field = violation. New codes:
  PROPOSER_NEVER_RAN, FTHETA_NOT_RUN, SILENT_FALLBACK, MISSING_LIVENESS.
- validate_report() dispatches liveness reports; validate_k3_reports.py (CI + the
  Mac-bridge on-device gate) now gates kind=mac_gemma4_kakeya_fused_chat.
- harness emits f_theta_intended + fallbacks_taken in the chat report.
- fused-chat presets set validate_reports=True → the Mac runner FAILS if the
  engine silently degraded to verifier-only.
- 100% coverage on k3_report_gate + manifest; walker verified to FAIL a degraded
  report (blocks=0 / f_θ bypassed) and pass a live one.

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
… liveness gate cannot

The full Mac engine produced GARBAGE + throughput collapse (0.31 tok/s) on a long
answer (PoW, 780 tok) while the §4 liveness gate PASSED (blocks=340>0, f_θ ran) —
liveness is necessary but NOT sufficient. Root cause (confirmed in code comment):
restoration is prefill-amortized for the prompt, covering only <= window (64)
decode tokens; longer generations evict unrestored positions → degenerate.

assert_quality() adds:
- RESTORATION_COVERAGE: restored run with tokens > window (the structural cause).
- OUTPUT_DEGENERATE: runaway-repeat text (the symptom).
validate_report dispatches liveness reports through assert_liveness + assert_quality.
Verified: a PoW-style report (tokens=780 > window=64, repeated '*   *   *') now
FAILS the walker (CI + on-device) with both codes. 100% coverage. Doc §1/§4b/§7
updated; the engine fix (continuous decode-time restoration) scoped as open work.

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
@FluffyAIcode
FluffyAIcode marked this pull request as ready for review June 17, 2026 11:33
@FluffyAIcode
FluffyAIcode merged commit c396d0f into main Jun 17, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants