From 39cf8703b70619a212517eeba99ead18dcf8db94 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Fri, 16 Oct 2026 16:16:32 -0700 Subject: [PATCH] fix(native-chat): keep the session host under its line limit (#29869) #29121 and #27925 each added lines to structured-agent-session-host.ts and passed CI on their own; together they left it at 302 countable lines, so static analysis fails on main. Move the late-dispatch and unanswered-dispatch delegates into the mutation delegates that already wrap the same context. --- .../structured-agent-session-host-mutations.ts | 9 ++++++++- .../structured-agent-session-host.ts | 10 ++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.ts b/src/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.ts index bfe82d6883b..6ea934bf5e8 100644 --- a/src/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.ts +++ b/src/main/native-chat/agent-session-wire/structured-agent-session-host-mutations.ts @@ -58,6 +58,8 @@ import { type StructuredAgentSessionOptionsReader } from './structured-agent-session-options-read' import { writeStructuredAgentSessionOption } from './structured-agent-session-message-options' +import { settleStructuredAgentSessionLateDispatch } from './structured-agent-session-late-dispatch' +import { releaseStructuredAgentSessionUnansweredDispatches } from './structured-agent-session-unanswered-dispatch-release' export function sendStructuredAgentSessionTurn( context: StructuredAgentSessionMutationContext, @@ -291,6 +293,11 @@ export function structuredAgentSessionMutationDelegates( readOptions: ( sessionId: string, reader: StructuredAgentSessionOptionsReader = IN_PROCESS_OPTIONS_READER - ) => readStructuredAgentSessionOptions(context(), sessionId, reader) + ) => readStructuredAgentSessionOptions(context(), sessionId, reader), + settleLateDispatch: (input: Parameters[1]) => + settleStructuredAgentSessionLateDispatch(context(), input), + releaseUnansweredDispatches: ( + input: Parameters[1] + ) => releaseStructuredAgentSessionUnansweredDispatches(context(), input) } } diff --git a/src/main/native-chat/agent-session-wire/structured-agent-session-host.ts b/src/main/native-chat/agent-session-wire/structured-agent-session-host.ts index 50bcda82121..3869763ae5e 100644 --- a/src/main/native-chat/agent-session-wire/structured-agent-session-host.ts +++ b/src/main/native-chat/agent-session-wire/structured-agent-session-host.ts @@ -29,8 +29,6 @@ import { structuredAgentSessionMutationDelegates, type StructuredAgentSessionMutationContext } from './structured-agent-session-host-mutations' -import { settleStructuredAgentSessionLateDispatch } from './structured-agent-session-late-dispatch' -import { releaseStructuredAgentSessionUnansweredDispatches } from './structured-agent-session-unanswered-dispatch-release' import { flushStructuredAgentSessionHost } from './structured-agent-session-host-teardown' import type { StructuredAgentSessionCaller, @@ -341,12 +339,8 @@ export class StructuredAgentSessionHost { subscribe = (input: AgentSessionSubscribeInput) => this.backgroundTasks.subscribe(input) - settleLateDispatch = (input: Parameters[1]) => - settleStructuredAgentSessionLateDispatch(this.mutationContext(), input) - - releaseUnansweredDispatches = ( - input: Parameters[1] - ) => releaseStructuredAgentSessionUnansweredDispatches(this.mutationContext(), input) + settleLateDispatch = this.mutations.settleLateDispatch + releaseUnansweredDispatches = this.mutations.releaseUnansweredDispatches publishChildWorkEvidence = this.clientDelivery.publishChildWork unsubscribe = (sessionId: string, id: string): void => this.subscribers.close(sessionId, id)