The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): pin the deep-regenerate confirm wiring at both reload sites
kshitijk4poor2c1f9e4b39ce
diff --git a/apps/desktop/src/app/chat/session-tile-actions.test.ts b/apps/desktop/src/app/chat/session-tile-actions.test.tsindex a354d5cf1bc..49f1eba1110 100644--- a/apps/desktop/src/app/chat/session-tile-actions.test.ts+++ b/apps/desktop/src/app/chat/session-tile-actions.test.ts@@ -367,14 +367,26 @@ describe('useSessionTileActions reloadFromMessage failed-submit rollback (#95745})const { result } = renderTileActions()+ let asked = 0+// Regenerating u1 archives the later u2 turn: accept the deep-cut confirm (#133716).- const stopConfirming = $confirmRequest.listen(request => request && settleConfirm(true))+ const stopConfirming = $confirmRequest.listen(request => {+ if (request) {+ asked += 1+ settleConfirm(true)+ }+ })await act(async () => {await result.current.reloadFromMessage('u1')})stopConfirming()+ expect(asked).toBe(1)+ expect(requestGatewayMock.mock.calls.find(([method]) => method === 'prompt.submit')?.[1]).toMatchObject({+ confirm_deep_truncate: true+ })+const rolledBack = $sessionStates.get()[RUNTIME_SESSION_ID]?.messagesexpect(rolledBack?.map(m => m.id)).toEqual(['u1', 'a1', 'u2', 'a2'])diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsxindex 7d54519d34c..a069ea75c1c 100644--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx@@ -6130,9 +6130,11 @@ describe('usePromptActions reloadFromMessage failed-submit rollback (#95745)', (setMessages(seed as never)let latest: Record<string, unknown> | undefined+ const submits: Record<string, unknown>[] = []- const requestGateway = vi.fn(async (method: string) => {+ const requestGateway = vi.fn(async (method: string, params?: Record<string, unknown>) => {if (method === 'prompt.submit') {+ submits.push(params ?? {})throw new JsonRpcGatewayError('target user message is no longer in session history', {code: 4018,data: {@@ -6163,10 +6165,27 @@ describe('usePromptActions reloadFromMessage failed-submit rollback (#95745)', (/>)- // Regenerating u1 archives the later u2 turn: accept the deep-cut confirm (#133716).- const stopConfirming = $confirmRequest.listen(request => request && settleConfirm(true))+ // Regenerating u1 archives the later u2 turn: it asks first; a decline sends nothing (#133716).+ let answer = false+ let asked = 0++ const stopConfirming = $confirmRequest.listen(request => {+ if (request) {+ asked += 1+ settleConfirm(answer)+ }+ })++ await handle!.reloadFromMessage('u1')+ expect(asked).toBe(1)+ expect(submits).toEqual([])++ answer = trueawait handle!.reloadFromMessage('u1')stopConfirming()+ expect(asked).toBe(2)+ expect(submits).toHaveLength(1)+ expect(submits[0]).toMatchObject({ confirm_deep_truncate: true })const rolledBack = latest?.messages as Array<{ hidden?: boolean; id: string }> | undefined