Skip to content

Commit 533a179

Browse files
fix(web): Enter-to-resume returns the submit result and gets a regression test
AI-assisted; verified with the tests and tools listed above.
1 parent a2217d0 commit 533a179

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

‎apps/web/src/components/ChatView.browser.test.tsx‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,32 @@ it("a rejected send leaves the timeline when a new draft was typed meanwhile", a
229229
await expect.element(page.getByText("Failed prompt")).not.toBeInTheDocument();
230230
expect(editor.element().textContent).toContain("Next draft");
231231
});
232+
233+
it("Enter on an empty prompt resumes an interrupted thread", async () => {
234+
const history = threadWithHistory("interrupted", 1);
235+
const interruptedRun = { ...history.runs[0]!, status: "interrupted" as const };
236+
const thread = { ...history, runs: [interruptedRun] };
237+
using _environment = installFakeEnvironment([thread], { acceptCommands: true });
238+
__setClientSettingsForTests({
239+
...DEFAULT_CLIENT_SETTINGS,
240+
onboardingCompletedAt: "2026-01-01T00:00:00.000Z",
241+
});
242+
const router = getRouter(
243+
createMemoryHistory({ initialEntries: [`/${ENVIRONMENT_ID}/${thread.id}`] }),
244+
);
245+
await router.load();
246+
await using _app = await render(<AppRoot router={router} />, {
247+
// AppRoot brings its own router.
248+
router: false,
249+
});
250+
await expect.element(page.getByRole("button", { name: "Resume thread" })).toBeVisible();
251+
252+
await userEvent.click(page.getByTestId("composer-editor"));
253+
await userEvent.keyboard("{Enter}");
254+
255+
await vi.waitFor(() =>
256+
expect(dispatchedCommands()).toContainEqual(
257+
expect.objectContaining({ manualContinuationOfRunId: interruptedRun.id }),
258+
),
259+
);
260+
});

‎apps/web/src/components/chat/ChatComposer.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,8 +2146,9 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
21462146
// An empty draft has nothing to send; Enter does what the Resume thread button does.
21472147
if (showResumeAction && !activePendingProgress) {
21482148
event?.preventDefault();
2149-
if (!isSendBusy && environmentUnavailable === null) onResume();
2150-
return;
2149+
if (isSendBusy || environmentUnavailable !== null) return false;
2150+
onResume();
2151+
return true;
21512152
}
21522153
const submission = submitComposerDraft({
21532154
prompt: promptRef.current,

0 commit comments

Comments
 (0)