Skip to content

πŸ™Œ OpenHands: AI-Driven Development

refactor(frontend): git actions should be enabled at all times (#11063)

Hiep Le12dc256b5a40
diff --git a/frontend/__tests__/components/interactive-chat-box.test.tsx b/frontend/__tests__/components/interactive-chat-box.test.tsx
index e6def49a71..7566c72d97 100644
--- a/frontend/__tests__/components/interactive-chat-box.test.tsx
+++ b/frontend/__tests__/components/interactive-chat-box.test.tsx
@@ -342,13 +342,7 @@ describe("InteractiveChatBox", () => {
// Simulate parent component updating the value prop
rerender(
<MemoryRouter>
- <InteractiveChatBox
- onSubmit={onSubmit}
- onStop={onStop}
- isWaitingForUserInput={true}
- hasSubstantiveAgentActions={true}
- optimisticUserMessage={false}
- />
+ <InteractiveChatBox onSubmit={onSubmit} onStop={onStop} />
</MemoryRouter>,
);
diff --git a/frontend/__tests__/utils/check-hardcoded-strings.test.tsx b/frontend/__tests__/utils/check-hardcoded-strings.test.tsx
index 249d3e0008..dd0a9075fe 100644
--- a/frontend/__tests__/utils/check-hardcoded-strings.test.tsx
+++ b/frontend/__tests__/utils/check-hardcoded-strings.test.tsx
@@ -60,13 +60,7 @@ describe("Check for hardcoded English strings", () => {
test("InteractiveChatBox should not have hardcoded English strings", () => {
const { container } = renderWithProviders(
<MemoryRouter>
- <InteractiveChatBox
- onSubmit={() => {}}
- onStop={() => {}}
- isWaitingForUserInput={false}
- hasSubstantiveAgentActions={false}
- optimisticUserMessage={false}
- />
+ <InteractiveChatBox onSubmit={() => {}} onStop={() => {}} />
</MemoryRouter>,
);
diff --git a/frontend/src/components/features/chat/chat-interface.tsx b/frontend/src/components/features/chat/chat-interface.tsx
index c6a025a0c7..37f63fe22f 100644
--- a/frontend/src/components/features/chat/chat-interface.tsx
+++ b/frontend/src/components/features/chat/chat-interface.tsx
@@ -156,10 +156,6 @@ export function ChatInterface() {
setFeedbackPolarity(polarity);
};
- const isWaitingForUserInput =
- curAgentState === AgentState.AWAITING_USER_INPUT ||
- curAgentState === AgentState.FINISHED;
-
// Create a ScrollProvider with the scroll hook values
const scrollProviderValue = {
scrollRef,
@@ -235,9 +231,6 @@ export function ChatInterface() {
<InteractiveChatBox
onSubmit={handleSendMessage}
onStop={handleStop}
- isWaitingForUserInput={isWaitingForUserInput}
- hasSubstantiveAgentActions={hasSubstantiveAgentActions}
- optimisticUserMessage={!!optimisticUserMessage}
/>
</div>
diff --git a/frontend/src/components/features/chat/git-control-bar-pr-button.tsx b/frontend/src/components/features/chat/git-control-bar-pr-button.tsx
index 5525271796..53e60f886d 100644
--- a/frontend/src/components/features/chat/git-control-bar-pr-button.tsx
+++ b/frontend/src/components/features/chat/git-control-bar-pr-button.tsx
@@ -8,14 +8,12 @@ import { Provider } from "#/types/settings";
interface GitControlBarPrButtonProps {
onSuggestionsClick: (value: string) => void;
- isEnabled: boolean;
hasRepository: boolean;
currentGitProvider: Provider;
}
export function GitControlBarPrButton({
onSuggestionsClick,
- isEnabled,
hasRepository,
currentGitProvider,
}: GitControlBarPrButtonProps) {
@@ -24,7 +22,7 @@ export function GitControlBarPrButton({
const { providers } = useUserProviders();
const providersAreSet = providers.length > 0;
- const isButtonEnabled = isEnabled && providersAreSet && hasRepository;
+ const isButtonEnabled = providersAreSet && hasRepository;
const handlePrClick = () => {
posthog.capture("create_pr_button_clicked");
diff --git a/frontend/src/components/features/chat/git-control-bar-pull-button.tsx b/frontend/src/components/features/chat/git-control-bar-pull-button.tsx
index 990c28f950..c4a109e001 100644
--- a/frontend/src/components/features/chat/git-control-bar-pull-button.tsx
+++ b/frontend/src/components/features/chat/git-control-bar-pull-button.tsx
@@ -8,12 +8,10 @@ import { I18nKey } from "#/i18n/declaration";
interface GitControlBarPullButtonProps {
onSuggestionsClick: (value: string) => void;
- isEnabled: boolean;
}
export function GitControlBarPullButton({
onSuggestionsClick,
- isEnabled,
}: GitControlBarPullButtonProps) {
const { t } = useTranslation();
@@ -22,7 +20,7 @@ export function GitControlBarPullButton({
const providersAreSet = providers.length > 0;
const hasRepository = conversation?.selected_repository;
- const isButtonEnabled = isEnabled && providersAreSet && hasRepository;
+ const isButtonEnabled = providersAreSet && hasRepository;
const handlePullClick = () => {
posthog.capture("pull_button_clicked");
diff --git a/frontend/src/components/features/chat/git-control-bar-push-button.tsx b/frontend/src/components/features/chat/git-control-bar-push-button.tsx
index d307e40f26..b32a8fe83c 100644
--- a/frontend/src/components/features/chat/git-control-bar-push-button.tsx
+++ b/frontend/src/components/features/chat/git-control-bar-push-button.tsx
@@ -8,14 +8,12 @@ import { Provider } from "#/types/settings";
interface GitControlBarPushButtonProps {
onSuggestionsClick: (value: string) => void;
- isEnabled: boolean;
hasRepository: boolean;
currentGitProvider: Provider;
}
export function GitControlBarPushButton({
onSuggestionsClick,
- isEnabled,
hasRepository,
currentGitProvider,
}: GitControlBarPushButtonProps) {
@@ -24,7 +22,7 @@ export function GitControlBarPushButton({
const { providers } = useUserProviders();
const providersAreSet = providers.length > 0;
- const isButtonEnabled = isEnabled && providersAreSet && hasRepository;
+ const isButtonEnabled = providersAreSet && hasRepository;
const handlePushClick = () => {
posthog.capture("push_button_clicked");
diff --git a/frontend/src/components/features/chat/git-control-bar.tsx b/frontend/src/components/features/chat/git-control-bar.tsx
index b68fe83754..045ac84283 100644
--- a/frontend/src/components/features/chat/git-control-bar.tsx
+++ b/frontend/src/components/features/chat/git-control-bar.tsx
@@ -11,17 +11,9 @@ import { GitControlBarTooltipWrapper } from "./git-control-bar-tooltip-wrapper";
interface GitControlBarProps {
onSuggestionsClick: (value: string) => void;
- isWaitingForUserInput: boolean;
- hasSubstantiveAgentActions: boolean;
- optimisticUserMessage: boolean;
}
-export function GitControlBar({
- onSuggestionsClick,
- isWaitingForUserInput,
- hasSubstantiveAgentActions,
- optimisticUserMessage,
-}: GitControlBarProps) {
+export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
const { t } = useTranslation();
const { data: conversation } = useActiveConversation();
@@ -30,12 +22,6 @@ export function GitControlBar({
const gitProvider = conversation?.git_provider as Provider;
const selectedBranch = conversation?.selected_branch;
- // Button is enabled when the agent is waiting for user input, has substantive actions, and no optimistic message
- const isButtonEnabled =
- isWaitingForUserInput &&
- hasSubstantiveAgentActions &&
- !optimisticUserMessage;
-
const hasRepository = !!selectedRepository;
return (
@@ -73,7 +59,6 @@ export function GitControlBar({
>
<GitControlBarPullButton
onSuggestionsClick={onSuggestionsClick}
- isEnabled={isButtonEnabled}
/>
</GitControlBarTooltipWrapper>
@@ -84,7 +69,6 @@ export function GitControlBar({
>
<GitControlBarPushButton
onSuggestionsClick={onSuggestionsClick}
- isEnabled={isButtonEnabled}
hasRepository={hasRepository}
currentGitProvider={gitProvider}
/>
@@ -97,7 +81,6 @@ export function GitControlBar({
>
<GitControlBarPrButton
onSuggestionsClick={onSuggestionsClick}
- isEnabled={isButtonEnabled}
hasRepository={hasRepository}
currentGitProvider={gitProvider}
/>
diff --git a/frontend/src/components/features/chat/interactive-chat-box.tsx b/frontend/src/components/features/chat/interactive-chat-box.tsx
index 3f33e3c930..bbfa47c261 100644
--- a/frontend/src/components/features/chat/interactive-chat-box.tsx
+++ b/frontend/src/components/features/chat/interactive-chat-box.tsx
@@ -13,17 +13,11 @@ import { RootState } from "#/store";
interface InteractiveChatBoxProps {
onSubmit: (message: string, images: File[], files: File[]) => void;
onStop: () => void;
- isWaitingForUserInput: boolean;
- hasSubstantiveAgentActions: boolean;
- optimisticUserMessage: boolean;
}
export function InteractiveChatBox({
onSubmit,
onStop,
- isWaitingForUserInput,
- hasSubstantiveAgentActions,
- optimisticUserMessage,
}: InteractiveChatBoxProps) {
const {
images,
@@ -159,12 +153,7 @@ export function InteractiveChatBox({
conversationStatus={conversation?.status || null}
/>
<div className="mt-4">
- <GitControlBar
- onSuggestionsClick={handleSuggestionsClick}
- isWaitingForUserInput={isWaitingForUserInput}
- hasSubstantiveAgentActions={hasSubstantiveAgentActions}
- optimisticUserMessage={optimisticUserMessage}
- />
+ <GitControlBar onSuggestionsClick={handleSuggestionsClick} />
</div>
</div>
);