Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): settle orphaned provider sessions at startup #7315

ClosedyassiEmp(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/7315/headopened View on GitHub

Showing 5 changed files with 245 additions and 0 deletions (loading 4).

x
0 of 5 viewed, 5 left
245 additions and 0 deletionsapps/server/src/provider/Layers/SessionStartupReconciler.test.tsAdded
View file
@@ -0,0 +1,245 @@
+import * as NodeServices from "@effect/platform-node/NodeServices";
+import { ThreadId, TurnId, type OrchestrationCommand } from "@t3tools/contracts";
+import * as Effect from "effect/Effect";
+import * as Layer from "effect/Layer";
+import * as ManagedRuntime from "effect/ManagedRuntime";
+import * as Stream from "effect/Stream";
+import { afterEach, describe, expect, it, vi } from "vite-plus/test";
+​
+import { OrchestrationEngineService } from "../../orchestration/Services/OrchestrationEngine.ts";
+import { ProjectionSnapshotQuery } from "../../orchestration/Services/ProjectionSnapshotQuery.ts";
+import { ProviderService, type ProviderServiceShape } from "../Services/ProviderService.ts";
+import { SessionStartupReconciler } from "../Services/SessionStartupReconciler.ts";
+import { SessionStartupReconcilerLive } from "./SessionStartupReconciler.ts";
+​
+const unsupported = () => Effect.die(new Error("Unsupported call in test")) as never;
+​
+const now = "2026-01-01T00:00:00.000Z";
+​
+interface TestSession {
+ readonly threadId: ThreadId;
+ readonly status: "starting" | "running" | "ready" | "interrupted" | "stopped" | "error";
+ readonly providerName: "codex" | "claudeAgent";
+ readonly runtimeMode: "approval-required" | "full-access" | "auto-accept-edits";
+ readonly activeTurnId: TurnId | null;
+ readonly lastError: string | null;
+ readonly updatedAt: string;
+}
+​
+function makeThreadShell(id: ThreadId, session: TestSession | null) {
+ return {