Repository navigation
fix(core): merge messages correctly in message_delay debounce - #1061
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Two defects kept the debounce queue from merging messages:
1. cooldown_time ran before message_delay, so a second message sent
inside the cooldown window was STOPped with a cooldown notice
instead of joining the collecting turn. cooldown_time is now
declared .after('message_delay') so it gates the merged turn,
and its lastChatTime is scoped per session.channelId rather
than one global timestamp shared across all users/channels.
2. In guild conversations, tailTurn.userName === userName meant a
message from a different member could never join the collecting
turn — multi-member debounce silently degraded to serial turns.
The equality check is dropped (turns are already per
conversationId; a DM has exactly one sender anyway), and
mergeMessages now prefixes each message with its sender name
when the batch contains more than one distinct name, so the
model can attribute speakers.
Fixes #1057.
Co-Authored-By: Claude <noreply@anthropic.com>
3cdacda to
8867806
Compare
Fixes #1057.
Defect 1 — cooldown_time intercepts messages mid-collection
cooldown_timewas ordered only.after('allow_reply'), so it ran beforemessage_delay. WithmsgCooldown > 0, a second message inside the window was STOPped with a cooldown notice before it could join the collecting turn — the debounce merged nothing.Fix:
cooldown_timeis now also.after('message_delay'), so it gates the merged turn rather than each raw message. Sincemessage_delay's joined members resolveSTOPat their own chain step, only the merged turn's starter reaches the cooldown check — cooldown now means "between replies" instead of "between keystrokes".Also:
lastChatTimewas a module-global shared by every user and channel — one active channel could throttle unrelated ones. It's now aMapkeyed bysession.channelId.Defect 2 — strict
userNameequality blocks guild mergesThe tail-turn join check required
tailTurn.userName === userName. In guilds, a second message from a different member inside the window could never merge — it spawned a serialwaitingturn instead, defeating the debounce.The check is dropped entirely: turns are already scoped per
conversationId, and a DM conversation has exactly one sender, so the equality was either a no-op or wrong.mergeMessagesnow prepends${msg.name}:to each message's content parts when the batch has more than one distinct sender, so the model can attribute multi-user content. Single-user batches keep the existing newline-join shape.Net: +14 / −9 in 2 files. Verified
yarn fast-build core(exit 0), ESLint clean.