From 7fd7c420c7dcb6da169b71758d58f13a88591e9a Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Mon, 30 Dec 2024 16:12:25 -0800 Subject: [PATCH 1/3] fix NonEmptyFirstMessage storybook --- .../chat/cells/messageCell/human/HumanMessageCell.story.tsx | 6 +++--- .../cells/messageCell/human/editor/HumanMessageEditor.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/webviews/chat/cells/messageCell/human/HumanMessageCell.story.tsx b/vscode/webviews/chat/cells/messageCell/human/HumanMessageCell.story.tsx index 9c03123f1d27..72332a6cee43 100644 --- a/vscode/webviews/chat/cells/messageCell/human/HumanMessageCell.story.tsx +++ b/vscode/webviews/chat/cells/messageCell/human/HumanMessageCell.story.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from '@storybook/react' -import { PromptString, ps } from '@sourcegraph/cody-shared' +import { FIXTURE_MODEL, PromptString, ps } from '@sourcegraph/cody-shared' import { ExtensionAPIProviderForTestsOnly, MOCK_API } from '@sourcegraph/prompt-editor' import { Observable } from 'observable-fns' import { URI } from 'vscode-uri' @@ -63,7 +63,7 @@ export const WithInitialContext: StoryObj = { Observable.of([]), + chatModels: () => Observable.of([FIXTURE_MODEL]), defaultContext: () => Observable.of({ initialContext: [ @@ -95,7 +95,7 @@ export const WithInitialContextFileTooLarge: StoryObj = { Observable.of([]), + chatModels: () => Observable.of([FIXTURE_MODEL]), defaultContext: () => Observable.of({ initialContext: [ diff --git a/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx b/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx index 9683d4e35ed2..068cb4423ace 100644 --- a/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx +++ b/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx @@ -1,6 +1,7 @@ import { type ChatMessage, FAST_CHAT_INPUT_TOKEN_BUDGET, + FIXTURE_MODEL, FeatureFlag, type Model, ModelTag, @@ -87,7 +88,6 @@ export const HumanMessageEditor: FunctionComponent<{ onChange, onSubmit: parentOnSubmit, onStop, - isFirstInteraction, isLastInteraction, isEditorInitiallyFocused, className, @@ -390,7 +390,7 @@ export const HumanMessageEditor: FunctionComponent<{ ) ) - const currentChatModel = useMemo(() => models[0], [models[0]]) + const currentChatModel = useMemo(() => (models ? models[0] : undefined), [models, models?.[0]]) const defaultContext = useDefaultContextForChat() useEffect(() => { From 55b07bc9994b322936a85e2fa271a6195076685e Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Thu, 2 Jan 2025 11:54:11 -0800 Subject: [PATCH 2/3] fix build --- .../chat/cells/messageCell/human/editor/HumanMessageEditor.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx b/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx index 068cb4423ace..26d4ac10acfa 100644 --- a/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx +++ b/vscode/webviews/chat/cells/messageCell/human/editor/HumanMessageEditor.tsx @@ -1,7 +1,6 @@ import { type ChatMessage, FAST_CHAT_INPUT_TOKEN_BUDGET, - FIXTURE_MODEL, FeatureFlag, type Model, ModelTag, From dc4ce4716f1d33daf870792aae87dc05377ecaaa Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Thu, 2 Jan 2025 13:20:37 -0800 Subject: [PATCH 3/3] reduce flakiness --- vscode/src/completions/inline-completion-item-provider.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vscode/src/completions/inline-completion-item-provider.test.ts b/vscode/src/completions/inline-completion-item-provider.test.ts index 59ea77169e74..0f4272cc5ac8 100644 --- a/vscode/src/completions/inline-completion-item-provider.test.ts +++ b/vscode/src/completions/inline-completion-item-provider.test.ts @@ -128,7 +128,8 @@ describe('InlineCompletionItemProvider', () => { // Check if the trigger delay is respected const elapsedTime = Date.now() - startTime - expect(elapsedTime).toBeGreaterThanOrEqual(triggerDelay) + // Note: we add 1.0 here for some buffer to reduce flakiness (https://github.com/sourcegraph/cody/actions/runs/12587968355/job/35084898262?pr=6492) + expect(elapsedTime + 1.0).toBeGreaterThanOrEqual(triggerDelay) // We only check for greater than because a less than would vary depending on the CI machine // Switch to fake timers for precise control