The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): make the deep-truncate confirm explicit at every rewind site
kshitijk4pooreba445b402bc
diff --git a/apps/desktop/src/app/chat/session-tile-actions.ts b/apps/desktop/src/app/chat/session-tile-actions.tsindex c3b60d784b7..19bafc82ee5 100644--- a/apps/desktop/src/app/chat/session-tile-actions.ts+++ b/apps/desktop/src/app/chat/session-tile-actions.ts@@ -581,7 +581,7 @@ export function useSessionTileActions({ requestGateway, runtimeId, scope, storedplan.truncateRowId,plan.sourceText,durableRowIdsForRebind(messages),- plan.confirmDeepTruncate ?? false+ plan.confirmDeepTruncate))} catch (err) {@@ -627,7 +627,8 @@ export function useSessionTileActions({ requestGateway, runtimeId, scope, storedplan.truncateMessageId,plan.truncateRowId,plan.sourceText,- durableRowIdsForRebind(messages)+ durableRowIdsForRebind(messages),+ true))} catch (err) {@@ -662,7 +663,8 @@ export function useSessionTileActions({ requestGateway, runtimeId, scope, storedretryPlan.truncateMessageId,retryPlan.truncateRowId,retryPlan.sourceText,- durableRowIdsForRebind(freshMessages)+ durableRowIdsForRebind(freshMessages),+ true))@@ -719,7 +721,8 @@ export function useSessionTileActions({ requestGateway, runtimeId, scope, storedplan.truncateMessageId,plan.truncateRowId,plan.sourceText,- durableRowIdsForRebind(messages)+ durableRowIdsForRebind(messages),+ true))} catch (err) {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.tsindex b025d86b10a..63b1e669636 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@@ -1029,7 +1029,7 @@ export function usePromptActions({plan.truncateRowId,plan.sourceText,durableRowIdsForRebind(messages),- plan.confirmDeepTruncate ?? false+ plan.confirmDeepTruncate)applySurvivorRowIds(sessionId, survivorRowIds)@@ -1104,7 +1104,8 @@ export function usePromptActions({interruptFirst,plan.truncateRowId,plan.sourceText,- durableRowIdsForRebind(messages)+ durableRowIdsForRebind(messages),+ true)applySurvivorRowIds(sessionId, survivorRowIds)@@ -1140,7 +1141,8 @@ export function usePromptActions({false,retryPlan.truncateRowId,retryPlan.sourceText,- durableRowIdsForRebind(refreshed)+ durableRowIdsForRebind(refreshed),+ true)applySurvivorRowIds(sessionId, survivorRowIds)@@ -1241,7 +1243,8 @@ export function usePromptActions({interruptFirst,plan.truncateRowId,plan.sourceText,- durableRowIdsForRebind(messages)+ durableRowIdsForRebind(messages),+ true)applySurvivorRowIds(sessionId, survivorRowIds)@@ -1275,7 +1278,8 @@ export function usePromptActions({false,retryPlan.truncateRowId,retryPlan.sourceText,- durableRowIdsForRebind(refreshed)+ durableRowIdsForRebind(refreshed),+ true)applySurvivorRowIds(sessionId, survivorRowIds)diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.test.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.test.tsindex 1a9490bdf09..ab4b2f1d34a 100644--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.test.ts+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.test.ts@@ -738,7 +738,7 @@ describe('planConfirmedReload (#133716)', () => {plan.truncateRowId,plan.sourceText,undefined,- plan.confirmDeepTruncate ?? false+ plan.confirmDeepTruncate)}diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.tsindex c8e19177cd3..7a9fd08cdbd 100644--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.ts+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.ts@@ -281,9 +281,9 @@ export async function runRewindSubmit(truncateRowId?: number,sourceText?: string,rebindRowIds?: readonly number[],- // Restore/edit name their target explicitly; only regenerate (implicit- // target) passes false unless the user confirmed a deep cut (#133716).- confirmDeepTruncate = true+ // Omitted never means confirmed: restore/edit (explicit target) and a+ // confirmed deep regenerate pass true; tail regenerate passes false (#133716).+ confirmDeepTruncate?: boolean): Promise<SurvivorUserRowIds | undefined> {// Recovery may rebind the live id mid-flight; interrupt/submit must both// follow it rather than pinning the dead one.@@ -492,8 +492,8 @@ export function appendMidTurnUserMessage<export interface ReloadPlan {branchGroupId: string- /** Set only after the user confirmed a reload that archives later user turns. */- confirmDeepTruncate?: boolean+ /** True only after the user confirmed a reload that archives later user turns. */+ confirmDeepTruncate: boolean/** Original persisted text of the turn — the durable-row-id content key. */sourceText: stringtext: string@@ -533,6 +533,7 @@ export function planReload(messages: ChatMessage[], parentId: null | string): nureturn {branchGroupId: targetAssistant?.branchGroupId ?? branchGroupForUser(userMessage),+ confirmDeepTruncate: false,sourceText: text,text,truncateOrdinal: isFailedTurn ? undefined : visibleUserOrdinal(messages, userIndex),