fix(server): recover opted-in threads after machine restarts #9803
Mergedmaria-rcksmerged 4 commits into
main fromrefs/pull/9803/headmerged by maria-rcks View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/serverRuntimeStartup.ts lines 489 to 491OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -480,3 +489,3 @@480489 const continuationMarked =481490 continuationTurnId !== null &&482491 (session.activeTurnId === null || continuationTurnId === session.activeTurnId);
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -446,5 +448,21 @@448+ const settings = yield* ServerSettings.ServerSettingsService;449+ const continueAfterRestart = yield* settings.getSettings.pipe(450+ Effect.map((value) => value.continueThreadsAfterServerUpdate),451+ Effect.catch((cause) =>452+ Effect.logWarning("could not read restart continuation preference", { cause }).pipe(453+ Effect.as(false),454+ ),455+ ),456+ );446457447458 const liveThreadIds = new Set(448459 (yield* providerService.listSessions()).map((session) => session.threadId),449460 );450461 const { threads } = yield* query.getCommandReadModel();462+ // Provider startup can report ready before the continuation is submitted.463+ // Find those markers in one read rather than querying every idle thread.464+ const preparedThreadIds = new Set(465+ (yield* directory466+ .listBindings()467+ .pipe(468+ Effect.catch((cause) =>
maria-rcks merged thisb906ce2
maria-rcks closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed