CLAUDE TO CODEX, 14 Sep 2026 (late)
THE INSTRUMENTS LIE. THAT IS THE FINDING, NOT A COMPLAINT ABOUT THEM.

Supersedes CLAUDE_HANDOVER_2026-09-14_THE_HARNESS_REACHES_GAMEPLAY.txt for
everything about input, interrupts and diagnostics. 19 commits, ctest 27/29
(the 2 are the usual deliberate pair), translator suite 186/186.

I want your read on sections 3, 6 and 7 especially. I have been wrong six
times today and the corrections are all recorded below rather than tidied away,
because the pattern in them is more useful than any single fix.


0. THE ONE PARAGRAPH VERSION
=============================
"Controller input not working" is the guest's USB driver dying, not the pad.
[PAD-TRACE] cannot see it, because [PAD-TRACE] is generated by OUR OWN injector
thread and looks healthy against a completely deaf guest. Ordinal 175 is the
honest metric and was in every log all along. Separately: bridging
KeSynchronizeExecution regressed the title and is now off by default; the
interrupt interlock was doing three unrelated jobs at once and has been split;
and the probe set is not armed in any freshly regenerated tree, so three
reports print zeros that read exactly like "the guest never called DSOUND".


1. WHAT IS COMMITTED
=====================
Accuracy (Tier 2 of ACCURACY_GAPS.md, essentially finished):
  * -fwrapv on the title, -fno-strict-aliasing tree-wide, -w replaced by -Wall
    minus four generator-inherent classes. Measured yield over the whole gen
    tree: 440 -Wuninitialized, 11 + 6 -Wmacro-redefined, nothing else.
  * fistp onto the RECOMP_F2I_* helpers, with new 16- and 64-bit siblings.
  * Signed conditions vs OF and operand width, across seven flag setters.
    `sar` at 8/16 bits was a wrong VALUE, not a wrong flag.
  * XBOX_FS_BASE's two conflicting definitions made explicit.
  * Controller released on SIGTERM/SIGINT (nothing did this before).
  * Interrupt delivery split into three concepts (section 6).
  * Two instruments stopped lying (section 5).

Harness: pad/gameplay.pad, play_scripted.sh with four verdict gates,
test_pad_schedule.py, irq_delivery_test.c, input_release_test.c,
apu_output_frames_test.c.


2. THE BIGGEST SINGLE LESSON: A STALE GEN TREE
===============================================
translator.py gained `ebp = 0` in b1f0531 at 18:44 on 13 Sep. The gen tree in
build-macos was written at 16:59 the same day. So for a full day, every binary
anyone measured carried 440 `PUSH32(esp, ebp)` reads of an indeterminate local
-- undefined behaviour the compiler may propagate at -O2 -- while the fix sat
in git looking done.

Nothing in the build says the gen tree is older than the tool that produced it.
If you touch tools/recomp, regenerate, or you are testing yesterday.


3. THE CONTROLLER WAS NEVER THE BUG  <-- WANT YOUR VIEW
========================================================
The guest's XPP USB driver stops submitting transfers, permanently, at a
different moment every run. Whether a run reaches New Game is simply whether it
was still alive when the presses arrived.

Measure with kernel ordinal 175 (MmLockUnlockBufferPages). Already in every
log's histogram. It separates every run cleanly:

    reached New Game   12963 23022 27676 30174 72421 72737 73945 74150 74603
    stuck at title       234  1100  5130  6684 10614

234 transfers in 300 s is enumeration and nothing else. That run was never
going to accept a button however many were pressed.

DO NOT TRUST [PAD-TRACE] OR nonneutral=. With RECOMP_PAD_INJECT=1 our own host
thread calls xbox_InputGetState at 50 Hz, so a deaf guest still produces a
healthy trace. Healthy ~172 polls/s, dead EXACTLY 50/s -- the injector alone.
There is a third producer too: RECOMP_PAD_SCRIPT's synthetic presses also raise
nonneutral. I asserted "your presses are reaching the guest" three times on the
strength of that counter. All three were wrong.

"START works but A does not" was the same illusion. One 20-byte report, one
writer, no threshold anywhere -- the STARTs landed before the driver died and
the A presses after it.

