startup: trace declared provider outputs behind an opt-in switch #1317
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1324"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T08:04:37Z.
The optional logging PR you welcomed is up: #1301,
X2W_TRACE_API=1, one line per provider call with the return code, whether the answer came from the stand-in or the real runtime, and which declared output argument was written. It reads only the outputs in a small contract table (user add result, id, guest flag, state, gamertag buffer and used count, age group, privilege result and deny reason, connectivity hint); a slot with no declared contract reportsout=?and nothing is read. The real provider result is left intact — nothing overrides or rewrites it.While writing it I also found that my previous "5,555 successes with no sampled argument changed" figure was too strong and should be withdrawn: with declared outputs, the connectivity hint reports
unchanged3,400 times simply because its four words are constant, so a repeat call leaves identical bytes. "Unchanged" therefore is not evidence that an output was skipped, and the earlier number cannot be read as "an S_OK with an untouched out-pointer". The new line says which case it is per call instead of leaving it to be inferred.Interface identification, since you asked for the contract: the poll pair is provider
37e56907-2f10-41e8-b72f-36edb185331a, interfacebf2346b2-39af-4658-b5ea-44713c7e83b3. That provider is the connectivity family in our stand-in (slot 15 is answered locally as a connectivity hint with levelnone, cost unknown,initializedset — the "stack initialized, no connectivity" answer already in the code), and slot 2 is not covered by the stand-in at all, so it passes through to the real runtime and returnsS_FALSE(0x00000001) there, 5,587 times in the last run, immediately before the assertion.So the typed poll you asked for is the next step and I have what it needs: a fixture that asks that interface for connectivity and distinguishes ready-with-item / empty-not-ready / failure, and records which of the three the real runtime gives for slot 2 versus what our hint says for slot 15. The contract I still cannot state from the code is what slot 2 is supposed to mean — if you can name the interface method, I will pin the documented return and output values into the fixture instead of inferring them.
Keeping the factory diagnosis open, as instructed: the trace ties the last call before the assertion to a
S_FALSEpoll, but has not tied that call to the consuming condition inside the factory.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:08:53Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
dce4ce6da0ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T08:14:33Z.
Review: CHANGES_REQUESTED
The opt-in trace still takes eight bytes from every output, even when the declared output is a flag, DWORD or a shorter caller buffer. A readable page does not establish the object's size. Please store the actual size/type in the contract, bound the snapshot by the declared buffer capacity, and report every changed output. The current
writtensentinel also treats index 0 (connectivity) as unchanged. A source-built control should cover index 0, two changed outputs, exact-width and short buffers, and a same-value write (which should remain reported as no observed change). Unknown slots should remain opaque. Please link #1160 in the PR body.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:17:01Z.
Review: COMMENTED
Reviewed at commit
dce4ce6da0208bf65816bf1fbbbebb7f739d51b0.Code Review & Findings
writtensentinel forarg0): inforward(),int written = 0;is used both as the "no output changed" sentinel and as the index of the changed argument (if (now != before[i] && !written) written = index;andif (written)). For{0x37e56907, 15, 0, no_second},declared->firstis0(arg0), so whenargs[0]changes,writtenstays0andout=unchangedis logged instead ofout=arg0. Initializingint written = -1;and checkingwritten < 0/written >= 0resolves this.x2w_local::readable(..., 8)safely avoids probing arbitrary non-pointer arguments, though a 4-byte output sitting in the final 4 bytes of a page will reportout=unreadable(safe, just worth noting).15and20), only the first modified output is reported (out=arg3even ifarg4also changed).tests/startup_stub_consumer.cppexercisesX2W_TRACE_API=1yet.Verification
Linux:
git diff --check origin/main...HEAD: cleanpython -B tests/docs_links_check.py: passed (16 Markdown files, 286 links)python -B tests/bidi_controls_check.py: passed (1076 files)Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
--preset dev):cmake --build --preset dev --target startup_stub_gameinput startup_stub_consumer -- -j 6(4.95s) +ctest --preset dev -R '^startup_stubs$' --parallel 4 --no-tests=error --output-on-failure: 1/1 passed (0.67s)/O2(--preset release):cmake --build --preset release --target startup_stub_gameinput startup_stub_consumer -- -j 6(2.94s) +ctest --preset release -R '^startup_stubs$' --parallel 4 --no-tests=error --output-on-failure: 1/1 passed (0.44s)Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T08:30:15Z.
Review: CHANGES_REQUESTED
The declared widths and arg0 handling are improved. The revised loop stops after the first changed output and still has no source-built trace control. Please log both changed output indices where applicable, and distinguish “at least one compared and unchanged” from a partial comparison when another declared output was unreadable. Keep the text about observed byte changes precise: a provider can write the same value. Please add the index 0, two-output, exact/short-buffer and same-value controls from the previous review before requesting another pass.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T08:53:19Z.
Review: APPROVED
Retested the new trace and startup stand-ins on Windows Release (2/2). The declared width/capacity, arg0, two changes, same-value and partial cases now match the requested scope. The provider result stays unchanged.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:04:52Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
dce4ce6ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T08:19:30Z.
All four findings and R0Y00's request are addressed in
8d6c5477.Widths (R0Y00 + the third finding). The contract now carries each output's real width instead of taking eight bytes everywhere: 1 for the guest flag, 4 for the state, age group and deny reason, 8 for handles/ids/used counts, 16 for the connectivity hint, and for the gamertag a caller-sized buffer whose capacity comes from the size argument, bounded by it and by a small cap.
readablewas checking page accessibility, not the object's extent, which is exactly the hole you both identified.writtensentinel (R0Y00 + the fourth finding). Index 0 is a real output — the connectivity hint — soint written = 0double-counted it as "nothing changed". It is now-1with a separate notion of "any output was readable", so a changed hint reportsarg0instead ofunchanged.Slot contracts (first finding).
XUserGetIdis slot 11; slot 12 isXUserFindUserById. Both are declared, plus the duplicate-handle (3), local-id (9), find-for-device (40) slots that were missing for the same reason.Secondary gamertag interface (second finding). Provider
0xcef4fac0slot 3 now has its own row, so its buffer and used count are traced rather than reported as unknown.Measured with
X2W_TRACE_API=1over a 60 s offline run (5,638 calls):The
unchangedcount collapsing from thousands to four is the width fix working: the constant hint is now compared over its real 16 bytes and correctly reported as written.startup_stubspasses; nothing changes unless the switch is set.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T08:34:26Z.
Second review addressed in
9731fae2, including the source-built controls.Every changed output is reported. The loop no longer stops at the first: it prints
changed:0orchanged:3,4.The three outcomes are now distinguished, which is what the single word was conflating:
samesame,partialunreadableWording about providers. All text about observed bytes now says "same value", never "not written": a provider can write the value that was already there, so identical bytes are not evidence of a skipped write.
Source-built controls. The decision now lives in
src/startup_stubs/api_trace.hwith the contract table, so it is testable without a title.tests/api_trace_check.cpp(ctestapi_trace) covers the four cases you asked for:It also asserts the table answers for
XUserGetId(11),XUserFindUserById(12), the secondary gamertag interface (0xcef4fac0slot 3) and the connectivity hint (0x37e56907slot 15) - the four contracts the previous round added or corrected.api_tracepasses (13 cases) andstartup_stubspasses; nothing changes unlessX2W_TRACE_APIis set.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:08:53Z.
Code review location:
src/startup_stubs/runtime_proxy.cpp; line 92With
X2W_TRACE_API=1, a user-provider call toXUserGetIdreaches slot 11 inuser_call, but this table only declares slot 12, soforwardleavesdeclarednull and logsout=?for the ID output; slot 12 isXUserFindUserById. Add the slot-11 declaration and keep slot 12 under its actual contract if it is also meant to be traced.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:08:53Z.
Code review location:
src/startup_stubs/runtime_proxy.cpp; line 95When
QueryApiImplreturns the dedicated gamertag interface,proxy_querynormalizes its provider key togamertag_iid_data1(0xcef4fac0) andforwardhandles slot 3. This row only matches the base user provider at slot 15, so the secondary interface's known buffer andusedwrites are logged asout=?; add a declaration for that provider and slot.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:08:53Z.
Code review location:
src/startup_stubs/runtime_proxy.cpp; line 120For scalar outputs such as
XUserGetIsGuest(1 byte) andXUserGetState(4 bytes), this probes and copies 8 bytes.readablechecks page accessibility, not the output object's extent, so tracing can read past a valid short output or classify it as unreadable when it straddles a page; carry each output's actual width, including the gamertag buffer's supplied size.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:08:53Z.
Code review location:
src/startup_stubs/runtime_proxy.cpp; line 172When tracing
0x37e56907::slot15, the declared output isargs[0]andarea_callwrites the words there. If that readable output changes, this stores the argument index0inwritten, but the later truth test treats zero as no write and logsout=unchanged; use a separate changed flag or a nonzero sentinel.Useful? React with 👍 / 👎.