From 92032d9d6c43fef1aa4be5de467d4da0cbff6139 Mon Sep 17 00:00:00 2001 From: m-vawter Date: Fri, 2 Oct 2026 20:57:13 -0400 Subject: [PATCH] fix(chat): Ask Agent to Fix reaches the agent when Agent Chat was closed (#92) askFix reopened the chat window, but its ref was still null in the same tick, so sendMessage was skipped silently. Wait one tick for the window to mount before sending. A new e2e spec closes Agent Chat, breaks an app, and asks the agent to fix it (red before this change, green after). Co-Authored-By: Claude Opus 5.5 --- app/app.vue | 6 ++-- tests/e2e/ask-fix-chat-closed.spec.ts | 46 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 tests/e2e/ask-fix-chat-closed.spec.ts diff --git a/app/app.vue b/app/app.vue index 32129f5..0659198 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,5 +1,5 @@ +` + +test.beforeEach(async ({ page, baseURL }) => { + await keepRequestsLocal(page, baseURL) +}) + +test('Ask Agent to Fix reopens a closed Agent Chat and still reaches the agent', async ({ page }) => { + const dominic = dominicHooks(page) + const chat = appWindow(page, 'Agent Chat') + const broken = appWindow(page, 'Broken (Syntax Error)') + await openDesktop(page) + + await chat.getByRole('button', { name: 'Close' }).click() + await expect(chat).toHaveCount(0) + + await dominic.injectBrokenApp('compile') + await expect(broken.getByText('Component Compilation Error')).toBeVisible() + + const requests = await stubAgentReply(page, { + text: 'Found the bug; sending a fixed version.', + updateApp: { id: 'broken-app', vueSfcCode: REPAIRED_APP, summary: 'Fix the deliberate error' }, + }) + await broken.getByRole('button', { name: 'Ask Agent to Fix' }).click() + + await expect(chat).toBeVisible() + await expect(broken.getByRole('heading', { name: 'Repaired by the agent' })).toBeVisible() + expect(requests).toHaveLength(1) +})