Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): Codex plan streaming no longer commits every token #19317

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/19317/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 137 additions and 51 deletions.

x
0 of 2 viewed, 2 left
88 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.tsModified
View file
@@ -3679,6 +3679,94 @@
+ it.effect("streams a proposed plan a few times a second instead of once per delta", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const scenario = "codex-plan-delta-coalescing";
+ const nativeThreadId = `native-${scenario}-thread`;
+ const nativeTurnId = `native-${scenario}-turn`;
+ const prompt = "Plan the change.";
+ // 100 deltas, 20 ms apart: a two second stream.
+ const deltas = Array.from({ length: 100 }, (_, index) => `step ${index}\n`);
+ const transcript = makeCodexReplayTranscript({
+ scenario,
+ entries: [
+ ...codexReplayPreamble({ nativeThreadId, nativeTurnId, prompt }),
+ ...deltas.map((delta, index): CodexReplay.CodexAppServerReplayEntry => ({
+ type: "emit_inbound",
+ label: `item/plan/delta/${index}`,
+ afterMs: 20,
+ frame: {
+ method: "item/plan/delta",
+ params: { threadId: nativeThreadId, turnId: nativeTurnId, itemId: "plan", delta },
+ },
+ })),
+ {
+ type: "emit_inbound",
+ label: "item/completed/plan",
+ frame: {