@devries-cameron20 / t3code Mirror · read-only / commits / 20584babc2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 23:30 UTC

fix(server): slow title generations no longer hold every effect worker (#26272)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 11, 2026 at 11:50 UTC 20584babc2aa8bf01d8d3b8ba748c00117fdb637
9 files changed +201 -66
apps/server/src/orchestration-v2/EffectOutbox.ts
+44 -20
@@ -224,8 +224,11 @@ export interface EffectOutboxV2Shape {
224 readonly claimNext: (input: {
225 readonly workerId: string;
226 readonly excludeRestartContinuations?: boolean;
227 + readonly maxRunningTitleGenerations?: number;
228 }) => Effect.Effect<Option.Option<OrchestrationEffectV2>, EffectOutboxError>;
228 - readonly nextClaimableAt: Effect.Effect<Option.Option<DateTime.Utc>, EffectOutboxError>;
229 + readonly nextClaimableAt: (input?: {
230 + readonly maxRunningTitleGenerations?: number;
231 + }) => Effect.Effect<Option.Option<DateTime.Utc>, EffectOutboxError>;
232 readonly succeed: (input: {
233 readonly effectId: string;
234 readonly workerId: string;
@@ -314,6 +317,7 @@ export const layer: Layer.Layer<EffectOutboxV2, never, SqlClient.SqlClient> = La
317 const claimableCandidatePredicate = (
318 availableBefore?: string,
319 excludeRestartContinuations = false,
320 + maxRunningTitleGenerations?: number,
321 ) =>
322 sql`
323 ${
@@ -350,6 +354,19 @@ export const layer: Layer.Layer<EffectOutboxV2, never, SqlClient.SqlClient> = La
354 )
355 )
356 )
357 + AND ${
358 + maxRunningTitleGenerations === undefined
359 + ? sql`1 = 1`
360 + : sql`(
361 + candidate.effect_type != 'thread-title.generate'
362 + OR (
363 + SELECT COUNT(*)
364 + FROM orchestration_v2_effect_outbox AS running_title
365 + WHERE running_title.status = 'running'
366 + AND running_title.effect_type = 'thread-title.generate'
367 + ) < ${maxRunningTitleGenerations}
368 + )`
369 + }
370 `;
371
372 const cancellationSignal = (effectId: string) => {
@@ -519,7 +536,7 @@ export const layer: Layer.Layer<EffectOutboxV2, never, SqlClient.SqlClient> = La
536 ),
537 // The worker polls for the next effect even when there is no work to claim.
538 claimNext: Effect.fnUntraced(
522 - function* ({ workerId, excludeRestartContinuations = false }) {
539 + function* ({ workerId, excludeRestartContinuations = false, maxRunningTitleGenerations }) {
540 const now = yield* DateTime.now;
541 const nowIso = DateTime.formatIso(now);
542 // Idle claims return empty; tracing their full SQL on every poll overwhelms useful traces.
@@ -534,7 +551,11 @@ export const layer: Layer.Layer<EffectOutboxV2, never, SqlClient.SqlClient> = La
551 WHERE effect_id = (
552 SELECT candidate.effect_id
553 FROM orchestration_v2_effect_outbox AS candidate
537 - WHERE ${claimableCandidatePredicate(nowIso, excludeRestartContinuations)}
554 + WHERE ${claimableCandidatePredicate(
555 + nowIso,
556 + excludeRestartContinuations,
557 + maxRunningTitleGenerations,
558 + )}
559 AND ${excludeRestartContinuations ? sql`candidate.effect_type != 'provider-runtime.continue'` : sql`1 = 1`}
560 ORDER BY candidate.available_at ASC, candidate.created_at ASC, candidate.effect_id ASC
561 LIMIT 1
@@ -549,23 +570,26 @@ export const layer: Layer.Layer<EffectOutboxV2, never, SqlClient.SqlClient> = La
570 },
571 Effect.mapError((cause) => new EffectOutboxError({ operation: "claim", cause })),
572 ),
552 - nextClaimableAt: Effect.gen(function* () {
553 - const rows = yield* sql<{ readonly available_at: string | null }>`
554 - SELECT MIN(candidate.available_at) AS available_at
555 - FROM orchestration_v2_effect_outbox AS candidate
556 - WHERE ${claimableCandidatePredicate()}
557 - `.pipe(NodeSqliteClient.readOnly, Effect.withTracerEnabled(false));
558 - const availableAt = rows[0]?.available_at;
559 - if (availableAt === undefined || availableAt === null) return Option.none();
560 - const parsed = DateTime.make(availableAt);
561 - if (Option.isNone(parsed)) {
562 - return yield* new EffectOutboxError({
563 - operation: "next-claimable",
564 - cause: `Invalid available_at timestamp: ${availableAt}`,
565 - });
566 - }
567 - return parsed;
568 - }).pipe(
573 + nextClaimableAt: Effect.fnUntraced(
574 + function* ({
575 + maxRunningTitleGenerations,
576 + }: { readonly maxRunningTitleGenerations?: number } = {}) {
577 + const rows = yield* sql<{ readonly available_at: string | null }>`
578 + SELECT MIN(candidate.available_at) AS available_at
579 + FROM orchestration_v2_effect_outbox AS candidate
580 + WHERE ${claimableCandidatePredicate(undefined, false, maxRunningTitleGenerations)}
581 + `.pipe(NodeSqliteClient.readOnly, Effect.withTracerEnabled(false));
582 + const availableAt = rows[0]?.available_at;
583 + if (availableAt === undefined || availableAt === null) return Option.none();
584 + const parsed = DateTime.make(availableAt);
585 + if (Option.isNone(parsed)) {
586 + return yield* new EffectOutboxError({
587 + operation: "next-claimable",
588 + cause: `Invalid available_at timestamp: ${availableAt}`,
589 + });
590 + }
591 + return parsed;
592 + },
593 Effect.mapError((cause) =>
594 isEffectOutboxError(cause)
595 ? cause
apps/server/src/orchestration-v2/EffectWorker.test.ts
+3 -3
@@ -376,7 +376,7 @@ it.effect("requeues a claim when a pre-execution worker check fails", () =>
376 );
377
378 const exit = yield* EffectWorker.OrchestrationEffectWorkerV2.pipe(
379 - Effect.flatMap((worker) => worker.runOnce),
379 + Effect.flatMap((worker) => worker.runOnce()),
380 Effect.provide(layerWorker),
381 Effect.exit,
382 );
@@ -446,7 +446,7 @@ it.effect("arms cancellation before the durable pre-execution check", () =>
446 );
447
448 const exit = yield* EffectWorker.OrchestrationEffectWorkerV2.pipe(
449 - Effect.flatMap((worker) => worker.runOnce),
449 + Effect.flatMap((worker) => worker.runOnce()),
450 Effect.provide(layerWorker),
451 Effect.exit,
452 );
@@ -512,7 +512,7 @@ it.effect("terminalizes a process-bound claim when success settlement fails", ()
512 );
513
514 const exit = yield* EffectWorker.OrchestrationEffectWorkerV2.pipe(
515 - Effect.flatMap((worker) => worker.runOnce),
515 + Effect.flatMap((worker) => worker.runOnce()),
516 Effect.provide(layerWorker),
517 Effect.exit,
518 );
apps/server/src/orchestration-v2/EffectWorker.ts
+31 -22
@@ -612,14 +612,17 @@ export class OrchestrationEffectWorkerError extends Schema.TaggedError<Orchestra
612
613 const isOrchestrationEffectWorkerError = Schema.is(OrchestrationEffectWorkerError);
614
615 +type ClaimFilter = Omit<Parameters<EffectOutbox.EffectOutboxV2Shape["claimNext"]>[0], "workerId">;
616 +
617 export interface OrchestrationEffectWorkerV2Shape {
618 readonly awaitWork: Effect.Effect<void>;
617 - readonly runOnce: Effect.Effect<boolean, OrchestrationEffectWorkerError>;
619 + readonly runOnce: (input?: {
620 + readonly maxRunningTitleGenerations?: number;
621 + }) => Effect.Effect<boolean, OrchestrationEffectWorkerError>;
622 readonly runRecoveryOnce: Effect.Effect<boolean, OrchestrationEffectWorkerError>;
619 - readonly nextClaimableAt: Effect.Effect<
620 - Option.Option<DateTime.Utc>,
621 - OrchestrationEffectWorkerError
622 - >;
623 + readonly nextClaimableAt: (input?: {
624 + readonly maxRunningTitleGenerations?: number;
625 + }) => Effect.Effect<Option.Option<DateTime.Utc>, OrchestrationEffectWorkerError>;
626 readonly drain: (maxEffects?: number) => Effect.Effect<number, OrchestrationEffectWorkerError>;
627 }
628
@@ -739,10 +742,8 @@ export const layerWithOptions = (
742
743 // The worker probes for work repeatedly, including when the outbox is empty.
744 const runOnce = Effect.fnUntraced(
742 - function* (excludeRestartContinuations = false) {
743 - const claimExit = yield* Effect.exit(
744 - outbox.claimNext({ workerId, excludeRestartContinuations }),
745 - );
745 + function* (filter: ClaimFilter = {}) {
746 + const claimExit = yield* Effect.exit(outbox.claimNext({ workerId, ...filter }));
747 yield* increment(orchestrationEffectClaimsTotal, {
748 result: Exit.isFailure(claimExit)
749 ? "error"
@@ -841,7 +842,7 @@ export const layerWithOptions = (
842 }
843 return true;
844 },
844 - (effect, _excludeRestartContinuations?: boolean) =>
845 + (effect, _filter?: ClaimFilter) =>
846 effect.pipe(
847 Effect.mapError((cause) =>
848 isOrchestrationEffectWorkerError(cause)
@@ -853,9 +854,13 @@ export const layerWithOptions = (
854
855 return OrchestrationEffectWorkerV2.of({
856 awaitWork: outbox.awaitAvailable,
856 - runOnce: runOnce(),
857 - runRecoveryOnce: runOnce(true),
858 - nextClaimableAt: outbox.nextClaimableAt.pipe(
857 + runOnce,
858 + runRecoveryOnce: runOnce({ excludeRestartContinuations: true }),
859 + // Idle workers poll this; a span per poll would bury useful traces.
860 + nextClaimableAt: Effect.fnUntraced(
861 + function* (input) {
862 + return yield* outbox.nextClaimableAt(input);
863 + },
864 Effect.mapError(
865 (cause) =>
866 new OrchestrationEffectWorkerError({
@@ -898,10 +903,12 @@ export const runDaemonWithOptions = (options: OrchestrationEffectDaemonOptions =
903 const livenessPollIntervalMs = Number.isFinite(requestedLivenessPollIntervalMs)
904 ? Math.max(1, Math.floor(requestedLivenessPollIntervalMs))
905 : DEFAULT_EFFECT_WORKER_LIVENESS_POLL_INTERVAL_MS;
906 + // Title generation can run for minutes; leave at least one worker free for turn work.
907 + const claimLimits = concurrency > 1 ? { maxRunningTitleGenerations: concurrency - 1 } : {};
908 // Notifications wake promptly; availableAt persists retry timing, and liveness polling recovers missed wakeups.
909 const runWorker = Effect.gen(function* () {
910 while (true) {
904 - const outcome = yield* worker.runOnce.pipe(
911 + const outcome = yield* worker.runOnce(claimLimits).pipe(
912 Effect.map((worked) => (worked ? ("worked" as const) : ("idle" as const))),
913 Effect.catchCause((cause) =>
914 Effect.logWarning("Orchestration effect worker failed", cause).pipe(
@@ -919,14 +926,16 @@ export const runDaemonWithOptions = (options: OrchestrationEffectDaemonOptions =
926 continue;
927 }
928
922 - const nextClaimableAt = yield* worker.nextClaimableAt.pipe(
923 - Effect.catchCause((cause) =>
924 - Effect.logWarning(
925 - "Failed to read the next orchestration effect deadline",
926 - cause,
927 - ).pipe(Effect.as(Option.none<DateTime.Utc>())),
928 - ),
929 - );
929 + const nextClaimableAt = yield* worker
930 + .nextClaimableAt(claimLimits)
931 + .pipe(
932 + Effect.catchCause((cause) =>
933 + Effect.logWarning(
934 + "Failed to read the next orchestration effect deadline",
935 + cause,
936 + ).pipe(Effect.as(Option.none<DateTime.Utc>())),
937 + ),
938 + );
939 const now = DateTime.toEpochMillis(yield* DateTime.now);
940 const sleepMs = Option.match(nextClaimableAt, {
941 onNone: () => livenessPollIntervalMs,
apps/server/src/orchestration-v2/FoundationPersistence.test.ts
+118 -16
@@ -663,8 +663,8 @@ it.effect.each([false, true])("groups shutdown commits with rollback=%s", (fail)
663 EffectWorker.OrchestrationEffectWorkerV2.of({
664 awaitWork: Effect.void,
665 runRecoveryOnce: Effect.succeed(false),
666 - runOnce: Effect.succeed(false),
667 - nextClaimableAt: Effect.succeedNone,
666 + runOnce: () => Effect.succeed(false),
667 + nextClaimableAt: () => Effect.succeedNone,
668 drain: () => Effect.succeed(0),
669 }),
670 ),
@@ -1839,8 +1839,8 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
1839 );
1840 yield* Effect.gen(function* () {
1841 const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
1842 - assert.isTrue(yield* worker.runOnce);
1843 - assert.isFalse(yield* worker.runOnce);
1842 + assert.isTrue(yield* worker.runOnce());
1843 + assert.isFalse(yield* worker.runOnce());
1844 }).pipe(Effect.provide(layerWorker));
1845
1846 assert.equal(yield* Ref.get(executionCount), 1);
@@ -2249,7 +2249,7 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
2249
2250 yield* Effect.gen(function* () {
2251 const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
2252 - const workerFiber = yield* worker.runOnce.pipe(Effect.forkChild);
2252 + const workerFiber = yield* worker.runOnce().pipe(Effect.forkChild);
2253 yield* Deferred.await(started);
2254 const cancelledEffectIds = yield* outbox.cancelUnsettled({
2255 threadId,
@@ -2372,7 +2372,7 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
2372
2373 assert.isTrue(
2374 yield* EffectWorker.OrchestrationEffectWorkerV2.pipe(
2375 - Effect.flatMap((worker) => worker.runOnce),
2375 + Effect.flatMap((worker) => worker.runOnce()),
2376 Effect.provide(layerWorker),
2377 ),
2378 );
@@ -2578,7 +2578,7 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
2578 if (Option.isNone(claimed)) return;
2579 assert.equal(claimed.value.id, "effect:foundation-next-claimable:a1");
2580
2581 - const whileBlocked = yield* outbox.nextClaimableAt;
2581 + const whileBlocked = yield* outbox.nextClaimableAt();
2582 assert.isTrue(Option.isSome(whileBlocked));
2583 if (Option.isSome(whileBlocked)) {
2584 assert.equal(DateTime.toEpochMillis(whileBlocked.value), DateTime.toEpochMillis(future));
@@ -2588,7 +2588,7 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
2588 effectId: claimed.value.id,
2589 workerId: "next-claimable-worker",
2590 });
2591 - const afterCompletion = yield* outbox.nextClaimableAt;
2591 + const afterCompletion = yield* outbox.nextClaimableAt();
2592 assert.isTrue(Option.isSome(afterCompletion));
2593 if (Option.isSome(afterCompletion)) {
2594 assert.isAtMost(DateTime.toEpochMillis(afterCompletion.value), DateTime.toEpochMillis(now));
@@ -2765,7 +2765,7 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
2765 assert.equal(Option.getOrUndefined(title)?.id, "effect:foundation-retry-order:b-title");
2766 const blocked = yield* outbox.claimNext({ workerId });
2767 assert.isTrue(Option.isNone(blocked));
2768 - const nextClaimable = yield* outbox.nextClaimableAt;
2768 + const nextClaimable = yield* outbox.nextClaimableAt();
2769 assert.isTrue(Option.isSome(nextClaimable));
2770 if (Option.isSome(nextClaimable)) {
2771 assert.equal(
@@ -2897,6 +2897,108 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
2897 }),
2898 );
2899
2900 + it.effect("starts a provider turn while slow title generations are running", () =>
2901 + Effect.gen(function* () {
2902 + const outbox = yield* EffectOutbox.EffectOutboxV2;
2903 + const commandId = CommandId.make("command:foundation-title-starvation");
2904 + const titleThreads = ["a", "b", "c"].map((suffix) =>
2905 + ThreadId.make(`thread:foundation-title-starvation:${suffix}`),
2906 + );
2907 + const turnStarted = yield* Deferred.make<void>();
2908 + const releaseTitles = yield* Deferred.make<void>();
2909 + const layerWorker = EffectWorker.layerWithOptions({
2910 + workerId: "title-starvation-worker",
2911 + }).pipe(
2912 + Layer.provide(
2913 + Layer.merge(
2914 + Layer.succeed(EffectOutbox.EffectOutboxV2, outbox),
2915 + Layer.succeed(
2916 + EffectWorker.OrchestrationEffectExecutorV2,
2917 + EffectWorker.OrchestrationEffectExecutorV2.of({
2918 + execute: (effect) =>
2919 + effect.request.type === "thread-title.generate"
2920 + ? Deferred.await(releaseTitles)
2921 + : Deferred.succeed(turnStarted, undefined).pipe(Effect.asVoid),
2922 + }),
2923 + ),
2924 + ),
2925 + ),
2926 + );
2927 +
2928 + yield* Effect.gen(function* () {
2929 + yield* EffectWorker.runDaemonWithOptions({ concurrency: 2 }).pipe(Effect.forkScoped);
2930 + yield* Effect.yieldNow;
2931 + yield* outbox.enqueue([
2932 + ...titleThreads.map((threadId, index) => ({
2933 + id: `effect:foundation-title-starvation:${index}-title`,
2934 + commandId,
2935 + threadId,
2936 + request: {
2937 + type: "thread-title.generate" as const,
2938 + kind: { type: "regenerate" as const },
2939 + },
2940 + })),
2941 + {
2942 + id: "effect:foundation-title-starvation:turn-start",
2943 + commandId,
2944 + threadId: titleThreads[0]!,
2945 + request: {
2946 + type: "provider-turn.start",
2947 + runId: RunId.make("run:foundation-title-starvation"),
2948 + },
2949 + },
2950 + ]);
2951 + yield* outbox.notifyAvailable(titleThreads.length + 1);
2952 +
2953 + const started = yield* Deferred.await(turnStarted).pipe(
2954 + Effect.timeoutOption(Duration.seconds(1)),
2955 + Effect.forkScoped,
2956 + );
2957 + yield* TestClock.adjust(Duration.seconds(1));
2958 + assert.isTrue(
2959 + Option.isSome(yield* Fiber.join(started)),
2960 + "provider-turn.start was never claimed: thread title generations occupied every effect worker",
2961 + );
2962 + assert.isFalse(yield* Deferred.isDone(releaseTitles));
2963 +
2964 + yield* Deferred.succeed(releaseTitles, undefined);
2965 + yield* Effect.forEach(titleThreads, (_, index) =>
2966 + outbox.awaitSettled(`effect:foundation-title-starvation:${index}-title`),
2967 + );
2968 + }).pipe(Effect.provide(layerWorker), Effect.scoped);
2969 + }),
2970 + );
2971 +
2972 + it.effect("holds pending titles at the running-title cap without waking idle workers", () =>
2973 + Effect.gen(function* () {
2974 + const outbox = yield* EffectOutbox.EffectOutboxV2;
2975 + const cap = { maxRunningTitleGenerations: 1 };
2976 + const title = (name: string) => ({
2977 + id: `effect:foundation-title-cap:${name}`,
2978 + commandId: CommandId.make(`command:foundation-title-cap:${name}`),
2979 + threadId: ThreadId.make(`thread:foundation-title-cap:${name}`),
2980 + request: { type: "thread-title.generate" as const, kind: { type: "regenerate" as const } },
2981 + });
2982 + yield* outbox.enqueue([title("first"), title("second")]);
2983 + const first = yield* outbox.claimNext({ workerId: "title-cap-worker", ...cap });
2984 + assert.strictEqual(Option.getOrUndefined(first)?.id, title("first").id);
2985 +
2986 + assert.isTrue(
2987 + Option.isNone(yield* outbox.claimNext({ workerId: "title-cap-worker", ...cap })),
2988 + );
2989 + assert.isTrue(
2990 + Option.isNone(yield* outbox.nextClaimableAt(cap)),
2991 + "a capped title must not report a past deadline, or idle workers re-poll every 25 ms",
2992 + );
2993 + assert.isTrue(Option.isSome(yield* outbox.nextClaimableAt()));
2994 +
2995 + yield* outbox.succeed({ effectId: title("first").id, workerId: "title-cap-worker" });
2996 + const second = yield* outbox.claimNext({ workerId: "title-cap-worker", ...cap });
2997 + assert.strictEqual(Option.getOrUndefined(second)?.id, title("second").id);
2998 + yield* outbox.succeed({ effectId: title("second").id, workerId: "title-cap-worker" });
2999 + }),
3000 + );
3001 +
3002 it.effect("does not reclaim a running effect after its process-local lease expires", () =>
3003 Effect.gen(function* () {
3004 const outbox = yield* EffectOutbox.EffectOutboxV2;
@@ -2948,7 +3050,7 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
3050
3051 yield* Effect.gen(function* () {
3052 const worker = yield* EffectWorker.OrchestrationEffectWorkerV2;
2951 - const firstFiber = yield* worker.runOnce.pipe(Effect.forkChild);
3053 + const firstFiber = yield* worker.runOnce().pipe(Effect.forkChild);
3054 yield* Deferred.await(firstStarted);
3055 yield* sql`
3056 UPDATE orchestration_v2_effect_outbox
@@ -2956,12 +3058,12 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
3058 WHERE effect_id = ${firstEffectId}
3059 `;
3060
2959 - assert.isFalse(yield* worker.runOnce);
3061 + assert.isFalse(yield* worker.runOnce());
3062 assert.deepEqual(yield* Ref.get(executions), [firstEffectId]);
3063
3064 yield* Deferred.succeed(releaseFirst, undefined);
3065 assert.isTrue(yield* Fiber.join(firstFiber));
2964 - assert.isTrue(yield* worker.runOnce);
3066 + assert.isTrue(yield* worker.runOnce());
3067 assert.deepEqual(yield* Ref.get(executions), [firstEffectId, secondEffectId]);
3068 }).pipe(Effect.provide(layerWorker));
3069 }),
@@ -3290,8 +3392,8 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
3392 EffectWorker.OrchestrationEffectWorkerV2.of({
3393 awaitWork: Effect.void,
3394 runRecoveryOnce: Effect.succeed(false),
3293 - runOnce: Effect.succeed(false),
3294 - nextClaimableAt: Effect.succeedNone,
3395 + runOnce: () => Effect.succeed(false),
3396 + nextClaimableAt: () => Effect.succeedNone,
3397 drain: () => Effect.succeed(0),
3398 }),
3399 ),
@@ -3507,8 +3609,8 @@ it.layer(layerTest)("orchestration V2 foundation persistence", (it) => {
3609 EffectWorker.OrchestrationEffectWorkerV2.of({
3610 awaitWork: Effect.void,
3611 runRecoveryOnce: Effect.succeed(false),
3510 - runOnce: Effect.succeed(false),
3511 - nextClaimableAt: Effect.succeedNone,
3612 + runOnce: () => Effect.succeed(false),
3613 + nextClaimableAt: () => Effect.succeedNone,
3614 drain: () => Effect.succeed(0),
3615 }),
3616 ),
apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts
+1 -1
@@ -346,7 +346,7 @@ it.effect.each(
346 }
347 if (timing === "after delivery") yield* worker.drain();
348 const delivery =
349 - timing === "during delivery" ? yield* worker.runOnce.pipe(Effect.forkScoped) : null;
349 + timing === "during delivery" ? yield* worker.runOnce().pipe(Effect.forkScoped) : null;
350 if (delivery !== null) yield* Deferred.await(steerEntered);
351 const completed = yield* watch(
352 (event) =>
apps/server/src/orchestration-v2/runtimeLayer.test.ts
+1 -1
@@ -8225,7 +8225,7 @@ it.layer(layerSharedApplicationDataPlaneTest)("pending provider interruption", (
8225 ["user_message", "run_interrupt_request", "run_interrupt_result"],
8226 );
8227 assert.deepEqual(interrupted.providerTurns, []);
8228 - assert.isFalse(yield* effectWorker.runOnce);
8228 + assert.isFalse(yield* effectWorker.runOnce());
8229 }),
8230 );
8231 });
apps/server/src/orchestration-v2/testkit/AcpRegistryReplayFixtures.integration.test.ts
+1 -1
@@ -164,7 +164,7 @@ describe("ACP registry replay fixtures", () => {
164 // deadline, draining effects instead of polling the projection.
165 for (let attempt = 0; attempt < 10; attempt++) {
166 yield* worker.drain();
167 - const next = yield* worker.nextClaimableAt;
167 + const next = yield* worker.nextClaimableAt();
168 if (Option.isNone(next)) break;
169 const now = yield* DateTime.now;
170 yield* TestClock.adjust(
apps/server/src/serverRuntimeStartup.autoPull.test.ts
+1 -1
@@ -119,7 +119,7 @@ it.effect("parks automatic pull until activation without delaying command readin
119 Layer.mock(Orchestrator.OrchestratorV2)({ recoverDelegatedTasks: Effect.void }),
120 Layer.mock(ProviderSessionManager.ProviderSessionManagerV2)({ shutdown: Effect.void }),
121 Layer.mock(AgentAwarenessRelay.AgentAwarenessRelay)({ start: () => Effect.void }),
122 - Layer.mock(EffectWorker.OrchestrationEffectWorkerV2)({ runOnce: Effect.never }),
122 + Layer.mock(EffectWorker.OrchestrationEffectWorkerV2)({ runOnce: () => Effect.never }),
123 Layer.mock(ServerLifecycleEvents.ServerLifecycleEvents)({
124 publish: (event) => Effect.succeed({ ...event, sequence: 1 }),
125 }),
apps/server/src/serverRuntimeStartup.test.ts
+1 -1
@@ -118,7 +118,7 @@ it.effect.each([
118 Layer.mock(Orchestrator.OrchestratorV2)({ recoverDelegatedTasks: Effect.void }),
119 Layer.mock(ProviderSessionManager.ProviderSessionManagerV2)({ shutdown: Effect.void }),
120 Layer.mock(AgentAwarenessRelay.AgentAwarenessRelay)({ start: () => Effect.void }),
121 - Layer.mock(EffectWorker.OrchestrationEffectWorkerV2)({ runOnce: Effect.never }),
121 + Layer.mock(EffectWorker.OrchestrationEffectWorkerV2)({ runOnce: () => Effect.never }),
122 Layer.mock(ServerLifecycleEvents.ServerLifecycleEvents)({
123 publish: (event) =>
124 Effect.sync(() => {