@devries-cameron20 / t3code-1 / commits / cf48ea8d5c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

perf(acp): ACP agents skip decoding output twice for unused diagnostics (#29100)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Andrei committed Nov 3, 2026 at 09:40 UTC cf48ea8d5c0b7483242e7517532adc4d57d921fc
2 files changed +90 -2
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+88
@@ -381,6 +381,8 @@ function makeMockRuntime(input: {
381 ? runtimeInput.protocolLogging
382 : {
383 ...runtimeInput.protocolLogging,
384 + logIncoming: true,
385 + logOutgoing: true,
386 logger: (event: EffectAcpProtocol.AcpProtocolLogEvent) =>
387 Queue.offer(protocolEvents, event).pipe(
388 Effect.andThen(runtimeInput.protocolLogging.logger?.(event) ?? Effect.void),
@@ -3077,6 +3079,92 @@ describe("AcpAdapterV2", () => {
3079 }).pipe(Effect.provide(layerTest), Effect.scoped),
3080 );
3081
3082 + it.effect("keeps protocol diagnostics off unless a protocol logger is supplied", () =>
3083 + Effect.gen(function* () {
3084 + const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3085 + const path = yield* Path.Path;
3086 + const selfInvocation = yield* resolveSelfInvocation();
3087 + const mockAgentPath = yield* path.fromFileUrl(
3088 + new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3089 + );
3090 + const runTurn = Effect.fn("AcpAdapterV2.testProtocolLoggingTurn")(function* (
3091 + name: string,
3092 + nativeLogging?: NonNullable<Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"]>,
3093 + ) {
3094 + const events: Array<EffectAcpProtocol.AcpProtocolLogEvent> = [];
3095 + const instanceId = ProviderInstanceId.make(`acp-test-${name}`);
3096 + const threadId = ThreadId.make(`thread-acp-${name}`);
3097 + const makeRuntime = makeMockRuntime({ childProcessSpawner, mockAgentPath });
3098 + const adapter = yield* makeAcpAdapterV2({
3099 + instanceId,
3100 + flavor: {
3101 + driver: ACP_TEST_DRIVER,
3102 + capabilities: AcpProviderCapabilitiesV2,
3103 + makeRuntime: (runtimeInput) =>
3104 + makeRuntime({
3105 + ...runtimeInput,
3106 + protocolLogging: {
3107 + ...runtimeInput.protocolLogging,
3108 + logger: (event) =>
3109 + Effect.sync(() => void events.push(event)).pipe(
3110 + Effect.andThen(runtimeInput.protocolLogging.logger?.(event) ?? Effect.void),
3111 + ),
3112 + },
3113 + }),
3114 + },
3115 + selfInvocation,
3116 + ...(nativeLogging === undefined ? {} : { nativeLogging }),
3117 + });
3118 + const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
3119 + runtimeMode: "full-access",
3120 + interactionMode: "default",
3121 + cwd: process.cwd(),
3122 + });
3123 + const modelSelection = { instanceId, model: "default" } as const;
3124 + const runtime = yield* adapter.openSession({
3125 + threadId,
3126 + providerSessionId: ProviderSessionId.make(`provider-session-acp-${name}`),
3127 + modelSelection,
3128 + runtimePolicy,
3129 + });
3130 + const providerThread = yield* runtime.ensureThread({
3131 + threadId,
3132 + modelSelection,
3133 + runtimePolicy,
3134 + });
3135 + yield* runtime.startTurn(
3136 + makeTurnInput({
3137 + threadId,
3138 + providerThread,
3139 + instanceId,
3140 + runtimePolicy,
3141 + now: yield* DateTime.now,
3142 + ordinal: 1,
3143 + }),
3144 + );
3145 + const terminal = yield* runtime.events.pipe(
3146 + Stream.filter((event) => event.type === "turn.terminal"),
3147 + Stream.runHead,
3148 + );
3149 + assert.equal(Option.getOrThrow(terminal).status, "completed");
3150 + return events;
3151 + });
3152 +
3153 + assert.deepEqual(yield* runTurn("protocol-logging-default"), []);
3154 +
3155 + const explicit: Array<EffectAcpProtocol.AcpProtocolLogEvent> = [];
3156 + yield* runTurn("protocol-logging-explicit", () => ({
3157 + protocolLogging: {
3158 + logIncoming: true,
3159 + logOutgoing: true,
3160 + logger: (event) => Effect.sync(() => void explicit.push(event)),
3161 + },
3162 + }));
3163 + assert.isTrue(explicit.some((e) => e.direction === "incoming" && e.stage === "raw"));
3164 + assert.isTrue(explicit.some((e) => e.direction === "outgoing"));
3165 + }).pipe(Effect.provide(layerTest), Effect.scoped),
3166 + );
3167 +
3168 it.effect("advertises ACP session notices and shows them as system notices", () =>
3169 Effect.gen(function* () {
3170 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
packages/provider-acp/src/server/adapter.ts
+2 -2
@@ -2367,8 +2367,8 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
2367 ? {}
2368 : { requestLogger: nativeLogging.requestLogger }),
2369 protocolLogging: nativeLogging?.protocolLogging ?? {
2370 - logIncoming: true,
2371 - logOutgoing: true,
2370 + logIncoming: false,
2371 + logOutgoing: false,
2372 logger: () => Effect.void,
2373 },
2374 };