Skip to content

The agent that grows with you

test(desktop): pin the grafted residue rows and fix the guard-loop comment

kshitijk4poor6afef023c8d7
diff --git a/apps/desktop/src/app/chat/transcript-backfill.stale-guard-loop.test.ts b/apps/desktop/src/app/chat/transcript-backfill.stale-guard-loop.test.ts
index 9c41072d402..7c753df8081 100644
--- a/apps/desktop/src/app/chat/transcript-backfill.stale-guard-loop.test.ts
+++ b/apps/desktop/src/app/chat/transcript-backfill.stale-guard-loop.test.ts
@@ -11,8 +11,10 @@ import type { SessionMessage } from '@/types/hermes'
*
* `submit.ts` (use-prompt-actions) and `use-session-tile-delegate.ts` read the
* cached transcript, drop the optimistic bubble, ask
- * `transcriptRefreshIfBehind` whether this window is behind, and on a non-null
- * answer install the refreshed page and REFUSE the send. A user who retries
+ * `transcriptRefreshIfBehind` whether this window is behind, and when the
+ * surplus is a competing view's (`competingView`) install the refreshed page
+ * and REFUSE the send (own residue is grafted and the send proceeds). A user
+ * who retries
* re-runs that loop with the installed transcript as `localMessages`, so the
* guard has to reach a fixed point: a window that was just refreshed must not
* be reported behind again.
diff --git a/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts b/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts
index e037ff8a551..73aa9dadacf 100644
--- a/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts
+++ b/apps/desktop/src/app/contrib/hooks/use-session-tile-delegate.test.ts
@@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { reasoningEffortPending } from '@/app/chat/session-view'
import type { ClientSessionState } from '@/app/types'
import type * as HermesModule from '@/hermes'
-import { textPart } from '@/lib/chat-messages'
+import { type ChatMessage, textPart } from '@/lib/chat-messages'
import { createClientSessionState } from '@/lib/chat-runtime'
import { $notifications } from '@/store/notifications'
import { $cronRunReadOnlyVerdicts, recordCronRunVerdict } from '@/store/read-only-transcript'
@@ -804,8 +804,7 @@ describe('useSessionTileDelegate stale multi-window guard (#65047)', () => {
1_800_000,
undefined
)
- expect(seeds.at(-1)).toEqual(expect.objectContaining({ messages: expect.any(Array) }))
- expect((seeds.at(-1) as { messages: unknown[] }).messages).toHaveLength(2)
+ expect((seeds.at(-1) as { messages: ChatMessage[] }).messages.map(message => message.rowId)).toEqual([1, 2])
expect($notifications.get().some(note => note.kind === 'warning')).toBe(false)
})