Files
betterxen/docs/process/working-method.md
T
ates eee9a4fcdc docs: how blockers are found once the target build runs
Working method: people play with recording on, agents replay short
routes through the input shim as ten-run regression tests, and picture
bugs are worked on from captured frames replayed offline. Lists the
signals a problem is recognised by and adds the three tools to the
starting queue.

Signed-off-by: ates <ahmetrizaates@hotmail.com>
2026-11-29 10:27:51 +03:00

14 KiB
Raw Blame History

Working Method: the Blocker Queue

Status: proposed, together with the matching change to AGENTS.md §0.

BetterXen is built by collaborators who each have the project-authorized target build and who work by pointing a coding agent at this repository and saying "work". This document is written for that. It answers one question for an agent that has just been told to work: what is the single most useful thing to do now, and how do I do it without colliding with the other agents?

There are no meetings, no rotating roles and no plan to interpret. The state of the project is in GitHub; the rules are here and in AGENTS.md.

Why this shape

What the first target-build runs taught us:

  • The build finds what tests cannot. With the start-up milestone verified complete, the build still stopped on a missing handle-duplication call, an instruction loop that trapped two million times and a page-remapping race. Nobody would have written an issue for any of them in advance.
  • Guessing is expensive. A stall was blamed on network polling for a day; a thread sample found the real cause in minutes.
  • A helpful workaround can hide the real path. Answering every pipeline call with success kept the frame loop alive and hid the build's fallback to shader containers.
  • One run proves little. The build takes different start-up paths from run to run. Two blockers looked like one "intermittent stop" until runs were counted.
  • Agents left alone drift. They wrote long documents, opened large stacked pull requests that nobody reviewed, investigated the same symptom twice, shared one game bottle and filled a disk.

So: the build decides what is next, the queue makes it unambiguous, and reviewing comes before new work.

The stages

The roadmap is a ladder of stages the target build reaches: Boot → Picture → Menus → World → Fidelity → Playable. Exactly one stage is current. Its exit gate is a ten-run check anyone can repeat.

Where the state lives

What Where Who writes it
The current stage and its latest gate result The pinned ladder issue (label ladder) Any agent that runs the gate check
Everything the build is known to stop on One blocker issue each (label blocker, plus stage: <name> and a track label) The agent that found it
Who is working on what A claim comment on the blocker issue The claiming agent
What needs a person Label needs-human Any agent
Rules AGENTS.md and this document Maintainers, by pull request

Nothing about status is kept in files in the repository: agents editing one status file would conflict all day.

Blocker issues

A blocker issue is small and has a fixed shape, so that two agents that find the same thing file the same issue.

  • Title: [blocker] <signature>. The signature is taken from the run report, not invented: for example unimplemented IXUser slot 3, fault in XCRDAPI.dll (write, unmapped), exit status 1 after save query, stall: presenting thread in trapped instruction. Before filing, search open and closed issues for the signature.
  • Body: the stage it blocks; how many of ten runs hit it; the run-report lines; what is known and not known. No bytes, names, hashes or addresses from the build.
  • Order: within a stage, the label first marks blockers that every run hits before any other; after those, lower issue number first.

What an agent does when told "work"

AGENTS.md §0 has the binding version. In short, in strict order:

  1. Preflight. Tools, login, disk space, an own bottle, a current main.
  2. Your own pull requests first. Requested changes, failing checks or conflicts on a pull request your person opened.
  3. Then review. The oldest open, non-draft pull request from another person that has no current review. Review it, and merge it if it is approved, green and not your person's. Review comes before new work because unreviewed work is worth nothing to the next run.
  4. Then one blocker. The top unclaimed blocker of the current stage. Claim it, and do only that.
  5. Then discover. If the current stage has no unclaimed blocker, run the stage's gate check and file what it finds. If the gate passes, post the result on the ladder issue and label it needs-human: a person confirms the stage change.
  6. Otherwise stop. Report that the queue is empty. Do not invent work.

An agent stops and labels needs-human whenever it meets a decision that is not its to make: a decision gate, a licence or provenance question, a rule change, or two sources of truth that disagree.

