@@ -49,11 +49,11 @@ import { randomUUID } from '../../../shared/crypto'
4949import { LspController } from '../../../amazonq/lsp/lspController'
5050import { CodeWhispererSettings } from '../../../codewhisperer/util/codewhispererSettings'
5151import { getSelectedCustomization } from '../../../codewhisperer/util/customizationUtil'
52- import { FeatureConfigProvider } from '../../../shared/featureConfig'
5352import { getHttpStatusCode , AwsClientResponseError } from '../../../shared/errors'
5453import { uiEventRecorder } from '../../../amazonq/util/eventRecorder'
55- import { globals } from '../../../shared'
54+ import { globals , waitUntil } from '../../../shared'
5655import { telemetry } from '../../../shared/telemetry'
56+ import { Auth } from '../../../auth'
5757
5858export interface ChatControllerMessagePublishers {
5959 readonly processPromptChatMessage : MessagePublisher < PromptMessage >
@@ -634,17 +634,23 @@ export class ChatController {
634634 return
635635 }
636636 }
637- // if user does not have @workspace in the prompt, but user is in the data collection group
638- // If the user is in the data collection group but turned off local index to opt-out, do not collect data.
639- // TODO: Remove this entire block of code in one month as requested
637+ // if user does not have @workspace in the prompt, but user is Amazon internal
638+ // add project context by default
640639 else if (
641- FeatureConfigProvider . instance . isAmznDataCollectionGroup ( ) &&
640+ Auth . instance . isInternalAmazonUser ( ) &&
642641 ! LspController . instance . isIndexingInProgress ( ) &&
643642 CodeWhispererSettings . instance . isLocalIndexEnabled ( )
644643 ) {
645- getLogger ( ) . info ( `amazonq: User is in data collection group` )
646644 const start = performance . now ( )
647- triggerPayload . relevantTextDocuments = await LspController . instance . query ( triggerPayload . message )
645+ triggerPayload . relevantTextDocuments = await waitUntil (
646+ async function ( ) {
647+ if ( triggerPayload . message ) {
648+ return await LspController . instance . query ( triggerPayload . message )
649+ }
650+ return [ ]
651+ } ,
652+ { timeout : 500 , interval : 200 , truthy : false }
653+ )
648654 triggerPayload . projectContextQueryLatencyMs = performance . now ( ) - start
649655 }
650656 }
0 commit comments