Skip to content

The agent that grows with you

fix: settle terminal desktop admission receipts without stopping live turns

Tekniumd89a90e11848
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts
index 7faa5d4ac27..92c23de87de 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts
@@ -938,6 +938,22 @@ export function useSubmitPrompt(deps: SubmitPromptDeps) {
if (result.status === 'queued') {
dropOptimistic(sessionId)
+ } else if (result.status === 'terminal') {
+ // Deduplication does not start a turn or promise another terminal
+ // event. Remove our duplicate bubble, but preserve any live turn
+ // that an owner event established while the receipt was in flight.
+ const next = updateSessionState(liveSessionId, state => ({
+ ...state,
+ messages: state.messages.filter(message => message.id !== optimisticId),
+ ...(!state.turnLive && !state.streamId && !state.sawAssistantPayload && {
+ busy: false,
+ awaitingResponse: false,
+ pendingBranchGroup: null,
+ turnStartedAt: null
+ })
+ }), targetStoredSessionId)
+
+ if (!next.busy && !next.awaitingResponse) {releaseBusy()}
}
}
} catch (firstErr) {