From 012204068c4fb921bb0f49638bb9a7e36555cd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Fr=C3=B6hlich?= Date: Fri, 24 Jul 2026 17:26:39 +0200 Subject: [PATCH] fix: reset prompt guards on abort to prevent soft-lock window abortSession did not reset promptSubmissionRef or sendingState. The in-flight promptAsync could take seconds to settle after server abort, during which the Send button stayed disabled and any new send was rejected by the active-guard in sendPrompt. Reset both immediately after client.session.abort resolves. sendPrompt's own finally block sets the same values when it eventually runs, so the two writes compose to the same end state. --- providers/opencode-provider.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/providers/opencode-provider.tsx b/providers/opencode-provider.tsx index 431ac4b..865e834 100644 --- a/providers/opencode-provider.tsx +++ b/providers/opencode-provider.tsx @@ -1592,6 +1592,12 @@ export function OpencodeProvider({ children }: PropsWithChildren) { await clearPendingTaskFinishedNotification(sessionId); await client.session.abort({ sessionID: sessionId }); + // Reset prompt guards immediately so the user can submit again without + // waiting for the in-flight promptAsync to settle. sendPrompt's finally + // block sets the same values; both writes compose to the same state. + promptSubmissionRef.current = { active: false, sessionId: undefined }; + setSendingState((prev) => (prev.active ? { active: false, sessionId: undefined } : prev)); + await Promise.all([ refreshSessions(true), refreshMessages(sessionId, true),