MDK2 resource loading boundary, 2026-11-04

No production loading defect is demonstrated. The original loader can retain one active pointer while its file worker processes that resource. The measured queue 105/active 6122816 boundary remains unresolved. This offline investigation supplies original-code evidence and tested small next-attempt inputs; it establishes neither a stall nor loading completion.

Started from 18f92540945101071dc2ff2cc1e80f969df92931, the compatible scene progress note, and its recovered observations. New evidence/helpers are in scratch/runs/20261104-mdk2-resource-loader-cause/ (RUN below). Only this note is committed. No production source, WASM, game media, browser, box or runtime lifecycle was changed.

The retained actual execution source is 1329b1ba6eb00144ff77d4cd92a8513d4fc953ad; its canonical module SHA-256 is cffca869b541e6eff12ae3a6b74c4476977e0a7e23cd43d8ec5ba8faecd4bcee. This is a pinned historical execution, not qualification of today's main/build. RUN/checkout-head.txt records the investigation checkout. Runtime pins refer to the existing modules under scratch/runs/20261104-mdk2-browser-gameplay/recovered/build/; neither was copied.

The original executable was read at test/binaries/candidates/mdk2-demo/installed/mdk2demo/mdk2Main.exe, SHA-256 b3e0226e411abff17ddabb723e493e95579490cb49bfe3787b1eade1144e27c1. RUN/test-original-loader.cjs checks exact original bytes at eleven relevant addresses and parses its actual PE imports: IAT 0x48c070 is KERNEL32.dll!SleepEx. RUN/inspect-original.cjs reads/DCL-decodes the original scripts archive in memory, checks archive SHA-256 cfdae6e7d02b1823a59d0b85aa8eaca2f057dbb27e7b86d9a7199fc069f642d8 and the predecessor's decoded hashes, and retains selected loading excerpts. No decoded script tree or media copy was made.

The original loading chain is:

Original source/address Behavior and implication
level0.lua:342; level1.lua:95–103 New Game chooses level1/checkpoint9, mapped to sectionD/Intro Movie A.
mdk2.lua:373–398 Applies/pends game, destroys Level/Save, collects garbage, sets checkpoint/level/section, then loads the new level script. Nil Level is legitimate construction.
level1.lua:1–4; mdk2.lua:477 Creates Level, names l1/loadscreen1, sets scenegraph processing, and calls loading before object/scenegraph application. Those fields do not prove artwork or a playable scene.
mdk2.lua:567–628 Selects the checkpoint's section; queues its sound bank and resources via mdkPreloadRes; calls mdkShowLoadingScreen(Level.loadscreen, memsize).
0x438be0 -> 0x42b320 Original Lua loading-screen wrapper/function. The loop checks queue count at 0x5ce0c0; positive count continues. After count drains, its fade must also finish. The ordinary two-argument call does not use the optional message gate.
0x42b446 -> 0x44f930 Loading-screen loop pumps a resource. If 0x4b7d14 is already nonzero, it keeps working on that entry. It dequeues a new one only when there is no active entry. Queue count can remain unchanged across many pumps.
0x452140 Prepares storage/archive input and the output buffer; publishes request pointer 0x4b87d4, completion 0x4b87d0=0, request flag 0x4b87cc=1.
0x451f30 Original file-worker loop clears the request flag, calls 0x4520b0 on that pointer, then sets completion to 1 at 0x451f51. Its idle loop calls alertable SleepEx with zero milliseconds.
0x4520b0 Reads the direct-file branch or calls the archive branch (0x457600), releases input storage, and adds the resource size to 0x5ce08c. A request flag already cleared with completion still zero can mean work is in flight.
0x4522d0 -> 0x4515c0 Polls completion after SleepEx(10, TRUE). An unchanged active pointer does not distinguish sleep, file work, decode or finalization.
0x44fa32–0x44fa6f Completion 1 marks entry status 2, finalizes it and clears active/retries. Return -1 increments retries; at five retries the pump stops progressing that entry and the loading-screen function has resource-error UI. None of those retry values was measured live.
0x44f8e0 Separate chIsLoadingResources query returns true for a nonzero active pointer or positive queue. This query alone does not identify comic/tutorial readiness.

Selected disassembly is in RUN/native-*.txt. Calls 0x44fd30 and 0x451430, which appear around the pump, are respectively an immediate return and a zero return in this exact original binary; they are not evidence of an unserviced host callback. The older GL-initialization suspended-file-worker failure documented in mdk2-demo.md happened before window creation. The current retained run reached the original title and native New Game/Medium callbacks. That older failure cannot be assigned to this boundary without new worker-state evidence.

The actual host path matters: retained state reports guestWorker:true, worker thread backend, one frozen host, and a sibling file-worker incarnation. host.js:_runThreaded runs the main slice and sibling thread scheduling in the same rendezvous; a main Sleep deadline parks the main execution while siblings continue receiving turns. handle_SleepEx in src/09a0-handlers-base.wat uses the normal sleep yield and submitting-thread alertable APC machinery. _frozenPump consumes one credit and advances the guest clock per slice. With no credits it parks. Human inspection time therefore does not run the game or advance its guest clock. Source scheduling permits progress; it does not prove that this particular worker executed or completed its request.

