A desktop coding agent with free access to frontier models.
TypeScript
fix: reopen paused project sync on resume
ogsamrat5c89b08f5ec7
diff --git a/apps/server/src/session-archive/index.test.ts b/apps/server/src/session-archive/index.test.tsindex b5ea57f1..b928084b 100644--- a/apps/server/src/session-archive/index.test.ts+++ b/apps/server/src/session-archive/index.test.ts@@ -620,6 +620,30 @@ describe("SessionArchiver", () => {await third.stop();});+ test("a session an earlier release stopped on a sequence conflict goes on from the server's chain at its next prompt", async () => {+ const server = new FakeArchiveServer();+ const { root } = await project();+ const state = await tempDir("state");+ const first = archiver(server, state);+ expect((await first.captureBase("ses_reopened", root, 0)).status).toBe("queued");+ expect((await first.drain()).uploaded).toBe(1);+ await first.signOut();+ // Without the chain view (as before): the conflict stops the session.+ const second = archiver(server, state);+ expect((await second.captureBase("ses_reopened", root, 1)).status).toBe("queued");+ expect(await second.drain()).toMatchObject({ uploaded: 0, dropped: 1 });+ await new Promise((resolve) => setTimeout(resolve, 50));+ await second.stop();++ server.chainView = true;+ const third = archiver(server, state);+ expect(await third.captureBase("ses_reopened", root, 2)).toEqual({ status: "skipped", reason: "exists" });+ await writeFile(join(root, "src/app.ts"), "export const app = 5;\n");+ expect(await third.captureDelta("ses_reopened", root, 2)).toMatchObject({ status: "queued", kind: "delta", sequence: 1 });+ expect((await third.drain()).uploaded).toBe(1);+ await third.stop();+ });+test("claimAccount keeps the queue for the same account and removes another account's", async () => {const server = new FakeArchiveServer();const { root } = await project();diff --git a/apps/server/src/session-archive/index.ts b/apps/server/src/session-archive/index.tsindex 1e2d4fb7..5e674439 100644--- a/apps/server/src/session-archive/index.ts+++ b/apps/server/src/session-archive/index.ts@@ -701,7 +701,18 @@ export class SessionArchiver {captureBase(sessionId: string, root: string, turn = 0): Promise<CaptureResult> {return this.guard("base", sessionId, turn, async () => this.withSession(sessionId, async () => {const generation = this.generation;- const state = await this.loadSession(sessionId);+ let state = await this.loadSession(sessionId);+ // Stopped by a sequence conflict (a release that could not go on from the server's chain): once per app run,+ // the server's chain is read again; the session goes on from it, its next turn or final archive sends the folder.+ if (state?.stopped === "archive_sequence_conflict" && !this.stoppedSessions.has(sessionId) && !this.chainChecked.has(sessionId)) {+ const found = await this.continueServerChain({ ...state, stopped: null }, generation);+ this.chainChecked.add(sessionId);+ if (found.status === "continue" && generation === this.generation) {+ if (state.baseline) await rm(join(this.dirs.baselines, state.baseline), { force: true });+ state = { ...found.state, stopped: null, ended: null };+ await this.saveSession(state);+ }+ }if (state?.stopped || this.stoppedSessions.has(sessionId)) return { status: "skipped", reason: "stopped" };if (state && state.next_sequence > 0) {// A prompt on a session archived in an earlier app run: it is active again.