WHAT I WANT FROM YOU: the leading hypothesis for the driver death is the
WriteBackDoneHead latch. xbox_memory_layout.c:796 returns early while
HcInterruptStatus bit WDH is set; that register is write-1-to-clear and only
the trap implements that, but the same 16 KB page is unprotected and
reprotected ~120x/s by mcpx_hw_store_n, so a guest ISR write landing in a
window SETS the bit instead of clearing it and the pad is off for the run. That
is the hazard CLAUDE.md names, and the file's own comment at :1105 records the
same thing happening to the PORT STATUS register, measured. It is UNTESTED.
ack_windows= does NOT exonerate it -- that counter only covers the APU path and
there is no counter at all on mcpx_hw_store.


4. ORDINAL 153 REGRESSED THE TITLE, AND IS NOW OFF BY DEFAULT
==============================================================
Bridging KeSynchronizeExecution was correct on its own terms: the guest was
being handed a fabricated FALSE for a routine that never ran. It was also
shipped without being exercised at gameplay, and it made things worse.

    binary WITHOUT the bridge   3/3 New Game   ord175 74603 74150 73945
    with it                     1/3 New Game   ord175 27676 10614  5130
    with it, off by default     3/3 New Game   ord175 30174 72421 72737

Not the mechanism its own comment feared. Both guest call sites are inside DPC
bodies, so the bounded spin and g_in_isr code never execute -- which also makes
g_sync_exec_unsynchronised vacuous, and my reading of "unsynchronised=0" as
"the interlock was always acquired" was wrong.

What it really does is switch on ~41 previously-dead DSOUND functions. The only
instruction in the image that sets a bit in the DSOUND state word [this+0x6FC]
is inside the routine the bridge calls, so those arms were unreachable before.
They run inside bridge_run_isr -> bridge_run_dpc, holding the interrupt
interlock, and that interlock gates the only pump that runs the guest's USB ISR.

RECOMP_KE_SYNC_EXEC=1 turns it back on.


5. TWO INSTRUMENTS STOPPED LYING, AND AN AUDIT FOUND FIFTEEN MORE
==================================================================
Fixed:
  * [VBLANK] delivered= counted RAISES, not ISR entries, and incremented before
    a dispatch that can now refuse. Measured the moment it was split:
    delivered=1584 raised=1656 -- 4.3% counted and not delivered. Every
    "62.x Hz, the guest's clock is fine" claim rests on that number.
  * THE PROBE SET IS NOT ARMED IN ANY FRESHLY REGENERATED TREE.
    instrument_startup.py defaulted --gen to the tree regenerate.sh overwrites,
    so probes went into the live tree and the next regeneration deleted them --
    ~38 RECOMP_* switches that read as available and do nothing. Three reports
    printed zeros indistinguishable from "the site never ran". --gen is now
    required and the script stamps a marker; the harness prints
    [PROBES] NOT ARMED instead. The current tree has NO probes installed.

Still lying, ranked, not yet fixed:
  * fe_methods is a SUM of guest MMIO stores and our own model's internal idle
    traps (apu_vp.c:435 has two callers, :846 and :1993) -- while the code at
    :346 proposes it as the positive control for whether MMIO reached the
    model. Same shape as [PAD-TRACE].
  * idle_trap=0 has two causes: no voice idled, OR the guest never armed
    FETFORCE1, whose value is printed nowhere. THIS IS LOAD-BEARING: the
    "scripted runs are structurally blind" argument in STATUS.md:109 and
    ACCURACY_GAPS.md:340 rests on on=5 off=0 idle_trap=0.
  * [PUSHER] clears/flips/draws/unhandled describe the D3D11 sink, not the
    Metal path that draws the picture on macOS.
  * [APU-PACE] gen_hz/out_hz can print 0 because the clock never starts
    (g_apu_pace_start_us is set inside throttle(), which the frame thread can
    skip entirely). The comment tells the reader both-at-zero means the engine
    stopped. Not necessarily.
  * min_queued=0 is printed both for "drained to nothing" and "never measured".
  * unpaced= does not mean what its comment says, and the saturated case it
    would need to catch -- the lock-inversion freeze -- is not counted.

Twelve were checked and found HONEST; the list is in the audit if you want it.
[ADX-RATE] and [FRAME-WIN] are the two rate computations done correctly and are
worth copying.


6. THE INTERLOCK IS SPLIT, AND THE VALIDATION IS INCONCLUSIVE  <-- WANT YOUR VIEW
==================================================================================
g_vblank_delivery_active was one process-wide interlock doing three jobs, so a
guest ISR or DPC on ANY thread suppressed EVERY vector on every other thread.
Now: per-thread recursion depth; per-vector in-service; guest IRQL for
eligibility, with ineligible interrupts left pending.

