From fdec6bc249eff64909d2889d85cba0773126982a Mon Sep 17 00:00:00 2001 From: ILLISIS Date: Mon, 19 Oct 2026 01:57:27 +1100 Subject: [PATCH] Explain why a prefetched copy needs the run token as well as the generation Co-Authored-By: Claude Opus 5.5 (1M context) --- plugins/player_sync/module/player_sync.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/player_sync/module/player_sync.lua b/plugins/player_sync/module/player_sync.lua index 3459e89f..cfbe533e 100644 --- a/plugins/player_sync/module/player_sync.lua +++ b/plugins/player_sync/module/player_sync.lua @@ -352,8 +352,11 @@ function player_sync.sync_player(acquire_response) -- Epoch is bumped when an admin replaces or deletes the stored data local epoch = acquire_response.epoch or 0 -- A prefetched copy (player_sync.prefetch_inventory) is used only if this reply acquires the player at the copy's - -- generation and the copy was sent with the components synced here now. Otherwise it goes, and the join carries on - -- as if it had never come: today's download or failure dialog, never the restart path below. + -- generation, from the controller run that sent it (token), and the copy was sent with the components synced here + -- now. The generation alone isn't enough: a controller that crashed before saving it restarts at the last saved + -- generation, and another instance's upload can then reuse the same number with other data. Otherwise the copy + -- goes, and the join carries on as if it had never come: today's download or failure dialog, never the restart + -- path below, which only sees a different generation. for _, downloads in ipairs({ script_data.finished_downloads, script_data.active_downloads }) do local record = downloads[acquire_response.player_name] if record and record.prefetch and not (