You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "yyqdbngt (via GitHub)" <gi...@apache.org> on 2026/09/01 14:44:59 UTC

[PR] fix(ai): keep chat message ids unique across same-millisecond sends [rocketmq-dashboard]

yyqdbngt opened a new pull request, #2884:
URL: https://github.com/apache/rocketmq-dashboard/pull/2884

   ## Summary
   - Add a `newMessageId()` helper (exported for testing) that builds message ids from a `crypto.randomUUID()`-based unique suffix, refactored out of the existing `newConversationId()` pattern
   - Use it for chat user/AI message ids instead of `user-${Date.now()}` / `ai-${Date.now()}`
   - Add a regression test: stop a first response, immediately send a second one with the clock frozen on the same millisecond, and verify the second stream's chunks do not leak into the stopped first response
   
   ## Why
   Chat message ids were derived from `Date.now()`, so two sends landing in the same millisecond produced identical `ai-…` response ids. The stream chunk handler and the `finally`-block `pending` update both locate messages by that id with `prev.map(...)`, so an in-flight second response appended its chunks to the first (already stopped) response as well — the stopped message visibly grew with the new answer's text, and the early `pending: false` write from the first request's `finally` could also clear the second response's "thinking" spinner prematurely.
   
   ## Testing
   - `./node_modules/.bin/vitest run src/pages/ai/__tests__/` → 15 passed (1 new; verified the new test fails with the pre-fix `Date.now()`-based ids)
   - `./node_modules/.bin/tsc --noEmit` → clean
   - `./node_modules/.bin/eslint src/pages/ai/index.tsx src/pages/ai/__tests__/AiPage.test.tsx` → 0 errors
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(ai): keep chat message ids unique across same-millisecond sends [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #2884: fix(ai): keep chat message ids unique across same-millisecond sends
URL: https://github.com/apache/rocketmq-dashboard/pull/2884


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(ai): keep chat message ids unique across same-millisecond sends [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #2884:
URL: https://github.com/apache/rocketmq-dashboard/pull/2884#issuecomment-5593762335

   This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org