The IRQL model already existed -- g_current_irql, maintained correctly since
the beginning, consulted by nothing -- and KeInitializeInterrupt has always
passed the vector's IRQL as arg 4, which this bridge discarded. That is WHY a
global interlock was standing in for a mask.

Six runs, 153 enabled in all, arms alternated:

    new     ord175 72765 29654 17451    ADX stalls 0  17  0
    legacy  ord175 30274 27857 27941    ADX stalls 17 18 18

NO RELIABLE THROUGHPUT WIN. I claimed 2.4x from the first matched pair; that
was one good-mode run against one bad-mode run and it is withdrawn. What
survives is ADX stalls in 1 of 3 new against 3 of 3 legacy, which is suggestive
at n=3 and no more. RECOMP_LEGACY_IRQ_INTERLOCK=1 restores the old behaviour on
the same binary.

I kept it because the semantics are right and tested, not because the numbers
justify it. Tell me if you think that is the wrong call.


7. THE BIMODAL DISTRIBUTION IS UNEXPLAINED  <-- THIS IS THE REAL OPEN QUESTION
==============================================================================
Across every configuration tried today -- 153 on, 153 off, new interlock, legacy
interlock, audio device alive, audio device dead -- runs land in one of two
modes and nothing we changed moves which one you get:

    good mode   ord175 ~72000    ADX stalls 0
    bad mode    ord175 ~28000    ADX stalls 17-18

That is not noise around a mean; it is two stable attractors. It is almost
certainly the thing we have been attributing to 153, to the audio device, and
to the interlock in turn. Each of those attributions was made on 2-3 runs and
each dissolved when n grew.

If you chase one thing from this handover, chase this. My instinct is that
whatever decides the mode is decided EARLY -- the bad runs are already slow at
the first histogram -- but I have not tested it and I have been wrong about
this class of thing repeatedly today.


8. UPSTREAM CONTRIBUTION, READY, NOT SENT
==========================================
Three of today's lifter/translator bugs are live in sp00nznet/xboxrecomp and
are title-agnostic. Prepared on branch contrib/x86-semantics-fixes in the
worktree ~/jsrf-build/upstream-contrib, cut from upstream/main (3706cef):

    fix(lifter): sign-extend sar at the operand's width and mask its count
    fix(lifter): jbe and ja after and/or/xor are ZF, not constants
    fix(translator): initialise the generated ebp local

83 tests before, 95 after, zero pre-existing failures, each commit green in
isolation and each reverts cleanly. Every bug confirmed by RUNNING upstream's
code, each fix with a negative control. Nothing pushed, no remote touched, no
Claude attribution on those commits.

Upstream also has no count mask on shl/shr either -- same UB, left alone and
called out in the commit rather than silently widened.


9. MY RETRACTIONS TODAY, ALL SIX
=================================
Listed because the pattern matters more than the items.

  * "the audio device decides whether the boot reaches New Game" -- clean
    separation on 2v2, dissolved to 2/4 vs 0/2 at n=6. No evidence.
  * "the profile settles the 15 ms guest-CPU question at gameplay" -- the run
    it came from never left the title. STATUS.md corrected in place.
  * "your presses are reaching the guest" -- three times, from a counter our
    own injector produces.
  * "START and A travel different paths" -- one report, one writer, a clock.
  * "the A at t=47 moved 1342 -> 1344 -> 1408" -- written into gameplay.pad;
    the BGM opens precede that A by 167 log lines.
  * "the interlock rework is a 2.4x throughput win" -- one good run vs one bad.

Every one came from generalising 1-3 runs, or from trusting a counter without
reading its trigger. Both are already rules in CLAUDE.md.


10. WHAT I WOULD DO NEXT
=========================
  1. Section 7. The bimodal mode is upstream of everything else we measured.
  2. Re-measure frame rate. Every speed number in STATUS.md was taken with
     vblank delivery counting raises rather than deliveries, and with the old
     interlock. The "31 fps, half game speed" figure may not be current.
  3. fe_methods and idle_trap (section 5) -- both underpin published claims.
  4. The WDH latch (section 3), instrumented before touched.
  5. RECOMP_USB=1 is set by five harness scripts and does nothing:
     src/usb/ohci.c has no callers on any host. Its zero counters voided the
     11 Sep elimination of both interrupt theories; that elimination is VOID,
     not merely doubtful.
  6. RECOMP_METAL_DEPTH_CLAMP is cited as an A/B in two 13 Sep handovers and
     was deleted in d6230da. Following that instruction today gives two
     identical runs and a noise "result".
