Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a remote delegated task no longer stays running when its follower hits a defect #32331

Mergedjuliusmarmingemerged 13 commits intomain fromrefs/pull/32331/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 199 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
199 additions and 0 deletionsapps/server/src/peer/RemoteDelegation.test.tsModified
View file
@@ -25,6 +25,7 @@
import * as DateTime from "effect/DateTime";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
+import * as Fiber from "effect/Fiber";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Queue from "effect/Queue";
@@ -644,6 +645,8 @@
/** The laptop's links from before a restart, which keep their sessions there. */
kept?: Context.Context<Layer.Success<ReturnType<typeof layerLinkingEnvironment>>>,
+ /** Runs as each follow attempt here starts, on its follower's fiber. */
+ beforeFollow: Effect.Effect<void, Orchestrator.OrchestratorV2Error> = Effect.void,
) =>
Effect.gen(function* () {
const linking = kept ?? (yield* layerLinkingEnvironment(laptop).pipe(Layer.build));
@@ -672,6 +675,19 @@
Layer.provideMerge(McpHttpServer.layerInProcessMcpServer),
Layer.provideMerge(
RemoteDelegation.layer.pipe(
+ Layer.provide(
+ Layer.effect(
+ ThreadManagement.ThreadManagementService,
+ Effect.gen(function* () {
+ const threads = yield* ThreadManagement.ThreadManagementService;
+ return {
+ ...threads,