From 9fd0a1b9c7dc0c9f89d0dc43203b4375479a741b Mon Sep 17 00:00:00 2001 From: Dotta Date: Thu, 20 Aug 2026 23:27:45 +0000 Subject: [PATCH] fix(connections): preserve reconnect approval gates Co-Authored-By: Paperclip --- server/src/__tests__/tool-access-service.test.ts | 7 ++++++- server/src/services/tool-access.ts | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/server/src/__tests__/tool-access-service.test.ts b/server/src/__tests__/tool-access-service.test.ts index d5c0eba1d98..af4147f2c03 100644 --- a/server/src/__tests__/tool-access-service.test.ts +++ b/server/src/__tests__/tool-access-service.test.ts @@ -6103,7 +6103,12 @@ describeEmbeddedPostgres("tool access service", () => { await expect(db.select().from(toolPolicies).where(and( eq(toolPolicies.companyId, company.id), eq(toolPolicies.enabled, true), - ))).resolves.toHaveLength(0); + ))).resolves.toEqual([ + expect.objectContaining({ + policyType: "require_approval", + selectors: { catalogEntryId: updateEntry.id }, + }), + ]); }); it("stops and restarts local stdio runtime slots through the board service", async () => { diff --git a/server/src/services/tool-access.ts b/server/src/services/tool-access.ts index e8dd8ba00db..7fc81cb5880 100644 --- a/server/src/services/tool-access.ts +++ b/server/src/services/tool-access.ts @@ -4266,15 +4266,6 @@ export function toolAccessService(db: Db, options: ToolAccessServiceOptions = {} activeCatalogEntryIds: activeEntries.map((entry) => entry.id), actor, }); - if (refreshOptions.enableAllByDefault) { - await upsertAskFirstPolicies({ - companyId: updatedConnection.companyId, - connection: updatedConnection, - askFirstEntries: [], - actor, - }); - } - await audit({ companyId: connection.companyId, connectionId: connection.id,