E2E Chat main red: optimistic user message uses different id than USER_MESSAGE echo #2713

Closed
opened 2026-06-13 06:12:26 +00:00 by agent-researcher · 1 comment
Member

MECHANISM: The main E2E Chat red on run 357399/job 485429 is an origin-device duplicate-user-message bug. useChatSend optimistically appends userMsg := createMessage(...) at canvas/src/components/tabs/chat/hooks/useChatSend.ts:183-184, but the A2A request then sends a fresh crypto.randomUUID() as params.message.messageId at useChatSend.ts:220-223. The server broadcasts USER_MESSAGE with that second id, and ChatTab dedupes only by id at canvas/src/components/tabs/ChatTab.tsx:171-178, so the origin device renders both the optimistic bubble and the server echo.

EVIDENCE: Gitea run 357399, job 485429, head ab5dcee676a54342116748caaea16ea5c5b0ec81 failed only in E2E Chat / E2E Chat. The failing Playwright assertion is canvas/e2e/chat-desktop.spec.ts:70-77; log excerpt: resolved to 2 elements. The duplicate is the exact user prompt What is the weather?, before the echo assertion, which matches the client-side optimistic+WS echo path rather than an agent/runtime failure. The comment in useChatSocket.ts:150-155 says the origin's createMessage already used the same id, but useChatSend.ts:222 currently proves the opposite.

RECOMMENDED FIX SHAPE: In canvas/src/components/tabs/chat/hooks/useChatSend.ts, make the outbound A2A message.messageId reuse the optimistic userMsg.id instead of generating a separate UUID, or add an explicit-id variant of createMessage and thread that single id through both optimistic append and POST payload. Keep appendMessageDedupedById unchanged; add a unit/E2E regression that origin-device USER_MESSAGE echo for the same message id does not create a second user bubble.

MECHANISM: The main E2E Chat red on run 357399/job 485429 is an origin-device duplicate-user-message bug. `useChatSend` optimistically appends `userMsg := createMessage(...)` at `canvas/src/components/tabs/chat/hooks/useChatSend.ts:183-184`, but the A2A request then sends a fresh `crypto.randomUUID()` as `params.message.messageId` at `useChatSend.ts:220-223`. The server broadcasts `USER_MESSAGE` with that second id, and `ChatTab` dedupes only by id at `canvas/src/components/tabs/ChatTab.tsx:171-178`, so the origin device renders both the optimistic bubble and the server echo. EVIDENCE: Gitea run 357399, job 485429, head `ab5dcee676a54342116748caaea16ea5c5b0ec81` failed only in `E2E Chat / E2E Chat`. The failing Playwright assertion is `canvas/e2e/chat-desktop.spec.ts:70-77`; log excerpt: `resolved to 2 elements`. The duplicate is the exact user prompt `What is the weather?`, before the echo assertion, which matches the client-side optimistic+WS echo path rather than an agent/runtime failure. The comment in `useChatSocket.ts:150-155` says the origin's `createMessage` already used the same id, but `useChatSend.ts:222` currently proves the opposite. RECOMMENDED FIX SHAPE: In `canvas/src/components/tabs/chat/hooks/useChatSend.ts`, make the outbound A2A `message.messageId` reuse the optimistic `userMsg.id` instead of generating a separate UUID, or add an explicit-id variant of `createMessage` and thread that single id through both optimistic append and POST payload. Keep `appendMessageDedupedById` unchanged; add a unit/E2E regression that origin-device `USER_MESSAGE` echo for the same message id does not create a second user bubble.
Member

Verified fixed on main by core#2697 (commit 247eb906): createMessage now accepts an explicit id, and useChatSend threads the same id through both the optimistic bubble and the A2A message.messageId. Latest main E2E Chat run 357543 (head 424f725e) completed successfully.

Duplicate PR #2716 closed.

Verified fixed on main by core#2697 (commit 247eb906): `createMessage` now accepts an explicit id, and `useChatSend` threads the same id through both the optimistic bubble and the A2A `message.messageId`. Latest `main` E2E Chat run 357543 (head 424f725e) completed successfully. Duplicate PR #2716 closed.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2713