Tag prefetched copies with the controller's run token

If the controller crashes after sending generation N but before saving it, the destination keeps that prefetch while the controller restarts at N-1, and another instance can then upload different data as generation N. The controller now picks a random token per run, sends it with every prefetch and acquire reply, and the scenario applies a held copy only when its generation and token both match, and lets a new run's copy replace one with another token.

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 ca7caedfbe
commit 5e4dcada50
6 files changed
+84 -18

No files matched your search

+7 -2
View File
@@ -196,6 +196,7 @@ export class AcquireResponse {
public hasData?: boolean,
public message?: string,
public epoch?: number,
public token?: string,
) {
}
@@ -205,10 +206,11 @@ export class AcquireResponse {
"hasData": Type.Optional(Type.Boolean()),
"message": Type.Optional(Type.String()),
"epoch": Type.Optional(Type.Integer()),
"token": Type.Optional(Type.String()),
});
static fromJSON(json: Static<typeof AcquireResponse.jsonSchema>): AcquireResponse {
return new this(json.status, json.generation, json.hasData, json.message, json.epoch);
return new this(json.status, json.generation, json.hasData, json.message, json.epoch, json.token);
}
};
export class AcquireRequest {
@@ -295,15 +297,18 @@ export class PrefetchEvent {
constructor(
public playerData: IpcPlayerData,
/** The controller run that sent it, which a held copy must share with the acquire reply to be applied */
public token: string,
) {
}
static jsonSchema = Type.Object({
"playerData": jsonPlayerData,
"token": Type.String(),
});
static fromJSON(json: Static<typeof PrefetchEvent.jsonSchema>): PrefetchEvent {
return new this(json.playerData as IpcPlayerData);
return new this(json.playerData as IpcPlayerData, json.token);
}
}