Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep conversation when a stopped thread switches provider instance #11908

Closedspencermorris04(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/11908/headopened View on GitHub

Showing 2 changed files with 92 additions and 11 deletions.

x
0 of 2 viewed, 2 left
83 additions and 0 deletionsapps/server/src/provider/Layers/ProviderService.test.tsModified
View file
@@ -986,6 +986,89 @@
}).pipe(Effect.provide(NodeServices.layer)),
​
+it.effect(
+ "ProviderServiceLive resumes a stopped session when switching to an instance with shared resume state",
+ () =>
+ Effect.gen(function* () {
+ const primaryInstanceId = ProviderInstanceId.make("codex");
+ const overlayInstanceId = ProviderInstanceId.make("codex_b");
+ const codex = makeFakeCodexAdapter();
+ const unsupported = () =>
+ new ProviderUnsupportedError({
+ provider: CODEX_DRIVER,
+ });
+ const instanceIds = new Set<ProviderInstanceId>([primaryInstanceId, overlayInstanceId]);
+ const registry: ProviderAdapterRegistry.ProviderAdapterRegistry["Service"] = {
+ getByInstance: (requestedInstanceId) =>
+ instanceIds.has(requestedInstanceId)
+ ? Effect.succeed(codex.adapter)
+ : Effect.fail(unsupported()),
+ getInstanceInfo: (requestedInstanceId) =>
+ instanceIds.has(requestedInstanceId)
+ ? Effect.succeed({
+ instanceId: requestedInstanceId,
+ driverKind: CODEX_DRIVER,
+ displayName: undefined,
+ enabled: true,
+ continuationIdentity: {
+ driverKind: CODEX_DRIVER,