Check the run token on every prefetched chunk

Chunks of an earlier controller run's copy still in flight could land in a newer run's copy of the same generation. Every chunk now carries the token, and the scenario ignores a chunk whose token differs from its record's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ILLISISandClaude Opus 5.5 committed 2026-10-20 12:24:24 +11:00
1 parent 5e4dcada50
commit 17f029e39e
3 files changed
+10 -9

No files matched your search

+2 -1
View File
@@ -289,7 +289,8 @@ export default async function(context: InstancePluginContext) {
logger.verbose(`Prefetching ${name}`);
// This side doesn't know the save's cleared recipe list, so the whole stored list goes as a full delta
await sendPlayerData(playerData, undefined, (chunk, number, total, extra) => {
const tokenArg = number === 1 ? `,'${token}'` : "";
// Later chunks have no components argument, so nil holds its place
const tokenArg = number === 1 ? `,'${token}'` : `,nil,'${token}'`;
const args = `'${name}',${generation},'${chunk}',${number},${total}${extra}${tokenArg}`;
return `/sc player_sync.prefetch_inventory(${args})`;
}, true);