From ab8ed5e378f5a1fef5e0e46bcdb00c2aa07a8914 Mon Sep 17 00:00:00 2001 From: 777genius Date: Sun, 31 May 2026 00:26:02 +0300 Subject: [PATCH] perf(main): reduce bootstrap transcript context scans --- .../services/team/TeamProvisioningService.ts | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/main/services/team/TeamProvisioningService.ts b/src/main/services/team/TeamProvisioningService.ts index 9e8f1ce2..0899a99e 100644 --- a/src/main/services/team/TeamProvisioningService.ts +++ b/src/main/services/team/TeamProvisioningService.ts @@ -318,7 +318,6 @@ import { getBootstrapTranscriptSuccessSource, getCanonicalSendMessageFieldRule, getCanonicalSendMessageToolRule, - isBootstrapTranscriptContextText, isTaskBoardSnapshotWorkCandidate, normalizeMemberDiagnosticText, shouldUseGeminiStagedLaunch, @@ -740,6 +739,28 @@ interface ParsedBootstrapTranscriptTailCacheEntry { lines: ParsedBootstrapTranscriptTailLine[]; } +function isNormalizedBootstrapTranscriptContextText( + normalizedText: string, + normalizedTeamName: string, + normalizedMemberName: string +): boolean { + if (!normalizedText || !normalizedTeamName || !normalizedMemberName) { + return false; + } + if ( + !normalizedText.includes(normalizedTeamName) || + !normalizedText.includes(normalizedMemberName) + ) { + return false; + } + return ( + normalizedText.includes('bootstrap') || + normalizedText.includes('bootstrapping') || + normalizedText.includes('member briefing') || + normalizedText.includes('task briefing') + ); +} + import type { ActiveToolCall, AgentActionMode, @@ -30426,6 +30447,7 @@ export class TeamProvisioningService { } = {} ): Promise { const normalizedMemberName = memberName.trim().toLowerCase(); + const normalizedTeamName = teamName.trim().toLowerCase(); const contextMemberNames = Array.from( new Set( [memberName, ...(options.contextMemberNames ?? [])] @@ -30433,6 +30455,9 @@ export class TeamProvisioningService { .filter(Boolean) ) ); + const normalizedContextMemberNames = contextMemberNames.map((name) => + name.trim().toLowerCase() + ); const cacheKey = this.buildBootstrapTranscriptOutcomeCacheKey({ filePath, sinceMs, @@ -30477,16 +30502,15 @@ export class TeamProvisioningService { } const lineNormalizedText = normalizedText ?? ''; if (shouldCollectBootstrapContext) { - for (const contextMemberName of contextMemberNames) { + for (const contextMemberName of normalizedContextMemberNames) { if ( - isBootstrapTranscriptContextText( - text, - teamName, - contextMemberName, - lineNormalizedText + isNormalizedBootstrapTranscriptContextText( + lineNormalizedText, + normalizedTeamName, + contextMemberName ) ) { - bootstrapContextMembers.add(contextMemberName.trim().toLowerCase()); + bootstrapContextMembers.add(contextMemberName); } } }