xgameruntime: gifting UI completes its block, speech without used, MountWithUi and TitleId gaps (RT-OFFLINE-GDK-SHIM-GAPS) #2520
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2520"
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 ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-28T00:23:19Z.
Package RT-OFFLINE-GDK-SHIM-GAPS: item 3 of @kevincommits' finding on #1608 (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7226429207). Thank you for the find. Claim: https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230865771.
What changes
xgameruntime_store.cpp, slot 82XStoreShowGiftingUIAsync.offline_failure_async<82, 5>, like the other 14 offline*Asyncslots (review M11). Its block is started and completed withE_FAIL, so a caller waiting on it gets an answer.storeContextHandle, storeId, name, extendedJsonData, async. Microsoft's own bindings in microsoft/XBOX-GDK-dotnet (Native.Store.cs) have this signature. xgameruntime-docs lists the slot but not its arguments.xgameruntime_offline.cpp,XSpeechSynthesizerGetStreamData.LEONIDA_LOCAL_SPEECH=1) is forwarded even whenusedis null.bufferUsedis_Out_opt_. Before, the call fell through and returnedE_INVALIDARG.env_is_one.xgameruntime_offline_set_host_speech, sets a fake host.xgameruntime.cpp,XPackageMountWithUiAsync.E_ACCESSDENIED, asXPackageMountrefuses it. Before, it completed withE_GAMEPACKAGE_NO_PACKAGE_IDENTIFIER.s_active_mounts. If the new run does not start, the earlier mount keeps its place.xgameruntime.cpp,XGameGetXboxTitleId. It skips a<TitleId>inside an XML comment, aspackage_localesalready does. The comment stripping is now one shared helper.Tests
New checks, following the repros:
xgameruntime_store_test: slot 82 with the block as the 5th argument starts and completes withE_FAIL, and slot 83 returnsE_FAIL.xgameruntime_offline_test, with a fake host accessibility object: a host stream's data is forwarded with and withoutused. With no host, a foreign stream is still refused.xgameruntime_test:ERROR_NOT_FOUND);E_ACCESSDENIED;<!-- <TitleId>DEADBEEF</TitleId> --><Game><TitleId>12345678</TitleId></Game>gives0x12345678.With main's logic, 5 of the new checks fail. The fake host needs the new hook, so for that check only the
&& usedcondition was put back. With the fix, all pass, andctest -R xgameruntimepasses 8/8.Profile M: RTX 4070 SUPER, Windows 11, Ryzen 7 9800X3D, MSVC RelWithDebInfo. CPU only. The full suite was not run because a boot was running.
git diff --checkandscripts/check_no_game_data.pyare clean. No open PR touches these functions. No game files used.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T01:33:55Z.
Reviewed at head
c030bfd2eon Windows 11 (MSVC 202219.44).Verification
xgameruntime_test,xgameruntime_store_test,xgameruntime_offline_test,xgameruntime_user_test,xgameruntime_gamesave_test, andgta6rt.xgameruntime_test189,xgameruntime_store_test29,xgameruntime_offline_test77,xgameruntime_user_test46,xgameruntime_gamesave_test91).Finding (Request changes)
MountWithUiAsyncreuse can strand an unread prior mount handle (xgameruntime.cpp:1525-1550;third_party/xtaskqueue/Source/Task/AsyncLib.cpp:434-440,478-503):If a prior
MountWithUiAsynccompleted onasync(with its handle still unread ing_ui_mounts) and the caller reuses that completedXAsyncBlockwithqueue == nullptrwhen no default process task queue is set,AllocState()passes the active-signature check (AsyncLib.cpp:478), zeroesasync->internal, failsAllocStateNoCompletion()withE_NO_TASK_QUEUE, and writesinternal->status = E_NO_TASK_QUEUE(AsyncLib.cpp:500).pkg_mount_with_ui_asyncthen seesFAILED(hr)and restoresg_ui_mounts[async] = replaced(xgameruntime.cpp:1536). Because the block's prior completion state was already overwritten and the caller received a synchronous failure fromMountWithUiAsync, discardingasyncleavesreplacedstranded ing_ui_mountswithout closing it.Only restoring
replacedwhenhr == E_INVALIDARG(whereAllocState()rejected an in-flight block without touchinginternal), and closingreplacedon otherXAsyncRunfailures, keeps ownership consistent.Gifting slot 82 (
xgameruntime_store.cpp:495), optional nullusedin speech (xgameruntime_offline.cpp:759-766), and comment-skippingTitleIdlookup (xgameruntime.cpp:1645-1650) all look good.AI-assisted review + local MSVC verification.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T07:36:24Z.
#2520 | head
c030bfd2ed(merged cleanly with main09c1539483) |ctest --test-dir runtime/build -C RelWithDebInfo -R "^xgameruntime" --output-on-failure| red on main:xgameruntime_testfails (3 of 189 checks failed: reusedXAsyncBlockleaked the earlier mount handle, mounting the game's own package returnedE_GAMEPACKAGE_NO_PACKAGE_IDENTIFIERinstead ofE_ACCESSDENIED, and<TitleId>inside an XML comment was matched);xgameruntime_store_testfails (1 of 29:XStoreShowGiftingUIAsyncfailed synchronously instead of completingXAsyncBlock);xgameruntime_offline_testfails to link (LNK2019: missingxgameruntime_offline_set_host_speech; onmain,speech_stream_datarequired non-nullused) | green on PR+main:8/8CTests pass (xgameruntime189/189,xgameruntime_user,xgameruntime_gamesave91/91,xgameruntime_store29/29,xgameruntime_offline77/77,xgameruntime_offline_hdr77/77,xgameruntime_user_gamertag,xgameruntime_user_gamertag_long);check_no_game_data.py0violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yesImported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T14:36:23Z.
Review: COMMENTED
Static code audit against
c030bfd2e+ec740bcc3. Request changes.runtime/shims/xgameruntime.cpp:1538— If a finished mount is still unread and reuse fails withE_NO_TASK_QUEUE,AllocStatehas already overwritten the old completion. The rollback restores the old mount to the map, where it remains if the caller discards the failed block. Close the old handle when the failed begin invalidates its completion. Preserve it when the original operation still owns the block.runtime/shims/xgameruntime_store.cpp:496— On an undispatched manual queue, gifting Async returnsS_OKand the block isE_PENDING, but gifting Result returns terminalE_FAIL. Have Result take the block and return its nonblocking status. Pass that same block in the test and check pending status, completion, and callback delivery.runtime/shims/xgameruntime.cpp:1065— The literal<!--inside a legal XML processing instruction is treated as an unterminated comment. This can discard the real TitleId later in the file. Skip processing instructions when recognizing XML comments and add a fixture for this case.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T20:10:33Z.
Review: COMMENTED
Reviewed and locally tested
c030bfd2e(runtime/shims/xgameruntime*.cpp,runtime/test/xgameruntime*_test.cpp).Local verification:
xgameruntime_test,xgameruntime_store_test,xgameruntime_offline_test,xgameruntime_user_test,xgameruntime_gamesave_test(MSVC Release / Ninja) and ranctest -R ^xgameruntime: 8/8 passed (xgameruntime,xgameruntime_user,xgameruntime_gamesave,xgameruntime_store,xgameruntime_offline,xgameruntime_offline_hdr,xgameruntime_user_gamertag,xgameruntime_user_gamertag_long).python -I scripts/check_no_game_data.py: passed.Holding off on approval because code inspection confirms two remaining gaps from the earlier audit:
runtime/shims/xgameruntime_store.cpp:495-496:XStoreShowGiftingUIAsyncwas switched tooffline_failure_async<82, 5>, butXStoreShowGiftingUIResult(slot 83) still usesoffline_failure<83>instead of reading the block viaXAsyncGetStatus, so calling Result before the manual queue dispatches returnsE_FAILrather thanE_PENDING.runtime/shims/xgameruntime.cpp:1525-1545: inpkg_mount_with_ui_async, restoringg_ui_mounts[async] = replacedonFAILED(hr)afterXAsyncRunhas already invalidated the prior completion can strand the previous mount handle if the caller discards the failed async block.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:03:49Z.
Verified by OreoFR
c1ecf04ed+ PR headc030bfd2e; green run in a merge package of 2 PRs, no new ctest failure vs mainctest -R "^(xgameruntime|xgameruntime_store|xgameruntime_offline)$"AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:46:52Z.
Run on PR head
c030bfd2e(based44285197, 1 commit; the base is old), checked against main1bc055e6c(and origin/mainc7753ed98):git merge-tree --write-treefinds no conflict with either.Environment: NVIDIA GeForce RTX 3090 (24 GB), driver 621.40, Windows 11 Pro (build 26300), MSVC 14.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, SDL3 3.4.20 static installed. CPU tests only.
Configure (as scripts/build_runtime.ps1 does, own build folder):
cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON. Only the test targets were built, not the whole runtime:cmake --build runtime/build -j 8 --target xgameruntime_test xgameruntime_store_test xgameruntime_offline_test xgameruntime_user_test xgameruntime_gamesave_test(the last two are not changed by the PR, built so the wholexgameruntimegroup runs).Green (PR head):
ctest -R "^xgameruntime" --output-on-failure-> 8/8 passed (xgameruntime,_user,_gamesave,_store,_offline,_offline_hdr,_user_gamertag,_user_gamertag_long).Red (behavioural: the PR's tests and the test hook
xgameruntime_offline_set_host_speechkept;xgameruntime.cppandxgameruntime_store.cppput back to based44285197; inxgameruntime_offline.cpponly the&& usedcondition ofspeech_stream_dataput back). Rebuiltxgameruntime_test xgameruntime_store_test xgameruntime_offline_test,ctest -R "^xgameruntime(_store|_offline|_offline_hdr)?$"-> 0/4 passed, 5 new checks fail:Red (literal revert of
xgameruntime_offline.cpptoo):xgameruntime_offline_testdoes not link (unresolvedxgameruntime_offline_set_host_speech), so for that one test the plain revert is only "the new hook is missing"; the run above is the behavioural red.Link check: merged into main
1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:04:58Z.
Merged after enlight3d (Thib)'s red/green run (RUN, RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and
gta6rt.exestill links) and a re-check here: no conflict withmainf64162d0a, same head as run,no-game-datagreen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known onmainor Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ).AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.