π OpenHands: AI-Driven Development
Fix: Don't show status indicator for command timeouts (#8012)
Robert Brennan89f8e162daef
diff --git a/frontend/__tests__/components/chat/expandable-message.test.tsx b/frontend/__tests__/components/chat/expandable-message.test.tsxindex 3e4f2c3d39..2da47c6d4a 100644--- a/frontend/__tests__/components/chat/expandable-message.test.tsx+++ b/frontend/__tests__/components/chat/expandable-message.test.tsx@@ -95,6 +95,23 @@ describe("ExpandableMessage", () => {expect(screen.queryByTestId("status-icon")).not.toBeInTheDocument();});+ it("should render with neutral border and no icon for action messages with undefined success (timeout case)", () => {+ renderWithProviders(+ <ExpandableMessage+ id="OBSERVATION_MESSAGE$RUN"+ message="Command timed out"+ type="action"+ success={undefined}+ />,+ );+ const element = screen.getByText("OBSERVATION_MESSAGE$RUN");+ const container = element.closest(+ "div.flex.gap-2.items-center.justify-start",+ );+ expect(container).toHaveClass("border-neutral-300");+ expect(screen.queryByTestId("status-icon")).not.toBeInTheDocument();+ });+it("should render the out of credits message when the user is out of credits", async () => {const getConfigSpy = vi.spyOn(OpenHands, "getConfig");// @ts-expect-error - We only care about the APP_MODE and FEATURE_FLAGS fieldsdiff --git a/frontend/src/state/chat-slice.ts b/frontend/src/state/chat-slice.tsindex e6b2790f4e..f1403fb7f0 100644--- a/frontend/src/state/chat-slice.ts+++ b/frontend/src/state/chat-slice.ts@@ -252,7 +252,13 @@ export const chatSlice = createSlice({// Set success property based on observation typeif (observationID === "run") {const commandObs = observation.payload as CommandObservation;- causeMessage.success = commandObs.extras.metadata.exit_code === 0;+ // If exit_code is -1, it means the command timed out, so we set success to undefined+ // to not show any status indicator+ if (commandObs.extras.metadata.exit_code === -1) {+ causeMessage.success = undefined;+ } else {+ causeMessage.success = commandObs.extras.metadata.exit_code === 0;+ }} else if (observationID === "run_ipython") {// For IPython, we consider it successful if there's no error messageconst ipythonObs = observation.payload as IPythonObservation;