reprend #2003: Recover interrupted offline save updates before readback #2740
Closed
github-bot
wants to merge 3 commits from
github-bot/gh-2740 into main
AGit
pull from: github-bot/gh-2740
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2740
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2740"
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?
@OreoFR on GitHub · 2026-11-30 13:40 UTC · original
OreoFR:carry/pr-2003→main· +429 −104 · 4 files · 3 commits · closed without mergingCarries #2003 by @lgr123, because it conflicts with
mainafter #2566 and the reminder to mergemain(#2003) got no answer within the delay of the carry rule. If the author comes back, this carry is dropped.Item:
RT-GAMESAVE-INTERRUPTED-UPDATE-RECOVERY-CARRY(claimed in #2570; original itemRT-GAMESAVE-INTERRUPTED-UPDATE-RECOVERY).What this branch is
d64641bcf, unchanged (no rebase, author commits kept).main(from the carry preparation of 29/11) that resolves the conflict, then a merge of currentmainf9f3ec4c6(no new conflict). Both merge commits carryCo-authored-bythe author.What conflicted and how it was resolved
runtime/shims/xgameruntime_gamesave.cpp(3 hunks): the PR's journal functions withmain'scopy_blobthroughCopyFileW(Wine);recover_update()beforemain's prefix enumeration;ByNamegoes throughmain's traced path.runtime/test/xgameruntime_gamesave_test.cpp(2 hunks): both test entry points and both sets of helpers kept.The save mechanism is rewritten (journal + recovery) and merged with
main's Wine copy path: please read it.gta6rtgains 2 msvcp imports (ios_base::bad,ios_base::eof) from the journal'sstd::ifstream.Tests
mainf9f3ec4c6merged), Windows 11, Python 3.12, no GPU used: C++ only: left to this PR's CI (no local C++ build in this run).ctest501 tests,xgameruntime_gamesavepasses; red: link fails onmain(xgameruntime_gamesave_test_interrupt_afterabsent);big_compile_gatetimed out on the loaded PC, to check on the runners.python -I scripts/check_no_game_data.pyon every file this PR changes: clean.ctest, the full translator suite).Depends on: none.
Needs a careful human read of the resolution and an independent verifier before merge (red/green on another machine).
AI-assisted (Claude Code, oreofr-agent).
🤖 Generated with Claude Code
f9f3ec4c6) into the carry of #2003 38b0b9c12a@merzleckeier on GitHub · 2026-11-30 13:53 UTC · original
Independent interrupted-save red/green on Wine. I merged
38b0b9c1ontomain20fe0c75(tree898b1a41). Itsruntime/tree matches GitHub’s merge155107e3. CachyOS x86-64, Wine 11.22, clang-cl/xwin x64 Release. Synthetic offline saves only.MEASURED. The unmodified
xgameruntime_gamesave_testpassed 176/176 checks, including all seven update checkpoints, interruption during recovery, blocked recovery and retry, sync/async reads, prefix enumeration, metadata, and quota.For the A/B, I ran the same public-API driver against both builds. The
maincontrol only adds the test-only exit hook after the first successful replacement. The PR arm uses its existing checkpoint 3, after two staging/publication checkpoints. The writer was a child process. After it exited with code 83, the controller verified that the old and new files were mixed on disk and then opened a fresh provider.ReadBlobDataafter reopenmainmainAll three PR runs removed the journal after recovery. A second agent checked the raw logs and final file bytes. This exercises controlled process exit and same-volume recovery under Wine. AI-assisted.
@Kal0s-design on GitHub · 2026-11-30 14:25 UTC · original
Native Windows (NTFS) check of
38b0b9c12merged onto currentmainb17b22d33(no conflict, treea0ae8f3d3). It complements merzleckeier's Wine run, since the journal and recovery depend on how the real file system renames and copies. Windows 11, MSVC 19.50 x64.xgameruntime_gamesave_testwas built from the CMake target's own source list, with/W4 /permissive- /utf-8 /DLEONIDA_GAMESAVE_TESTplus the vendoredxtaskqueue, under AddressSanitizer with the debug CRT (/Od /MDd /fsanitize=address). Synthetic saves in a temp folder only.xgameruntime_gamesave_test: 172 checks, 0 failures, exit 0, no ASan report. That includes the update checkpoints and recovery, the async read path, enumeration/metadata on the same generation, and quota excluding the journal scratch, with every handle closed at the end. (merzleckeier's 176 were on an oldermain.)main's runtime + this test: link fails,LNK2019onrt::shims::xgameruntime_gamesave_test_interrupt_after, as the description says, so there's no red run.main's build of the same sources: 4 C4996getenvintest/test_temp_dir.hand 1 C4996 (STL4021) forstd::filesystem::u8path.I didn't read the conflict resolution in
xgameruntime_gamesave.cppline by line. That still needs a human read, as the description asks.GPUs tested: n/a (CPU/file-system test). AI-assisted: yes.
@KelboLive on GitHub · 2026-11-30 15:31 UTC · original
Independent check on Windows (not the author), at
38b0b9c12.runtimeand builtxgameruntime_gamesave_test(MSVC 14.52.37025, Windows SDK 10.0.26100)..display, retirement) and the quota/scratch assertions at the end.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711.
No regressions seen. Based on
f9f3ec4c6; a rebase on currentmainbefore merge would keep history linear.AI-assisted: yes (opencode).
@OreoFR on GitHub · 2026-11-30 15:36 UTC · original
Code read of the save rewrite at head
38b0b9c12(journal + recovery inruntime/shims/xgameruntime_gamesave.cpp, merged withmain'sCopyFileWpath). OreoFR asked me to read it in his place, so this is an agent read on his behalf, not a human read. Nothing was run for this comment: CI on this head is green.Commit protocol, checked step by step:
w<i>(new data) and, for a write over an existing blob,b<i>(a copy of the old one) inside.save-update~, before anything live changes. A failure at this stage removes the journal. Recovery treats a journal withoutactiveas unpublished and deletes it.prepare→active(MoveFileExW, write-through) publishes the manifest, and only then doescreate_directories(dir)and the live renames run.w<i>over the blob, a delete moves the blob tob<i>. Undo reads the same markers: a write whosew<i>is gone was applied, a delete whoseb<i>exists was applied. So recovery never touches a blob the update did not change.restoreand a rename, sob<i>survives a crash during recovery. Restoring again gives the same result, so a second interrupted recovery is safe. A container the update created is removed (non-recursivefs::remove, so only when it is empty).read_manifestvalidates the version, the encoded names (throughdecode_name+valid_*_name, embedded NUL rejected) and theendline before any undo..displayis now part of the atomic set. Before this change it was written after the commit and its failure was ignored..and ends with~, sodecode_namerejects it:list_containers, the quota and enumeration never see it.recover_updateholdsg_mutex.open_providernow takes the lock beforecreate_directories, andread_blobsis reached from locked paths (lines 785/789 and 1172/1175).FILE_SHARE_DELETE.Not blocking, worth knowing:
E_GS_OUT_OF_LOCAL_STORAGEuntil it succeeds. This is fail-loud by design andtest_locked_recoverycovers it, but on a real lock the title sees its save as unreadable rather than stale.remove_allof a retired or unpublished journal fails (a file in it still open), the nextcommitrefuses withE_GS_OUT_OF_LOCAL_STORAGEatcreate_directory(journal)until the cleanup works.<blob>~b~left by the previous code are no longer removed by a later successful update. The old code removed them; this one keeps them on purpose. They are never counted or listed, but they stay on disk.docs/saves.mdand the code comment state.I did not find a defect that loses or mixes save data in these paths. Not covered: a run of the title saving through this code, and the
ByNametraced path the conflict resolution routes through, which I did not reread. The independent red/green on another machine is still needed.AI-assisted (Claude Code, oreofr-agent).
@KelboLive on GitHub · 2026-12-01 16:10 UTC · original · reviewed
Approving for the stated process-interruption scope. The sequence is sound: staged
w<i>blobs and write backups are complete beforeprepareis renamed toactive, live blobs change only by same-volumeMoveFileExW, deletes publishb<i>atomically, and the marker-presence undo withrestore+rename is idempotent — so a second interruption during recovery cannot expose a half-written blob or manifest. A truncated or malformedactiveis rejected before any undo, which is the right fail-closed choice. I rebuilt with MSVC 19.52 andctest -R xgameruntime_gamesavepasses 176/176, and disabling the write-marker undo fails checkpoint 3 with 29 failures, so the interruption test really covers the recovery path.Two documentation corrections, both worth doing before merge because they are about what the feature promises:
FlushFileBuffersand no checksum, andMOVEFILE_WRITE_THROUGHcovers the rename, not the staged data.docs/saves.md's new paragraph says only "process interruption / same volume", while the code comment says "does not provide power-loss durability" — the PR body claims the doc states the caveat, so make the doc say it explicitly.<blob>~write-then-rename mechanism, not the journal.Non-blocking: a test for a truncated
active(the fail-closed path) would pin the validation, and note the overlap — this is the carry of #2003 (same four files; merging this should close it), and #1952 touches the same test file'smain(), so whichever lands second may need a small conflict resolution.Clean-room and merge are fine:
check_no_game_datapasses on all four files,merge-treeis clean, and main has not touched the shim, its test ordocs/saves.mdsince the base (onlyCMakeLists.txtmoved).@aslan2142 on GitHub · 2026-12-01 17:26 UTC · original
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed