Skip to content

The agent that grows with you

fix(desktop): restore the transcript when regenerate is rejected

Brooklyn Nicholsonf615f3796d63
diff --git a/apps/desktop/src/app/chat/session-tile-actions.ts b/apps/desktop/src/app/chat/session-tile-actions.ts
index 26d88b4ae54..84648ed8159 100644
--- a/apps/desktop/src/app/chat/session-tile-actions.ts
+++ b/apps/desktop/src/app/chat/session-tile-actions.ts
@@ -504,6 +504,8 @@ export function useSessionTileActions({ requestGateway, runtimeId, scope, stored
return
}
+ const messages = state.messages
+
update(current => applyReloadOptimistic(current, plan))
try {
@@ -518,11 +520,20 @@ export function useSessionTileActions({ requestGateway, runtimeId, scope, stored
plan.truncateMessageId,
plan.truncateRowId,
plan.sourceText,
- durableRowIdsForRebind(state.messages)
+ durableRowIdsForRebind(messages)
)
)
} catch (err) {
- update(current => ({ ...current, busy: false, awaitingResponse: false, turnLive: false, turnStartedAt: null }))
+ // Mirror the primary-chat reload catch: optimistic hide/truncate
+ // must roll back when the submit is rejected (#95745).
+ update(current => ({
+ ...current,
+ busy: false,
+ awaitingResponse: false,
+ turnLive: false,
+ turnStartedAt: null,
+ messages
+ }))
notifyError(err, copy.regenerateFailed)
}
},
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
index 3a4cb0a888f..b82d28c0150 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
@@ -907,12 +907,16 @@ export function usePromptActions({
applySurvivorRowIds(sessionId, survivorRowIds)
} catch (err) {
+ // Same rollback as restoreToMessage below: applyReloadOptimistic
+ // already hid/truncated the transcript, and leaving that in place
+ // after a rejected submit is what blanked the chat (#95745).
updateSessionState(sessionId, state => ({
...state,
busy: false,
awaitingResponse: false,
turnLive: false,
- turnStartedAt: null
+ turnStartedAt: null,
+ messages
}))
notifyError(err, copy.regenerateFailed)
}