From ae5c20fdd492d8bf4ef2a377e1b1493bbfb3d22d Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 9 Nov 2026 02:02:50 -0800 Subject: [PATCH] test: exercise naming fallback through Send now --- .../structured-chat-naming-runtime.test.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/runtime/agent-session/naming/structured-chat-naming-runtime.test.ts b/src/main/runtime/agent-session/naming/structured-chat-naming-runtime.test.ts index 2f96fc2d5e7..58b1f30e723 100644 --- a/src/main/runtime/agent-session/naming/structured-chat-naming-runtime.test.ts +++ b/src/main/runtime/agent-session/naming/structured-chat-naming-runtime.test.ts @@ -673,7 +673,7 @@ it('retires the selected first-handover source without adopting a replacement ch } }) -it('finishes naming admitted during delivery even if recording its failure cannot commit', async () => { +it('finishes Send now naming during delivery even if recording its failure cannot commit', async () => { const { chat, title, done, seeded } = await atRestNaming() const release = chat.holdNextStart() chat.failNextStart(new Error('Startup refused')) @@ -685,7 +685,17 @@ it('finishes naming admitted during delivery even if recording its failure canno try { await vi.waitFor(() => expect(chat.starts).toHaveBeenCalledOnce()) const sent = chat.send('Repair login') - expect(await sent.result).toMatchObject({ ok: true }) + const queued = await sent.result + if (!queued.ok || !('queued' in queued.value)) { + throw new Error('expected a queued receipt') + } + const messageId = queued.value.queued.messageId + expect(await chat.submission(sent.id)).toBeUndefined() + expect(await chat.sendNow(messageId)).toMatchObject({ ok: true }) + expect(await chat.handoff(messageId)).toMatchObject({ + queuedMessageId: messageId, + dispatchState: 'pending' + }) await seeded() const journal = chat.host.collaboratorsForTests().sessions.get(HOST_TEST_SESSION)!.journal const failure = vi @@ -694,7 +704,7 @@ it('finishes naming admitted during delivery even if recording its failure canno release() await done() expect(chat.store.getRecord(HOST_TEST_SESSION)?.conversationName).toBe('Login repair') - expect((await chat.submission(sent.id))?.dispatchState).toBe('pending') + expect((await chat.handoff(messageId))?.dispatchState).toBe('pending') expect(title).not.toHaveBeenCalled() failure.mockRestore() } finally {