A desktop coding agent with free access to frontier models.
TypeScript
fix: keep the queue while signed out
ogsamratac53edee2f25
diff --git a/apps/server/src/session-uploader.test.ts b/apps/server/src/session-uploader.test.tsindex a940de14..c6ff0177 100644--- a/apps/server/src/session-uploader.test.ts+++ b/apps/server/src/session-uploader.test.ts@@ -3069,19 +3069,19 @@ describe("session uploader gateway auth", () => {await sessionUploader.stop();});- test("drops the upload without a refresh or spool entry when the account is signed out", async () => {+ test("keeps the upload in the spool, without a refresh, while this device has no account (a sign-in the server retired)", async () => {for (const status of [403, 401]) {- const { sessionUploader, sessionId, uploads, warnings, rejected, counters } = await authHarness(+ const { sessionUploader, sessionId, uploads, rejected, counters } = await authHarness(() => unauthorized(status, { error: "omnirush_account_required" }),async () => "fresh-token",);expect(counters).toEqual({ attempts: 1, refreshes: 0 });expect(uploads).toHaveLength(0);expect(rejected).toHaveLength(0);- expect(await sessionUploader.spoolStatus()).toEqual({ entries: 0, bytes: 0 });- expect(await sessionUploader.sessionDeliveryStatus(sessionId)).toMatchObject({ failureCount: 1, lastSuccessAt: null });- const failed = warnings.find((warning) => warning.message === "OmniRush session upload operation failed");- expect(failed?.attributes).toMatchObject({ error: `sessionUploader upload failed with status ${status} (omnirush_account_required)` });+ expect(await sessionUploader.spoolStatus()).toMatchObject({ entries: 1 });+ // A drain while the account is still gone keeps it too.+ await sessionUploader.drainSpool();+ expect(await sessionUploader.spoolStatus()).toMatchObject({ entries: 1 });await sessionUploader.stop();}});diff --git a/apps/server/src/session-uploader.ts b/apps/server/src/session-uploader.tsindex 0738f356..8b010349 100644--- a/apps/server/src/session-uploader.ts+++ b/apps/server/src/session-uploader.ts@@ -6528,12 +6528,14 @@ export class SessionUploader {}lastReason = `sessionUploader upload failed with status ${response.status}`;if (UNAUTHORIZED_STATUSES.has(response.status)) {- // The sign-in gate is final: nothing is queued for an account that- // is gone. Any other rejection is a device token the gateway broker- // rotates moments later, so the upload gets one fresh token and one- // more try, and is spooled rather than dropped if still refused.+ // No account on this device right now (the server retired its sign-in):+ // the upload is kept, stamped with its account, for when it is back;+ // only a user's sign-out deletes it. Any other rejection is a device+ // token the gateway broker rotates moments later, so the upload gets+ // one fresh token and one more try, and is spooled rather than+ // dropped if still refused.if (await responseSignalsAccountRequired(response)) {- return { ok: false, retryable: false, reason: `${lastReason} (${ACCOUNT_REQUIRED_MARKER})` };+ return { ok: false, retryable: true, reason: `${lastReason} (${ACCOUNT_REQUIRED_MARKER})` };}if (refreshAttempted) return { ok: false, retryable: true, reason: lastReason };refreshAttempted = true;