MTGBench improvement loop

Overview · Experiment index

Iteration 3: Share captured stack-push entries across journal forks

state execute — stopped by operator; executor session resumable
switch PHASE_STACK_PUSH_SNAPSHOT_LEGACY · branch loop/it3 · base 3f4ca44ee · candidate · took 1h 56m

Mechanism. engines/phase/crates/engine/src/types/resolved_commands.rs:1106-1110 stores ResolvedStackPushCommand.entry as Box<StackEntry> with derived deep Clone. ResolvedRulesJournal::clone at :1923 copies every historical command, repeatedly copying captured stack entries and their nested resolved abilities. Share only this captured payload; retain the existing journal containers and complete history.

Evidence. Memo section '2026-09-23 — xn5.67' attributes 7.45% inclusive process CPU to journal cloning, including 5.7% to its entry vector; these nested shares are not additive. This specific payload's share is unmeasured, and the profile predates xn5.71, so it supplies an instrumentation target, not a savings estimate. The proposal differs from closed frozen-chunk and journal-free experiments. The broader field-sharing issue edh-play-xn5.23 remains open.

Counter and kill threshold. First add opt-in counters around the existing Box<StackEntry> copy in ResolvedStackPushCommand::clone: journal-origin clone calls, calls carrying a resolved ability, and payload-copy nanoseconds. Scope attribution to ResolvedRulesJournal::clone during contract/apply, excluding serialization and initial capture. Kill before changing representation if attributable payload-copy time, after recorder-overhead debit, is below 1.5% of summed contract_ms + apply_ms on the 4,000-action seed-91 workload. Counts alone cannot pass the gate.

Invariant. journal_stack_push at game/stack.rs:254 captures an owned snapshot independently of the live stack. apply_resolved_stack_push at :318 clones that snapshot into live state. Sharing the captured snapshot preserves every value, ordinal, provenance field and replay precondition. Explicit Arc::make_mut preserves isolation if a captured command is edited. Permanent regressions must verify shared versus legacy clone allocation identity, equal serialized values, and root/sibling isolation after live-stack mutation, captured-payload mutation and replay.

Agent steps

RoleHarness / modelTimeExitNote
plannercodex / gpt-6.1-sol5m 7s0
executorcodex / gpt-6-luna1h 0m124timeout
executorcodex / gpt-6-luna9m 1s143stopped by operator to fix scope policy; session resumable
executorcodex / gpt-6-luna38m 39s

Gates

GateResultExitDetail

generated 2026-09-29 20:20:25 · read-only · refreshes every 30 s