Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a streamed reply or reasoning block no longer stores every snapshot of its text #36362

Openjuliusmarmingewants to merge 3 commits intomain fromrefs/pull/36362/headopened View on GitHub

Showing 3 changed files with 170 additions and 1 deletion.

x
0 of 3 viewed, 3 left
2 additions and 1 deletionapps/server/src/orchestration-v2/FoundationPersistence.test.tsModified
View file
@@ -412,9 +412,10 @@
published.map((stored) => stored.event.id),
["batch-first", "batch-second"],
+ // The second streaming snapshot of the message replaces the first in the log.
assert.deepEqual(
yield* store.read({ afterSequence: highWater }).pipe(Stream.runCollect),
- published,
+ published.slice(1),
}).pipe(Effect.provide(Layer.fresh(layerTest)), Effect.scoped),
118 additions and 0 deletionsapps/server/src/persistence/OrchestrationEventStore.test.tsModified
View file
@@ -295,6 +295,124 @@
}),
​
+ // Every snapshot the paragraph filter passes is appended holding the full text so far.
+ it.effect(
+ "stores snapshots of a long stream whose combined text stays within a few times its final text",
+ () =>
+ Effect.gen(function* () {
+ const store = yield* OrchestrationEventStore.OrchestrationEventStore;
+ const sql = yield* SqlClient.SqlClient;
+ const now = yield* DateTime.now;
+ const threadId = ThreadId.make("thread:long-stream");
+ const reasoning = (index: number, text: string, streaming = true) =>