RUN/retained-boundary-summary.json references/hashes the original captures. The thirteen construction quanta ran 3344→3552 (208 steps). Actual Level appeared at 3440; queue 105/active 6122816 first appeared at 3456. From 3456 to 3552 only 96 more slices / 1,920 guest milliseconds were observed, although capture timestamps span about 91.6 wall seconds. At 3440→3552 the difference is 112 slices/2,240 guest milliseconds. An earlier active pointer cleared at 3408, followed by Level creation and a new queue. ACKs and those transitions prove some progress; neither ACK count nor elapsed wall time proves work on the final active resource. No request flag, completion flag, retry count, current owner PC or suspend/wait state was captured there. The initial file-worker startup EIP in the UI log is not its current PC. The browser closed voluntarily, with no error latch or exhausted budget. Calling this a deadlock would overstate the evidence.

The actual reusable driver and controller integration needed practical changes. RUN contains the following run-only changes, with native identities and input policy preserved:

Tests passed: 40 new controller/driver integration tests, one original PE byte/import test, the three-script loading source check, and 134 staged existing controller/barrier tests. The new tests execute the actual driver command function and actual Spool/InspectionGuard, using a modeled page execution peer; native observations include retained actual boundary JSON and serialized actual observer output over synthetic original-layout memory. They cover fourteen separately approved stable-queue quanta, no automatic quit, last allowed quantum/next rejection, malformed deadlines, stale or missing approvals, identity/input failures, partial/timed-out steps, bad/missing ACKs, changed state, and comic-controller admission after all construction counters are consumed. They do not run the game or a WASM consumer, and prove no production runtime repair. Since no production path changed, a full build and production WASM repair tests are not applicable. The first new suite's two test-harness errors (future ACK placed beyond the next command and a synchronous constructor assertion passed to async rejection checking) are preserved in test-loading-integration-first.log; corrected tests pass.

Reproduce offline from the repository root:

RUN=scratch/runs/20261104-mdk2-resource-loader-cause
node "$RUN/inspect-original.cjs"
node --test "$RUN/test-original-loader.cjs" "$RUN/test-loading-integration.cjs"
# Choose a fresh directory; preparation never launches or authorizes anything.
node "$RUN/prepare-inputs.cjs" "$RUN/fresh-inputs"

RUN/next-inputs/ is the already generated small input set (28 files, about 232 KB), sealed by input-hashes.json and RUN/next-input-hashes.json. Preparation takes the predecessor's small helpers, replaces only the changed helpers, adds the deadline helper and omits its historical runtime-release file. It leaves the original selector, readiness, opening-completion and inspection guards byte-identical. Test the staged selected suites using node --test "$RUN/next-inputs/test-native-menu.cjs" "$RUN/next-inputs/test-opening-complete-control.cjs" "$RUN/next-inputs/test-construction-control.cjs" "$RUN/next-inputs/test-comic-control.cjs" "$RUN/next-inputs/test-inspection-guard.cjs". The source-only archive check is run locally above; it is not silently waived by a hydrated runtime lacking tools/mpq.

The next attempt requires a newly assigned runtime and owner release, enough time to finish startup and spend the remaining bounded window on loading, all 432 original runtime pins and module hashes, original media by existing path/hash, exact retained Puppeteer 24.31.0 dependencies/lock, and passing prebrowser/controller checks before Chrome. Do not run this pinned historical driver against a different source/module identity. Stage only the small input set and fresh release. Reuse the existing process preflight and original registered isolated selector; no old box is resumed by this plan.

After ordinary opening/New Game/Medium, personally inspect each new capture. Use the unchanged menu/opening controls while their predicates apply. For honestly classified black construction with the required native nil or l1 identity, approve a fresh construction review and run:

node INPUTS/inspection-guard.cjs BROWSER fresh-review.json
node INPUTS/construction-control.cjs observe-construction BROWSER fresh-review.json

Here INPUTS is the staged helper directory and BROWSER is that driver's fresh output directory; fresh-review.json follows the construction review fields enforced by the helper/tests. Continue with a new review for every resulting capture while its measured scene still qualifies and caps/deadlines permit. Do not close voluntarily merely because Level appeared or queue/pointer stayed stable for thirteen quanta. Use the useful finite allowance; reserve recovery time. At visible loading artwork, switch to the separately guarded comic-control.cjs observe-loading with an honestly changed review. At comic panels stop for the existing distinct comic review; there is no automatic Escape in the construction helper. Stop on scene mismatch, first error, cap or deadline, and preserve the reason. No arbitrary waits or forced guest progress are included.

At every observation retain the new request/completion/retry/prepared/byte fields with queue, active entry, host credits/guest clock and fresh pixels. If the useful bounded attempt ends without another native transition, preserve that as incomplete loading. A demonstrated scheduling/resource defect would still require actual owning-thread PC/yield/suspend/wait and file-I/O evidence distinguishing an unserviced request from active archive work or finalization; stable queue plus pending flags alone is insufficient. No further readiness or production fix is invented here.

RUN/relevant-uncommitted.patch, owned-new-files.patch, dependencies.json and artifact-sha256.json retain relevant binary diffs, small owned new-file patches and hashes. Git is the source archive; no source/media/module archives were created. No DirectX/raster/GPU paths were edited. No box is assigned to this offline task. Predecessor bx_9yhx9auy was reported RUNNING/API-idle on its handback with historical expiry 2026-11-04T06:55:13.764Z; the coordinator subsequently reported normal STOP at 06:47:22Z on the messageboard. That is a coordinator report, not a runtime query here. Lifecycle ownership remains with the coordinator. It was never accessed here. No subworker, successor, other game, heavy CLI or deployment was started. This single task stops after publication.