fix(fs): closing the game waits for a save being committed, and starts none after #3017

Merged
HumanBean merged 3 commits from PedroRossi/Longshot:fix/close-waits-for-commit into main 2026-12-02 21:41:41 +00:00
Contributor

Summary

Closing the game while an autosave is being committed cuts the commit short. Every way out of the game (the window's
close, the control bridge's quit, the Windows stop worker) ends in hos_close_finish, which waits at most 3 s for a
file open for writing; a commit has none open (nn_fs.c refuses to commit with one), so the game exits mid-commit. The
save is lost, and its staged <n>.longshot-new stays in the committed folder, where it refuses every later commit of
that profile (fs: Commit: 0 files, 2 ops ... result 0x2ee202) until someone deletes it by hand.

hos_fs_hold_saves() (host/nn_fs.c), called right after hos_fs_wait_writes() in hos_close_finish
(host/hos_relaunch.c), takes save_lock and keeps it, waiting at most 3 s as the wait for writes does: a commit
already running finishes first, and none starts after.

How to see it on main: quit (window close, or the bridge's quit) at the moment an autosave's commit stages its first
file. The committed save folder keeps 1.longshot-new, and the next start of that profile can't save.

It builds on #1422, which made the close wait for a file being written. This complements #2806, which makes a later commit recover from a staged file left behind; this keeps it from being
left at all. The two apply together with no conflict (tested together, below).

Read first: hos_fs_hold_saves in host/nn_fs.c, then hos_close_finish in host/hos_relaunch.c.

Testing

Tested: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01, headless with the control bridge. A script started the Market entrance repository save,
teleported until the Transition autosave wrote, and quit at the moment the commit staged its first file ("stage") or
the game wrote its work copy ("write"); then it read the save folder and started the same profile again, which had to
save.

  • main @ 55773e3: 8 runs. The close never waited; each of the 4 "stage" runs left 1.longshot-new, and each next start
    could not save at all (10 of 10 commits result 0x2ee202).
  • this change on 55773e3: 8 runs, all clean. In 5 the close waited for the commit (stop: a save was being committed: waited 20 ms for it); every next start saved; exit 0 every time.
  • #2806 alone: 4 runs. The 2 "stage" runs still left the file; the next start recovered from it and saved.
  • #2806 with this change, on main @ 56823e27: test_fs_save_commit.py (36 PASS: #2806's cases and this one) and
    test_windows_stop.py pass; the game built from main @ 56823e27 with #2806 and this change, 4 runs of the same script: 4 quits while a save was written or committed, in 2 the close waited for the commit, nothing left behind, every next start saved, exit 0.

Checks: the new close case of test_fs_save_commit.py fails on main (the close returns while a commit holds save_lock)
and passes here; test_windows_stop.py passes; the host's C compiled for Windows with llvm-mingw (check_host_compile.py:
0 failed); mise run test (--strict) on main @ 1938a302, and on main with this change merged (together with #3018, #3019, #3020, #3021, #3022, from the same audit): 775 passed, 145 failed, 10 skipped both ways, so none fails only with it. The 145 are named at the end.

Still to test:

  • @Beanstalk Windows and Linux: play, then quit the game normally, expecting the quit as quick as on main and
    no crash (the close now also waits for a save being committed, at most 3 s)
  • Windows, by hand: close the window right after a scene transition's autosave starts, expecting the next
    start to save (two starts: not something the Test Farm plays)

Measurements

Nothing to measure: a close waits for a commit already running, at most 3 s (20 ms in the runs above).

Risks

A close during a commit now lasts as long as the commit (tens of milliseconds here; past 3 s it logs that and exits as
before). A commit asked after the close no longer runs: the game is exiting. A revert undoes it. After updating, players
notice only that a save survives a close.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
The 145 checks of mise run test that fail on main @ 1938a302 on this PC too, with or without this change

97 need a tool this PC doesn't have on PATH (--strict fails them):

  • clang (63): test_audio_output_devices.py, test_box_light_reuse.py, test_camera_centering.py, test_camera_speed.py, test_drive_target.py, test_dynres_sites.py, test_exclusive_marks.py, test_fixed_scale_sites.py, test_floor_carry_step.py, test_frame_rate_cap_step.py, test_frame_whole.py, test_free_view_anchor.py, test_fullscreen_monitor_platform.py, test_high_fps_fixes.py, test_horse_jump_step.py, test_hos_ab.py, test_hud_layout.py, test_jump_takeoff_step.py, test_linux_audio_output.py, test_loop_step.py, test_menu_hooks.py, test_microphone_test_gain.py, test_monitor_friendly_names.py, test_mouse_native.py, test_movement_speed.py, test_movie_frame_count.py, test_nvn_null_pool.py, test_nvn_tex_builder_guard.py, test_ocarina_wait.py, test_ocb_hold.py, test_oot_barrier.py, test_oot_camera_clearance.py, test_oot_cloth.py, test_oot_cloth_60.py, test_oot_cloth_time.py, test_oot_damage.py, test_oot_fov.py, test_oot_heap_retry.py, test_oot_jitter.py, test_oot_shadow.py, test_oot_shadow_fit.py, test_oot_transition_autosave.py, test_oot_voice_option.py, test_oot_wide_bubble.py, test_oot_wide_save_picture.py, test_player_update_sites.py, test_sampler_stack_walk.py, test_saved_turn_rate.py, test_scarecrow_timing.py, test_scene_format.py, test_sdl_monitor_names.py, test_shadow_slot.py, test_song_note_cue.py, test_sound_held_frames.py, test_sprint.py, test_svc_core_mask.py, test_tex_compact.py, test_text_speed.py, test_title_card_sites.py, test_water_substeps.py, test_web_floor_steps.py, test_wide_sites.py, test_wide_ui.py
  • spirv-val (20): f2i_immediate, global_load_16, native_suatom, test_coop_spirv.py, test_default_point_size.py, test_depth_sample_types.py, test_draw_parameters.py, test_fsr4_tune.py, test_guest_page_fast32.py, test_image_arrays.py, test_mesh_fallback_layout.py, test_mesh_unreachable_outputs.py, test_mma_software.py, test_native_float_atomic_add.py, test_nonuniform_image_arrays.py, test_spirv_struct_identity.py, test_texture_phi_dominance.py, test_unsigned_image_types.py, test_vendor_translation.py, test_wmma16_spirv_val.py
  • clang++ (7): test_dead_targets_sweep.py, test_lower_depbar.py, test_lower_lds_after_sts.py, test_lower_register_markers.py, test_native_suatom.py, test_program_answer_domains.py, test_target_pool_cap.py
  • glslang (5): test_framegen_hdr.py, test_fsr3fi_hud_layer.py, test_fsr3fi_hudless_colour.py, test_host_shaders.py, test_temporal_present_bandwidth.py
  • glslang, spirv-val (1): test_fsr3_shaders.py
  • llvm-mc (1): test_lifter.py

48 fail on main itself: test_blocks_at_start.py, test_bug_report.py, test_cloth_kernels.py, test_cloth_loops.py, test_cloth_sphere.py, test_cloth_step12.py, test_cloth_step8.py, test_cloth_step9.py, test_control_picture.py, test_crash_record.py, test_crt_options.py, test_dev_update.py, test_dlssg_pace.py, test_draw_stream_visibility.py, test_framegen_resources.py, test_fsr_uniform_ownership.py, test_game_boundary.py, test_guest_holes.py, test_image_reaper_threads.py, test_image_view_retry.py, test_input_background.py, test_keyboard_option.py, test_linux_pressure.py, test_loaded_modules_drop.py, test_log_levels.py, test_menu_keys.py, test_menu_save_atomic.py, test_mesh_first_types.py, test_oot_occ_raster.py, test_option_ids.py, test_perf_send.py, test_pipeline_tour.py, test_present_acquire_ahead.py, test_present_image_free.py, test_present_source_crop.py, test_program_cache_cleanup.py, test_program_cache_one_variant.py, test_readback_timeout_reuse.py, test_recording_admission.py, test_screensaver.py, test_switch_table.py, test_target_retention.py, test_tex_desc_memo.py, test_thinlto_tls.py, test_upscaler_round_trip.py, test_vram_compact.py, test_windows_display_startup.py, test_windows_on_linux.py


Found in an AI-assisted audit of the repository. The test, the fix, the runs and this description were made with Claude Code; I reviewed them.

Co-Authored-By: Claude Opus 5.5 [email protected]

🤖 Generated with Claude Code

## Summary Closing the game while an autosave is being committed cuts the commit short. Every way out of the game (the window's close, the control bridge's `quit`, the Windows stop worker) ends in `hos_close_finish`, which waits at most 3 s for a file open for writing; a commit has none open (`nn_fs.c` refuses to commit with one), so the game exits mid-commit. The save is lost, and its staged `<n>.longshot-new` stays in the committed folder, where it refuses every later commit of that profile (`fs: Commit: 0 files, 2 ops ... result 0x2ee202`) until someone deletes it by hand. `hos_fs_hold_saves()` (`host/nn_fs.c`), called right after `hos_fs_wait_writes()` in `hos_close_finish` (`host/hos_relaunch.c`), takes `save_lock` and keeps it, waiting at most 3 s as the wait for writes does: a commit already running finishes first, and none starts after. How to see it on main: quit (window close, or the bridge's `quit`) at the moment an autosave's commit stages its first file. The committed save folder keeps `1.longshot-new`, and the next start of that profile can't save. It builds on #1422, which made the close wait for a file being written. This complements #2806, which makes a later commit recover from a staged file left behind; this keeps it from being left at all. The two apply together with no conflict (tested together, below). Read first: `hos_fs_hold_saves` in `host/nn_fs.c`, then `hos_close_finish` in `host/hos_relaunch.c`. ## Testing **Tested:** Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01, headless with the control bridge. A script started the Market entrance repository save, teleported until the Transition autosave wrote, and quit at the moment the commit staged its first file ("stage") or the game wrote its work copy ("write"); then it read the save folder and started the same profile again, which had to save. - main @ 55773e3: 8 runs. The close never waited; each of the 4 "stage" runs left `1.longshot-new`, and each next start could not save at all (10 of 10 commits `result 0x2ee202`). - this change on 55773e3: 8 runs, all clean. In 5 the close waited for the commit (`stop: a save was being committed: waited 20 ms for it`); every next start saved; exit 0 every time. - #2806 alone: 4 runs. The 2 "stage" runs still left the file; the next start recovered from it and saved. - #2806 with this change, on main @ 56823e27: test_fs_save_commit.py (36 PASS: #2806's cases and this one) and test_windows_stop.py pass; the game built from main @ 56823e27 with #2806 and this change, 4 runs of the same script: 4 quits while a save was written or committed, in 2 the close waited for the commit, nothing left behind, every next start saved, exit 0. Checks: the new close case of test_fs_save_commit.py fails on main (the close returns while a commit holds `save_lock`) and passes here; test_windows_stop.py passes; the host's C compiled for Windows with llvm-mingw (check_host_compile.py: 0 failed); `mise run test` (`--strict`) on main @ 1938a302, and on main with this change merged (together with #3018, #3019, #3020, #3021, #3022, from the same audit): 775 passed, 145 failed, 10 skipped both ways, so none fails only with it. The 145 are named at the end. **Still to test:** - @Beanstalk Windows and Linux: play, then quit the game normally, expecting the quit as quick as on main and no crash (the close now also waits for a save being committed, at most 3 s) - Windows, by hand: close the window right after a scene transition's autosave starts, expecting the next start to save (two starts: not something the Test Farm plays) ## Measurements Nothing to measure: a close waits for a commit already running, at most 3 s (20 ms in the runs above). ## Risks A close during a commit now lasts as long as the commit (tens of milliseconds here; past 3 s it logs that and exits as before). A commit asked after the close no longer runs: the game is exiting. A revert undoes it. After updating, players notice only that a save survives a close. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. <details><summary>The 145 checks of <code>mise run test</code> that fail on main @ 1938a302 on this PC too, with or without this change</summary> 97 need a tool this PC doesn't have on PATH (`--strict` fails them): - clang (63): test_audio_output_devices.py, test_box_light_reuse.py, test_camera_centering.py, test_camera_speed.py, test_drive_target.py, test_dynres_sites.py, test_exclusive_marks.py, test_fixed_scale_sites.py, test_floor_carry_step.py, test_frame_rate_cap_step.py, test_frame_whole.py, test_free_view_anchor.py, test_fullscreen_monitor_platform.py, test_high_fps_fixes.py, test_horse_jump_step.py, test_hos_ab.py, test_hud_layout.py, test_jump_takeoff_step.py, test_linux_audio_output.py, test_loop_step.py, test_menu_hooks.py, test_microphone_test_gain.py, test_monitor_friendly_names.py, test_mouse_native.py, test_movement_speed.py, test_movie_frame_count.py, test_nvn_null_pool.py, test_nvn_tex_builder_guard.py, test_ocarina_wait.py, test_ocb_hold.py, test_oot_barrier.py, test_oot_camera_clearance.py, test_oot_cloth.py, test_oot_cloth_60.py, test_oot_cloth_time.py, test_oot_damage.py, test_oot_fov.py, test_oot_heap_retry.py, test_oot_jitter.py, test_oot_shadow.py, test_oot_shadow_fit.py, test_oot_transition_autosave.py, test_oot_voice_option.py, test_oot_wide_bubble.py, test_oot_wide_save_picture.py, test_player_update_sites.py, test_sampler_stack_walk.py, test_saved_turn_rate.py, test_scarecrow_timing.py, test_scene_format.py, test_sdl_monitor_names.py, test_shadow_slot.py, test_song_note_cue.py, test_sound_held_frames.py, test_sprint.py, test_svc_core_mask.py, test_tex_compact.py, test_text_speed.py, test_title_card_sites.py, test_water_substeps.py, test_web_floor_steps.py, test_wide_sites.py, test_wide_ui.py - spirv-val (20): f2i_immediate, global_load_16, native_suatom, test_coop_spirv.py, test_default_point_size.py, test_depth_sample_types.py, test_draw_parameters.py, test_fsr4_tune.py, test_guest_page_fast32.py, test_image_arrays.py, test_mesh_fallback_layout.py, test_mesh_unreachable_outputs.py, test_mma_software.py, test_native_float_atomic_add.py, test_nonuniform_image_arrays.py, test_spirv_struct_identity.py, test_texture_phi_dominance.py, test_unsigned_image_types.py, test_vendor_translation.py, test_wmma16_spirv_val.py - clang++ (7): test_dead_targets_sweep.py, test_lower_depbar.py, test_lower_lds_after_sts.py, test_lower_register_markers.py, test_native_suatom.py, test_program_answer_domains.py, test_target_pool_cap.py - glslang (5): test_framegen_hdr.py, test_fsr3fi_hud_layer.py, test_fsr3fi_hudless_colour.py, test_host_shaders.py, test_temporal_present_bandwidth.py - glslang, spirv-val (1): test_fsr3_shaders.py - llvm-mc (1): test_lifter.py 48 fail on main itself: test_blocks_at_start.py, test_bug_report.py, test_cloth_kernels.py, test_cloth_loops.py, test_cloth_sphere.py, test_cloth_step12.py, test_cloth_step8.py, test_cloth_step9.py, test_control_picture.py, test_crash_record.py, test_crt_options.py, test_dev_update.py, test_dlssg_pace.py, test_draw_stream_visibility.py, test_framegen_resources.py, test_fsr_uniform_ownership.py, test_game_boundary.py, test_guest_holes.py, test_image_reaper_threads.py, test_image_view_retry.py, test_input_background.py, test_keyboard_option.py, test_linux_pressure.py, test_loaded_modules_drop.py, test_log_levels.py, test_menu_keys.py, test_menu_save_atomic.py, test_mesh_first_types.py, test_oot_occ_raster.py, test_option_ids.py, test_perf_send.py, test_pipeline_tour.py, test_present_acquire_ahead.py, test_present_image_free.py, test_present_source_crop.py, test_program_cache_cleanup.py, test_program_cache_one_variant.py, test_readback_timeout_reuse.py, test_recording_admission.py, test_screensaver.py, test_switch_table.py, test_target_retention.py, test_tex_desc_memo.py, test_thinlto_tls.py, test_upscaler_round_trip.py, test_vram_compact.py, test_windows_display_startup.py, test_windows_on_linux.py </details> --- Found in an AI-assisted audit of the repository. The test, the fix, the runs and this description were made with Claude Code; I reviewed them. Co-Authored-By: Claude Opus 5.5 <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The close case of tests/test_fs_save_commit.py: hos_close_finish, cut from host/hos_relaunch.c, linked with nn_fs.c,
while a thread holds save_lock as a Commit does from its start to its end. The close waits only for a file open for
writing, which a commit never has (nn_fs.c refuses to commit with one open), so it returns at once while the save is
still being published, and a Commit asked after it still runs. Fails on main for that reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(fs): closing the game waits for a save being committed, and starts none after
Some checks failed
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
d3925c51c2
Every way out of the game (the window's close, the control bridge's quit, the Windows stop worker) ends in
hos_close_finish, which waited at most 3 s for a file open for writing and then exited. A commit has none open, so a
close during an autosave cut the commit short: that save was lost, and its staged file stayed in the committed folder,
where it refused every later commit of the profile (#2806 makes a later commit recover from it; this keeps it from
being left at all).

hos_fs_hold_saves, called right after hos_fs_wait_writes, takes save_lock and keeps it, waiting at most 3 s (then it
logs that and goes on, as the wait for writes does): a commit already running finishes first, and none starts after.
tests/test_windows_stop.py's stub checks it runs after the wait for writes; the quit's docs say what it waits for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01, headless: from the Market entrance repository save, teleports until the Transition autosave wrote, then the control bridge's quit the moment the commit staged its first file, 8 times: the close waited for the commit (20 ms), nothing was left behind and the next start saved every time; on main the same left 1.longshot-new and the next start could not save

Tested in game: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01, headless: from the Market entrance repository save, teleports until the Transition autosave wrote, then the control bridge's quit the moment the commit staged its first file, 8 times: the close waited for the commit (20 ms), nothing was left behind and the next start saved every time; on main the same left 1.longshot-new and the next start could not save
PedroRossi changed title from WIP: fix(fs): closing the game waits for a save being committed, and starts none after to fix(fs): closing the game waits for a save being committed, and starts none after 2026-12-02 17:54:06 +00:00
Author
Contributor

@Beanstalk Windows and Linux: play, then quit the game normally; expecting the quit as quick as on main and no crash. The close now also waits for a save being committed (at most 3 s).

@Beanstalk Windows and Linux: play, then quit the game normally; expecting the quit as quick as on main and no crash. The close now also waits for a save being committed (at most 3 s).
Member

@PedroRossi only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for d3925c5, and the PR has changed since (0cf92d1), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@PedroRossi only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `d3925c5`, and the PR has changed since (`0cf92d1`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The reported Linux runs show that the change prevents the reproduced interrupted commit, but the new regression test depends on the caller’s profile environment.

The close path waits up to three seconds for the save lock and retains it until exit, protecting an in-progress staged commit. It can extend shutdown by up to three seconds and can still time out.

Blocking (1): must change before merging.

  1. L1 tests/test_fs_save_commit.py:1023: The new close worker inherits the caller’s profile selection, so its save files can be redirected away from the temporary test root. (more on the line) Do: Pass a sanitized environment to the close worker, removing LONGSHOT_PROFILE and other save-location overrides as the save-directory cases do.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 host/hos_relaunch.c:226: The Windows save and shutdown paths still need the in-game run identified in the pull request. (more on the line) Do: Run the stated Windows transition-autosave close and restart check, plus the requested normal-close smoke test, and report the results.

@fix can do L1.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • tests/test_fs_save_commit.py:1088: Is there a Windows-specific failure of the close path that this missing regression case would catch?

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes, for the reported Linux reproduction: four staged-commit quits on main left a staged file and later commits failed; eight runs with the change were clean and subsequent saves succeeded. The reported wait was 20 ms. Windows in-game verification remains outstanding.

Other systems: The lock is shared by staged save operations and bridge save reads on both platforms, not just commits. Windows OS-ending events also have a four-second watchdog that can terminate the process before the two sequential three-second waits finish. Windows gameplay and normal-close runs remain outstanding; no GPU-specific behavior is apparent.

Switches: None added, changed or removed.

Reviewed: d3925c51c2 against 1938a302fe: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, both commits, the complete diff, hos_relaunch.c, windows_stop.c and test_windows_stop.py. Read the changed portions and relevant lock, commit, close and test paths in nn_fs.c and test_fs_save_commit.py; their full output was truncated. Skimmed the changed documentation and test runner. docs/review-checklist.md and the sibling Tooling checkout were absent. No generated files or translations changed.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • No game-derived files, generated files, API version changes or switch changes appear in the diff.
  • The Linux close fixture checks both waiting for a held save lock and exclusion of a later commit.

Testing: No commands that build, run tests or execute project scripts were run. The pull request reports Linux game runs and game-free checks; CI is still running.

Overlaps and merge order: #2806 addresses recovery from a staged file left behind; the description reports testing it together with this change. No other overlap was established.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The reported Linux runs show that the change prevents the reproduced interrupted commit, but the new regression test depends on the caller’s profile environment. The close path waits up to three seconds for the save lock and retains it until exit, protecting an in-progress staged commit. It can extend shutdown by up to three seconds and can still time out. **Blocking (1)**: must change before merging. 1. **L1** `tests/test_fs_save_commit.py:1023`: The new close worker inherits the caller’s profile selection, so its save files can be redirected away from the temporary test root. (more on the line) **Do:** Pass a sanitized environment to the close worker, removing LONGSHOT_PROFILE and other save-location overrides as the save-directory cases do. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `host/hos_relaunch.c:226`: The Windows save and shutdown paths still need the in-game run identified in the pull request. (more on the line) **Do:** Run the stated Windows transition-autosave close and restart check, plus the requested normal-close smoke test, and report the results. `@fix` can do L1. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - `tests/test_fs_save_commit.py:1088`: Is there a Windows-specific failure of the close path that this missing regression case would catch? **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes, for the reported Linux reproduction: four staged-commit quits on main left a staged file and later commits failed; eight runs with the change were clean and subsequent saves succeeded. The reported wait was 20 ms. Windows in-game verification remains outstanding. **Other systems:** The lock is shared by staged save operations and bridge save reads on both platforms, not just commits. Windows OS-ending events also have a four-second watchdog that can terminate the process before the two sequential three-second waits finish. Windows gameplay and normal-close runs remain outstanding; no GPU-specific behavior is apparent. **Switches:** None added, changed or removed. **Reviewed:** d3925c51c20a against 1938a302feb0: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, both commits, the complete diff, hos_relaunch.c, windows_stop.c and test_windows_stop.py. Read the changed portions and relevant lock, commit, close and test paths in nn_fs.c and test_fs_save_commit.py; their full output was truncated. Skimmed the changed documentation and test runner. docs/review-checklist.md and the sibling Tooling checkout were absent. No generated files or translations changed.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - No game-derived files, generated files, API version changes or switch changes appear in the diff. - The Linux close fixture checks both waiting for a held save lock and exclusion of a later commit. **Testing:** No commands that build, run tests or execute project scripts were run. The pull request reports Linux game runs and game-free checks; CI is still running. **Overlaps and merge order:** #2806 addresses recovery from a staged file left behind; the description reports testing it together with this change. No other overlap was established. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -223,2 +223,4 @@
void hos_fs_wait_writes(void); /* (nn_fs.c: a file the game is writing, up to 3 s) */
hos_fs_wait_writes();
void hos_fs_hold_saves(void); /* (nn_fs.c: then a save being committed, up to 3 s; none starts after) */
hos_fs_hold_saves();
Member

L2 (should fix): The Windows save and shutdown paths still need the in-game run identified in the pull request.

When: A Windows close during an autosave exercises native SRW locks and Windows file publication; the supplied successful game runs cover Linux only.

Do: Run the stated Windows transition-autosave close and restart check, plus the requested normal-close smoke test, and report the results.

**L2** (should fix): The Windows save and shutdown paths still need the in-game run identified in the pull request. *When:* A Windows close during an autosave exercises native SRW locks and Windows file publication; the supplied successful game runs cover Linux only. **Do:** Run the stated Windows transition-autosave close and restart check, plus the requested normal-close smoke test, and report the results.
@ -974,0 +1020,4 @@
def close_cases(libpath, tmp):
subprocess.run([sys.executable, "-I", "-B", str(Path(__file__).resolve()), "--close-worker", str(libpath),
Member

L1 (blocking): The new close worker inherits the caller’s profile selection, so its save files can be redirected away from the temporary test root.

When: With LONGSHOT_PROFILE set to a valid profile, the subprocess inherits it; mount selects that profile’s saves while the test creates and checks files under tmp/close. The test fails or operates on the selected profile instead of its isolated fixture.

Do: Pass a sanitized environment to the close worker, removing LONGSHOT_PROFILE and other save-location overrides as the save-directory cases do.

**L1** (blocking): The new close worker inherits the caller’s profile selection, so its save files can be redirected away from the temporary test root. *When:* With LONGSHOT_PROFILE set to a valid profile, the subprocess inherits it; mount selects that profile’s saves while the test creates and checks files under tmp/close. The test fails or operates on the selected profile instead of its isolated fixture. **Do:** Pass a sanitized environment to the close worker, removing LONGSHOT_PROFILE and other save-location overrides as the save-directory cases do.
Owner
@fix
BeanBot force-pushed fix/close-waits-for-commit from d3925c51c2
Some checks failed
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 0cf92d1460
Some checks failed
beanstalk/approval changed since the request: ask again
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Failing after 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 16s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Successful in 4m29s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m9s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 5m13s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 5m10s
CI / Website build and checks (pull_request) Failing after 35s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 16m52s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 42m3s
2026-12-02 21:41:23 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The close worker now uses the temporary save root even when the caller selects a profile. The native Windows save-and-shutdown run is still needed. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 0cf92d1460. I rebased it onto main (3e8105ebf8).

Changed

  • Close worker environment in tests/test_fs_save_commit.py:1023: Removed LONGSHOT_PROFILE and HOS_SAVE_DIR from the close worker’s environment, matching the save-directory cases. Tests were not run, as requested.

Nothing was built or run: the checks run again on the new head.

The change waits for an in-progress save commit during shutdown and prevents a later commit from starting when the lock is acquired. This protects saves at the cost of up to three seconds of additional waiting.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 host/hos_relaunch.c:226: The Windows save and shutdown paths still need the in-game run identified in the pull request. When: A Windows close during an autosave exercises native SRW locks and Windows file publication; the supplied successful game runs cover Linux only. Do: Run the stated Windows transition-autosave close and restart check, plus the requested normal-close smoke test, and report the results.

Checks: they run again on this head; a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Yes on the tested Linux setup: the author reports clean saves and successful subsequent saves in eight runs, compared with four staged files and failed subsequent saves in four stage-triggered runs on main. Windows behavior remains unverified in game.

Other systems: The shutdown path runs on Windows and Linux. Linux was tested in game; the host was reportedly cross-compiled for Windows, but the native Windows save-and-shutdown run remains outstanding.

Switches: None.

Reviewed: 0cf92d1460 against 3e8105ebf8: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the rebased pull request diff and fix diff. Read the changed test worker, its environment setup, save-directory selection and the shutdown tail; skimmed the remaining changed code, documentation and recorded runs. The other changed files were not read in full. Tooling's AGENTS.md was unavailable locally.; nothing run (a code review).

Checked and fine:

  • The fix passes the filtered environment to the close worker and leaves the shutdown change intact.
  • The recorded Linux game runs exercised both shutdown during a write and shutdown during a commit.

Testing: No commands that execute project code or tests were run. CI has not yet run on this head.

Overlaps and merge order: The description identifies #2806 as complementary and reports testing both changes together.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The close worker now uses the temporary save root even when the caller selects a profile. The native Windows save-and-shutdown run is still needed. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 0cf92d1460bb. I rebased it onto `main` (3e8105ebf809). **Changed** - **Close worker environment in tests/test_fs_save_commit.py:1023**: Removed LONGSHOT_PROFILE and HOS_SAVE_DIR from the close worker’s environment, matching the save-directory cases. Tests were not run, as requested. Nothing was built or run: the checks run again on the new head. The change waits for an in-progress save commit during shutdown and prevents a later commit from starting when the lock is acquired. This protects saves at the cost of up to three seconds of additional waiting. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `host/hos_relaunch.c:226`: The Windows save and shutdown paths still need the in-game run identified in the pull request. *When:* A Windows close during an autosave exercises native SRW locks and Windows file publication; the supplied successful game runs cover Linux only. **Do:** Run the stated Windows transition-autosave close and restart check, plus the requested normal-close smoke test, and report the results. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the tested Linux setup: the author reports clean saves and successful subsequent saves in eight runs, compared with four staged files and failed subsequent saves in four stage-triggered runs on main. Windows behavior remains unverified in game. **Other systems:** The shutdown path runs on Windows and Linux. Linux was tested in game; the host was reportedly cross-compiled for Windows, but the native Windows save-and-shutdown run remains outstanding. **Switches:** None. **Reviewed:** 0cf92d1460bb against 3e8105ebf809: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the rebased pull request diff and fix diff. Read the changed test worker, its environment setup, save-directory selection and the shutdown tail; skimmed the remaining changed code, documentation and recorded runs. The other changed files were not read in full. Tooling's AGENTS.md was unavailable locally.; nothing run (a code review). **Checked and fine:** - The fix passes the filtered environment to the close worker and leaves the shutdown change intact. - The recorded Linux game runs exercised both shutdown during a write and shutdown during a commit. **Testing:** No commands that execute project code or tests were run. CI has not yet run on this head. **Overlaps and merge order:** The description identifies #2806 as complementary and reports testing both changes together. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/close-waits-for-commit 2026-12-02 21:41:41 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
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
MagicBeanDev/Longshot!3017
No description provided.