Working one blocker

claim → evidence → smallest fix + test → ten runs → pull request → (someone else reviews and merges)
  1. Claim. Comment Claiming — branch: track-<a..f>/<issue>-<slug> on the issue. A claim with no commits or pull request after 3 days is free to take; say so in a comment when you take it.
  2. Evidence before code. Find what the build asked for and what it got. Use the run report, then the diagnostics (thread sampler, fault context, call trace). If that does not explain it within the session, write what was learned on the issue and release the claim; do not guess a fix.
  3. Smallest fix. Only what removes this blocker, inside the track directories it needs. A new cross-DLL export still goes through an [ABI] pull request first.
  4. A test for the contract. Every contract the fix teaches a shim gets a synthetic conformance test that fails without the fix.
  5. Proof. Ten runs before and ten after. Report every run.
  6. Pull request. One blocker, five short parts (below). Then stop: the next "work" starts from the top of the list.

Pull-request description

Five parts and nothing else:

  1. Blocker: Closes #<issue> and one sentence on what the build did.
  2. Contract: what the console does, and which source says so (ranks below).
  3. Fix: what changed.
  4. Test: the conformance test, and that it fails without the fix.
  5. Proof: before and after over ten runs (for example "status-5 exits: 4/10 → 0/10"), with the machine and the main commit.

Review

The reviewing agent checks out the branch, runs the Section 8 commands and the new test, confirms the test fails without the fix, and reads the proof. It does not repeat the ten runs unless the proof looks wrong.

Deep review — re-deriving the contract from its source, by an agent working for a different person than the author — is required only for:

  • a change under abi/;
  • a new or changed translator instruction class;
  • a contract from source rank 4 or 5;
  • anything touching the sandbox, security or licensing.

Merging. The author's agent never merges its own person's pull request. Any other collaborator's agent merges once the pull request is approved and green. A pull request that is green and unreviewed after one working day gets the label needs-human.

Stacks. A pull request is based on main. One level of stacking is allowed when a fix truly needs an unmerged one; deeper stacks are not.

Run protocol

A run counts only if it is made this way. The launcher does it; agents do not hand-roll it.

  • Build: current main, or main plus exactly the one branch under test.
  • Sandbox: the offline runner, which refuses to start unless a probe confirms outbound network is blocked.
  • Bottle: one per agent session, created by the launcher and named for the session. Never a shared one.
  • One game at a time per machine. The launcher takes a machine-wide lock; a second run waits.
  • Disk: at least 10 GB free, checked before the run; the session's scratch bottle and build directory are removed afterwards.
  • Count and length: ten runs, each as long as the stage needs (five minutes for Boot).
  • Machine: the report states chip and memory. Gates are judged on 16 GB machines.

The run report is generated, not written. Per run:

  • outcome: frames presented, clean timeout, early exit with its status, or hang;
  • the start-up path taken;
  • every unimplemented call reached, counted;
  • every fault inside a BetterXen module;
  • pipelines drawn with: translated, passed through, skipped;
  • on a stall: every thread's stack.

It ends with a ten-run summary and a list of signatures, the strings blocker issues are titled with.

Sources of truth

When a fix needs to know what the console does, use the strongest source available and name its rank in the pull request.

Rank Source Notes
1 Authorized GDK documentation and headers Derived facts may be committed. The files never are.
2 Our own compiler output for our own source Built with the console compiler from the GDK.
3 Run-time observation of the target build What it calls, with what, and what it does with the answer.
4 Call-site analysis of the target build (a disassembler such as Ghidra) When observation cannot explain a wait or a branch. Local only.
5 The authorized upstream emulator's source A hint about what the build needs, not a reference for correctness. Confirm with ranks 1–4 or with runs.

Collaborators may install the GDK and a disassembler for this. AGENTS.md §6 is unchanged: nothing from the build enters git, issues or pull requests — no bytes, file names, hashes, addresses or decompiled code.

Evidence and references

  • Private evidence store. Run logs, dumps, disassembly and captures go in a folder outside the repository on the collaborator's machine. Issues and pull requests carry counts, sizes, call shapes and the contract learned.
  • Reference images (needed from the Picture stage on): a collaborator's own capture from a real console running the same content, or published footage. They live in the private store; a pull request says "matches reference screen 3".

Finding blockers once the game runs

From the Menus stage on, the build no longer stops by itself at the next missing piece: someone has to take it somewhere. Agents are poor players, so the method does not depend on an agent holding a controller. BetterXen owns both ends of the build's contact with the machine — input (GameInput) and graphics (d3d12_xs) — and records and replays both.

1. People play; the launcher records. A play session with recording on saves the input stream with timestamps and the save files it started from. A hotkey marks a moment ("texture wrong here", "audio cut out"). A crash or hang needs no mark: the run report has it.

2. Agents replay routes. A route is a starting save plus a short recorded input stream (about two minutes: load, walk somewhere, enter a vehicle). An agent replays it through the input shim and compares the run with the last good one. Replays drift, because the build is not deterministic, so routes stay short and start from a save. Each route is a regression test, run ten times like any gate.

3. Frame capture and offline replay. The graphics layer records every call the build makes for one frame, with the data it referenced. The frame is then redrawn without the build running, in seconds and identically every time. An agent fixing a picture bug replays that frame after each change instead of booting and travelling to the spot again.

How a problem is recognised, from most to least reliable without a person:

Signal Catches Needs a person
Crash, hang, early exit Stability No
Run-report counters: skipped draws, stubbed shader instructions, unimplemented calls, failed storage requests Missing pieces, even when the picture looks plausible No
Frame compared with the last good capture of the same route Regressions No
Frame compared with a console reference image Wrong rendering To supply the reference
An agent looking at a capture Obvious breakage: black screen, missing geometry, garbage textures No; subtle errors are missed
A person's mark during play Feel, audio sync, input lag, anything that "looks off" Yes

Findings enter the queue as blocker issues with signatures of the same kind: route 7: crash at 1:40 (3/10), capture 12: 340 draws skipped, capture 12: differs from reference in the sky. The order of work does not change.

Whether the game is good to play is a question only people answer. Their time goes into playing and marking, never into reproducing or bisecting.

What people do

People are needed for exactly four things, each marked needs-human:

  1. confirming a stage change after a gate passes;
  2. deciding a decision gate (for example the graphics back end);
  3. licence, provenance and legal questions;
  4. changing these rules.

Everything else is the queue.

Starting the queue

The queue starts with what the first target-build runs already found. Each line becomes a blocker issue or a tooling issue when this proposal is accepted.

Stage Signature or task Track
Boot Run tooling in the repository: offline runner, per-run report with signatures, ten-run summary, thread sampler, machine-wide run lock, per-session bottle A
Boot stall: presenting thread in trapped CLZERO loop A
Boot unimplemented IXUser slot 3 (handle duplication) E
Boot unimplemented IXGameRuntimeCore slots 6, 13, 14, 15 (async run; task-queue composite, port, duplicate) E
Boot unimplemented IXGameSaveImpl slot 13 (container info; and slot 15) E
Boot fault in XCRDAPI.dll (write, unmapped) — page remapping is not atomic B
Boot serialized-pipeline calls succeed with a null pipeline — they must fail and be logged C
Boot exit status 1, nothing logged (1 run in 5) A
Picture D3DMetal capability checks: direct heap indexing, 64-lane compute through the translator, 64-bit atomics, mesh and amplification shaders D, F
Picture Vendor the upstream translator with provenance entries; amend ADR 0008 D
Picture Translator behind bx_shader_bridge.dll; host pipelines created on first use C, D
Picture placed texture contents not uploaded C
Picture build waits after sign-in with nothing unimplemented — needs evidence E
Picture Reference images for the first screens needs-human
Menus Input record and replay in the GameInput shim; routes as ten-run regression tests E, A
Menus Play-session recording in the launcher: input stream, starting saves, mark hotkey A
Fidelity Frame capture in d3d12_xs and an offline frame replayer C

Fixes for several Boot lines exist on a local experiment branch; they still go through the queue, one pull request each, with tests and ten-run proof.