MTGBench improvement loop

Overview · Experiment index

Iteration 45: Restrict land-mana preflight enumeration to the submitted source

state rejected — failed gate ir1k
switch PHASE_LAND_MANA_PREFLIGHT_SCOPE_LEGACY · branch loop/it45 · base 4ec0b9ef1 · candidate 7a9dabb16 · took 1h 4m

Results

Verdict: TOO SMALL: only 0.14% fewer instructions, under the 0.3% floor. The final word is always the PC wall-clock.
Gate: 1,000 actions (screen) — -0.14% instructions, equal work: yes
Gate FAILED: INVALID A/B: seat=$($game.candidate_seat) differs …. These counts are not a valid measurement.
-1% retain-0.3% kill0-0.14%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy20,678,829,8134,0005,169,7072,8812,590
optimized20,650,125,9584,0005,162,5312,7862,859
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.

Where the time went

planner: 12 minexecutor: 41 minreviewer: 0 mingate fmt: 0 mingate build: 9 mingate ir1k: 0 min
planner 12mexecutor 41mreviewer 0mgate fmt 0mgate build 9mgate ir1k 0m
executor: 6,083,610 in / 14,183 out tokensplanner: 4,347,019 in / 16,346 out tokensreviewer: 23,179 in / 658 out tokens

Mechanism. In mana_sources.rs::preflight_tap_land_action, validating one TapLandForMana action currently enumerates activatable mana actions for every controlled permanent. Add a source-scoped mode to the existing enumeration driver so preflight constructs actions only for the submitted source. Keep board-wide activation gates and aura discovery unchanged.

Evidence. docs/stage0-decision-memo.md:L4524, xn5.59, measured 582 TapLandForMana fallback validations consuming 200.2 ms across the two 4,000-action workloads. Those validations execute the action boundary, including this preflight. This is a containing-region ceiling; preflight's removable fraction was not isolated. Actual action applications also reach preflight, but their additional opportunity is unmeasured.

Counter and kill threshold. Existing xn5.59 raw-validation action-shape row: TapLandForMana, 582 calls and 200.2 ms. Expected instruction reduction: 0.4–0.9% per action at 4,000 actions, an unmeasured hypothesis likely to be marginal. The loop's existing instruction and fingerprint gates decide.

Invariant. Every matching TapLandForMana action names the submitted source incarnation. Actions from other sources cannot affect the exact-match count. Preserve battlefield membership, controller and submitter checks, activation restrictions, full selection equality, duplicate-match rejection, and existing errors. Permanent differential tests must compare preflight results and unchanged input states against complete enumeration.

Agent steps

RoleHarness / modelTimeExitTokens in / outNote
plannercodex / gpt-6.1-sol12m 14s04,347,019 / 16,346
executorcodex / gpt-6-luna41m 12s06,083,610 / 14,183
reviewercodex / gpt-6.1-sol0m 31s023,179 / 658

Gates

GateResultExitDetail
fmtpass0cargo fmt --all -- --check
buildpass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it45-build
ir1kFAIL1pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode ab -Instrument perf -Legacy PHASE_LAND_MANA_PREFLIGHT_SCOPE_LEGACY -Actions 1000 -Seed 91 -Workers 1 -Timeout 1800 -Repeats 3 -CargoProfile bench-fast-inc -Label it45-ir1k -IrThresholdPercent 1.0 -IrDeterminismPercent 0.05 -VerdictJson /data/mtgbench/loop/reports/it45/ir1k.verdict.json -PerfSudo

Write-up: 2026-10-04 - Loop iteration 45: Restrict land-mana preflight enumeration to the submitted source (rejected)

Status: rejected (loop, instruction-count gate; wall-clock not yet confirmed)

Automated loop result on homelab (aarch64). Switch PHASE_LAND_MANA_PREFLIGHT_SCOPE_LEGACY, mechanism class compute. Mechanism: In mana_sources.rs::preflight_tap_land_action, validating one TapLandForMana action currently enumerates activatable mana actions for every controlled permanent. Add a source-scoped mode to the existing enumeration driver so preflight constructs actions only for the submitted source. Keep board-wide activation gates and aura discovery unchanged. Invariant: Every matching TapLandForMana action names the submitted source incarnation. Actions from other sources cannot affect the exact-match count. Preserve battlefield membership, controller and submitter checks, activation restrictions, full selection equality, duplicate-match rejection, and existing errors. Permanent differential tests must compare preflight results and unchanged input states against complete enumeration.

gatepasseddetail
fmtyescargo fmt --all -- --check
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
ir1kNOINVALID A/B: seat=$($game.candidate_seat) differs …

Wall-clock confirmation on the workstation is required before this counts as a speedup; instruction count is a screen, not a time prediction.

generated 2026-11-28 18:17:09 · read-only · refreshes every 30 s