Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(acp): coalesce streamed text snapshots #19626

MergedStiensWout(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/19626/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

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

x
0 of 2 viewed, 2 left
138 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.tsModified
View file
@@ -1946,6 +1946,144 @@
}).pipe(Effect.provide(layerTest), Effect.scoped),
+ it.effect("coalesces streamed ACP text into bounded snapshots without delaying its start", () =>
+ Effect.gen(function* () {
+ const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
+ const path = yield* Path.Path;
+ const selfInvocation = yield* resolveSelfInvocation();
+ const mockAgentPath = yield* path.fromFileUrl(
+ new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
+ );
+ type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
+ let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
+ const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
+ const instanceId = ProviderInstanceId.make("acp-test-text-coalescing");
+ const adapter = yield* makeAcpAdapterV2({
+ instanceId,
+ flavor: {
+ driver: ACP_TEST_DRIVER,
+ capabilities: AcpProviderCapabilitiesV2,
+ makeRuntime: makeMockRuntime({
+ childProcessSpawner,
+ mockAgentPath,
+ environment: { T3_ACP_HANG_PROMPT_FOREVER: "1" },
+ protocolEvents,
+ wrapRuntime: (runtime) => ({
+ ...runtime,
+ handleSessionUpdate: (handler) =>
+ Effect.sync(() => {