From acc1f887c286cb56168028e13f55634a0d9f138b Mon Sep 17 00:00:00 2001 From: webdevtodayjason Date: Fri, 24 Jul 2026 17:29:49 -0500 Subject: [PATCH] fix(acp): anchor DM thread replies to the thread root, not the latest message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 #2748. Signed-off-by: webdevtodayjason --- crates/buzz-acp/src/queue.rs | 112 ++++++++++++++++++++++++++++++++--- 1 file changed, 104 insertions(+), 8 deletions(-) diff --git a/crates/buzz-acp/src/queue.rs b/crates/buzz-acp/src/queue.rs index 029bf86dbf..a8af77088f 100644 --- a/crates/buzz-acp/src/queue.rs +++ b/crates/buzz-acp/src/queue.rs @@ -1463,13 +1463,16 @@ pub fn format_prompt(batch: &FlushBatch, args: &FormatPromptArgs<'_>) -> Vec