@@ -47,11 +47,11 @@ import { randomUUID } from '../../../shared/crypto'
4747import { LspController } from '../../../amazonq/lsp/lspController'
4848import { CodeWhispererSettings } from '../../../codewhisperer/util/codewhispererSettings'
4949import { getSelectedCustomization } from '../../../codewhisperer/util/customizationUtil'
50- import { FeatureConfigProvider } from '../../../shared/featureConfig'
5150import { getHttpStatusCode , AwsClientResponseError } from '../../../shared/errors'
5251import { uiEventRecorder } from '../../../amazonq/util/eventRecorder'
53- import { globals } from '../../../shared'
52+ import { globals , waitUntil } from '../../../shared'
5453import { telemetry } from '../../../shared/telemetry'
54+ import { Auth } from '../../../auth'
5555import { isSsoConnection } from '../../../auth/connection'
5656
5757export interface ChatControllerMessagePublishers {
@@ -633,17 +633,23 @@ export class ChatController {
633633 return
634634 }
635635 }
636- // if user does not have @workspace in the prompt, but user is in the data collection group
637- // If the user is in the data collection group but turned off local index to opt-out, do not collect data.
638- // TODO: Remove this entire block of code in one month as requested
636+ // if user does not have @workspace in the prompt, but user is Amazon internal
637+ // add project context by default
639638 else if (
640- FeatureConfigProvider . instance . isAmznDataCollectionGroup ( ) &&
639+ Auth . instance . isInternalAmazonUser ( ) &&
641640 ! LspController . instance . isIndexingInProgress ( ) &&
642641 CodeWhispererSettings . instance . isLocalIndexEnabled ( )
643642 ) {
644- getLogger ( ) . info ( `amazonq: User is in data collection group` )
645643 const start = performance . now ( )
646- triggerPayload . relevantTextDocuments = await LspController . instance . query ( triggerPayload . message )
644+ triggerPayload . relevantTextDocuments = await waitUntil (
645+ async function ( ) {
646+ if ( triggerPayload . message ) {
647+ return await LspController . instance . query ( triggerPayload . message )
648+ }
649+ return [ ]
650+ } ,
651+ { timeout : 500 , interval : 200 , truthy : false }
652+ )
647653 triggerPayload . projectContextQueryLatencyMs = performance . now ( ) - start
648654 }
649655 }
0 commit comments