Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): allow handoff after a provider session detaches #13882

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 1 commit intot3code/codex-turn-mapping fromt3code/fix-detached-provider-handoffmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 70 additions and 3 deletions.

x
0 of 3 viewed, 3 left
22 additions and 0 deletionsapps/server/src/orchestration-v2/ProviderSwitchService.test.tsModified
View file
@@ -253,6 +253,28 @@
​
+it.effect("hands off from a native provider thread after its session detaches", () =>
+ Effect.gen(function* () {
+ const service = yield* ProviderSwitch.ProviderSwitchServiceV2;
+ const result = yield* service.plan({
+ projection: { ...deadNativeThreadProjection("stopped"), providerSessions: [] },
+ targetModelSelection: {
+ instanceId: ProviderInstanceId.make("codex_other"),
+ model: "gpt-5.2-codex",
+ },
+ });
+ assert.equal(result.transition.type, "create_with_handoff");
+ assert.deepEqual(result.releaseProviderSessionIds, []);
+ }).pipe(
+ Effect.provide(
+ testLayer({
+ [currentInstanceId]: { continuationKey: "codex:account:primary" },
+ codex_other: { continuationKey: "codex:account:other" },
+ }),
+ ),
+ ),
+);
+​
for (const deadStatus of ["stopped", "error"] as const) {
it.effect(
`applies a model change on next turn when a ${deadStatus} session negotiated model switching`,