fix(acp): anchor DM thread replies to the thread root, not the latest message#2778
Open
webdevtodayjason wants to merge 1 commit into
Open
fix(acp): anchor DM thread replies to the thread root, not the latest message#2778webdevtodayjason wants to merge 1 commit into
webdevtodayjason wants to merge 1 commit into
Conversation
… message In a 1:1 DM, once a thread existed every agent reply anchored to the human's latest comment (`last_event.event.id`) instead of the thread root, so each exchange nested one level deeper — the user had to expand a sub-thread of a sub-thread to follow a simple back-and-forth. `resolve_reply_anchor` already implements the documented layer-1 rule for group channels (in a thread → anchor to the ROOT). Apply the same rule to DMs by anchoring to `thread_tags.root_event_id`, which is `Some` only inside a thread — so top-level DM exchanges stay flat, preserving existing behaviour. Also corrects `test_reply_instruction_present_for_dm_thread_reply`, which pinned the old anchor-to-latest behaviour, and adds regression coverage for both the in-thread (root-anchored) and top-level (flat) DM cases. Fixes block#2748. Signed-off-by: webdevtodayjason <jason@webdevtoday.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2748.
Problem
In a 1:1 DM with a managed agent, once a thread existed every agent reply anchored to the human's latest comment instead of the thread root — so each exchange nested one level deeper and the user had to click-expand a sub-thread of a sub-thread to follow a simple back-and-forth.
The reply-anchor logic in
queue.rsdocuments the intended rule directly above the code ("in a thread → anchor to the thread ROOT, no depth-2 nesting") and the group-channel path (resolve_reply_anchor) implements it — but the DM branch contradicted it, anchoring tolast_event.event.id(the newest message) rather than the thread root.Fix
One-line root cause: in the
is_dmbranch, anchor tothread_tags.root_event_idwhen inside a thread — matching the documented layer-1 rule and the group-channel behavior. Top-level DM exchanges stay flat (anchor to the triggering event as before).Tests
root_event_id, not the latest event id (new regression test).cargo test -p buzz-acp→ all pass, clippy → 0 warnings.Sibling PR: the DM mention-gate fix (#2747) is up alongside this.
Checklist
cargo test -p buzz-acp+ clippy greenunwrap()in production pathsunsafe