diff --git a/lib/mcp-update.js b/lib/mcp-update.js index 0960eff..6348775 100644 --- a/lib/mcp-update.js +++ b/lib/mcp-update.js @@ -14,6 +14,7 @@ class McpUpdate { this.writes = Promise.resolve(); this.task = null; this.resumeTask = null; + this.recoveryJobId = null; this.ready = false; } async load() { @@ -28,6 +29,7 @@ class McpUpdate { if (error.code !== 'ENOENT') throw new McpAccessError('UPDATE_STORE_UNAVAILABLE'); } this.ready = true; + this.recoveryJobId = this.active()?.id || null; } async save() { const data = JSON.stringify({ version: 1, jobs: this.jobs }); @@ -137,7 +139,7 @@ class McpUpdate { async recover({ rendererReady, connected }) { if (!this.ready || this.task || this.resumeTask || !rendererReady) return; const job = this.active(); - if (!job) return; + if (!job || job.id !== this.recoveryJobId) return; this.resumeTask = (async () => { if (job.phase === 'awaiting_reconnect') { if (connected) await this.phase(job, 'completed', { completedAt: Date.now(), reconnectedAt: Date.now() });