Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): ACP tool updates no longer persist a snapshot per streamed chunk #16682

Mergeddarjss(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/16682/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 178 additions and 0 deletions (loading 2).

x
0 of 3 viewed, 3 left
178 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.tsModified
View file
@@ -998,6 +998,184 @@
}).pipe(Effect.provide(layerTest), Effect.scoped),
+ it.effect("persists a bounded subset of streamed root and child tool updates", () =>
+ Effect.gen(function* () {
+ const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
+ const path = yield* Path.Path;
+ const mockAgentPath = yield* path.fromFileUrl(
+ new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
+ );
+ type Runtime = AcpSessionRuntime.AcpSessionRuntime["Service"];
+ let handler: Parameters<Runtime["handleSessionUpdate"]>[0] | undefined;
+ // Devin streams a file write as it generates it: each update resends the
+ // whole file so far, a few characters longer, with no status.
+ const file = `${"x = 1\n".repeat(800)}END_OF_FILE\n`;
+ const chunks = 200;
+ const streamedWrite = (
+ toolCallId: string,
+ parentAgentId?: string,
+ ): Array<EffectAcpSchema.SessionUpdate> => {
+ const meta =
+ parentAgentId === undefined ? {} : { "cognition.ai/subagent_context": { parentAgentId } };
+ const write = (text: string, status?: "completed") => ({
+ sessionUpdate: "tool_call_update" as const,
+ toolCallId,
+ title: "Writing ./audit.py",
+ ...(status === undefined ? {} : { status }),
+ content: [
+ { type: "diff" as const, path: "/repo/audit.py", oldText: null, newText: text },