Skip to content

Commit e89abad

Browse files
authored
fix(server): show idle paragraphs before the assistant turn ends (#28221)
Held assistant paragraphs now appear after 800 ms without new text while the turn remains open. Idle writes preserve ingestion order, routing and finalization. Includes lean edge-case coverage and regressions for finalized-root reopening and early timer wakes. Verified with focused tests, check:changed, real web and compiled macOS captures, independent Codex review, and a fresh Claude Opus 5.5 READY review. Natural Antigravity hangs remain unverified. Implemented with Claude Opus 5.5 through Claude Code; investigated and verified with GPT-6.1-Sol through Codex in T3 Code.
1 parent f6a32db commit e89abad

6 files changed

Lines changed: 929 additions & 119 deletions

File tree

‎apps/server/src/orchestration-v2/EventSink.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
type ProjectId,
1313
ThreadId,
1414
} from "@t3tools/contracts";
15-
import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
1615
import * as ProviderCommitBatch from "./ProviderCommitBatch.ts";
1716
import * as Context from "effect/Context";
1817
import * as DateTime from "effect/DateTime";
@@ -79,9 +78,10 @@ const CurrentProviderBatch = Context.Reference<ProviderBatchPublication | undefi
7978
);
8079

8180
export interface EventSinkV2Shape {
82-
readonly consumeProviderEvents: <E, R, E2, R2>(
83-
source: Stream.Stream<ProviderAdapter.ProviderAdapterV2Event, E, R>,
84-
process: (event: ProviderAdapter.ProviderAdapterV2Event) => Effect.Effect<void, E2, R2>,
81+
/** Items that are not provider snapshots, such as a consumer's own control items, never batch. */
82+
readonly consumeProviderEvents: <A extends { readonly type: string }, E, R, E2, R2>(
83+
source: Stream.Stream<A, E, R>,
84+
process: (event: A) => Effect.Effect<void, E2, R2>,
8585
after: Effect.Effect<boolean, E2, R2>,
8686
canBatch: Effect.Effect<boolean, never, R2>,
8787
) => Effect.Effect<

‎apps/server/src/orchestration-v2/ProviderCommitBatch.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
21
import * as Cause from "effect/Cause";
32
import * as Clock from "effect/Clock";
43
import * as Config from "effect/Config";
@@ -19,8 +18,7 @@ export const enabled = Config.Boolean("T3CODE_PROVIDER_COMMIT_BATCHING").pipe(
1918
Effect.orDie,
2019
);
2120

22-
type Event = ProviderAdapter.ProviderAdapterV2Event;
23-
const isSnapshot = (event: Event) =>
21+
const isSnapshot = (event: { readonly type: string }) =>
2422
event.type === "node.updated" ||
2523
event.type === "message.updated" ||
2624
event.type === "turn_item.updated" ||
@@ -232,9 +230,9 @@ export const make = Effect.fn("ProviderCommitBatch.make")(function* (
232230
),
233231
);
234232
});
235-
const consume = Effect.fnUntraced(function* <E, R, E2, R2>(
236-
source: Stream.Stream<Event, E, R>,
237-
process: (event: Event) => Effect.Effect<void, E2, R2>,
233+
const consume = Effect.fnUntraced(function* <A extends { readonly type: string }, E, R, E2, R2>(
234+
source: Stream.Stream<A, E, R>,
235+
process: (event: A) => Effect.Effect<void, E2, R2>,
238236
after: Effect.Effect<boolean, E2, R2>,
239237
canBatch: Effect.Effect<boolean, never, R2> = Effect.succeed(true),
240238
) {

0 commit comments

Comments
 (0)