Skip to main content

Module ab_loop

Module ab_loop 

Source
Expand description

The self-improvement loop: A/B → attribute → CAR fix → A/B, until CAR’s coder clears the quality bar or no harness lever remains.

This is the loop the /goal “make a loop of a/b testing, car fixes, and more a/b testing until car quality is high enough” asks for, expressed as a deterministic driver with injected seams so it is unit-testable and its termination is provable:

  1. Run the paired A/B suite (run_ab_suite) — CAR’s native coder (pinned on a pinned backbone) vs. the control arm, on the same contracts.
  2. attribute_round the native losses into harness-addressable interventions vs. backbone-bound (no-lever) losses.
  3. Decide against the LoopConfig quality bar:
    • met → stop LoopStop::QualityMet;
    • no lever (remaining losses are all backbone-bound) → stop LoopStop::NoLeverLeft (the honest “a better model, not a harness change, is what’s left” outcome — the ALE finding, enforced);
    • otherwise hand the interventions to the injected AbFixer (live: the Evolution Agent’s evolution.run harness diagnose→gate→apply, HITL-gated on the approval ledger). If nothing lands → stop LoopStop::FixStalled.
  4. Re-run the A/B — the applied change’s own regression gate: a fix only “counts” if the next round’s numbers move, and McNemar says whether the move is real or noise.

The fixer and the arm runner are injected (the car-builder / car-verify::cwm philosophy), so this core carries no live-inference or daemon dependency and its convergence is exercised with scripted doubles. The live wiring (real runner + real evolution.run fixer + the car coder-ab-loop CLI) sits on top of this exactly as the live A/B runner sits on run_ab_suite.

Structs§

FixResult
The result of applying a fix round.
ImprovementRun
The full loop trace.
LoopConfig
Tuning for the improvement loop.
RoundRecord
One round of the loop, recorded for the report and the operator trail.

Enums§

LoopStop
Why the loop stopped.

Traits§

AbFixer
The injected fix seam. The live impl drives the Evolution Agent (evolution.run’s harness diagnose→gate→apply) over the interventions, HITL-gated on the shared approval ledger.

Functions§

run_improvement_loop
Run the self-improvement loop to a terminal LoopStop. Always terminates (bounded by max_rounds; each non-terminal round applies a fix or stops).