Skip to content

Commit 0e1a322

Browse files
authored
fix(agents): prevent hosted tools during conversation compaction (#118618)
1 parent 6d8c1ed commit 0e1a322

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎src/agents/embedded-agent-runner/compact.hooks.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,8 @@ describe("compactEmbeddedAgentSessionDirect hooks", () => {
919919
expectRecordFields(mockCallArg(applyExtraParamsToAgentMock, 0, 11), {
920920
nativeWebSearchPolicyContext: {
921921
sessionKey: undefined,
922+
webSearchEnabled: false,
923+
runtimeToolAllowlist: [],
922924
sandboxToolPolicy: undefined,
923925
messageProvider: undefined,
924926
agentAccountId: undefined,

‎src/agents/embedded-agent-runner/compaction-session-agent.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export async function prepareCompactionSessionAgent(params: {
4242
senderName?: string | null;
4343
senderUsername?: string | null;
4444
senderE164?: string | null;
45-
webSearchEnabled?: boolean;
4645
}) {
4746
const authStorage =
4847
params.authStorage &&
@@ -107,10 +106,11 @@ export async function prepareCompactionSessionAgent(params: {
107106
{
108107
...(preparedRuntimeExtraParams ? { preparedExtraParams: preparedRuntimeExtraParams } : {}),
109108
nativeWebSearchPolicyContext: {
110-
// Compaction rebuilds the stream wrapper, so preserve the session policy
111-
// inputs that can suppress provider-native search.
109+
// Summaries have no tool loop; provider-hosted tools must not inherit
110+
// the originating conversation's broader web-search authority.
112111
sessionKey: params.sessionKey,
113-
webSearchEnabled: params.webSearchEnabled,
112+
webSearchEnabled: false,
113+
runtimeToolAllowlist: [],
114114
sandboxToolPolicy: params.sandboxToolPolicy,
115115
messageProvider: params.messageProvider,
116116
agentAccountId: params.agentAccountId,

‎src/agents/embedded-agent-runner/compaction-session-execution.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ export async function executePreparedCompactionSession(runtime: PreparedCompacti
284284
senderName: params.senderName,
285285
senderUsername: params.senderUsername,
286286
senderE164: params.senderE164,
287-
webSearchEnabled: params.toolOverrides?.webSearch !== false,
288287
});
289288
session.agent.streamFn = wrapStreamFnWithDiagnosticModelCallEvents(
290289
session.agent.streamFn,

0 commit comments

Comments
 (0)