Skip to content

The agent that grows with you

test(desktop): a tile correction refused undelivered is handed back, not thrown

Teknium562080f91e09
diff --git a/apps/desktop/src/app/chat/session-tile-actions.test.ts b/apps/desktop/src/app/chat/session-tile-actions.test.ts
index de88ae4f8b7..7c4db845f61 100644
--- a/apps/desktop/src/app/chat/session-tile-actions.test.ts
+++ b/apps/desktop/src/app/chat/session-tile-actions.test.ts
@@ -1,3 +1,4 @@
+import { JsonRpcGatewayError } from '@hermes/shared'
import { renderHook } from '@testing-library/react'
import { act } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -168,6 +169,18 @@ describe('useSessionTileActions sleep/wake session recovery', () => {
expect(requestGatewayMock).toHaveBeenCalledExactlyOnceWith(mode === 'steer' ? 'session.steer' : 'session.redirect', { session_id: RUNTIME_SESSION_ID, text: 'keep correction' })
})
+ // #141644: a correction the owner refused before any agent saw it hands the words back (false)
+ // so the composer re-queues them, instead of throwing a "prompt failed" that drops them.
+ it('hands back a tile correction the owner refused undelivered', async () => {
+ requestGatewayMock.mockRejectedValue(
+ new JsonRpcGatewayError('execution_not_ready', { code: 4001, data: { reason: 'execution_not_ready' } })
+ )
+ const { result } = renderTileActions()
+ const ok = await act(async () => result.current.steerPrompt('keep correction'))
+ expect(ok).toBe(false)
+ expect(requestGatewayMock).toHaveBeenCalledTimes(1)
+ })
+
it('resumes the stored session and retries once when session.redirect (steer) reports "session not found"', async () => {
const calls: { method: string; params?: Record<string, unknown> }[] = []
let redirectAttempts = 0