From 0b236892ac922d04443c0e125b88ef242715194b Mon Sep 17 00:00:00 2001 From: zidongdesign Date: Sun, 8 Mar 2026 21:06:35 +0800 Subject: [PATCH] fix(threading): honor replyToMode=off for compaction notices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compaction notices carried replyToCurrent=true, which caused them to pass through the allowExplicitReplyTagsWhenOff path in createReplyToModeFilter("off") and retain replyToId. In replyToMode=off sessions this made the transient status messages appear in-thread while normal assistant replies stayed off-thread, contradicting the off-mode expectation. Add an !isCompactionNotice guard to the explicit-tag fast-path so compaction payloads always fall through to the strip branch and have their replyToId removed — consistent with how every other payload is treated in off mode. --- src/auto-reply/reply/reply-threading.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/auto-reply/reply/reply-threading.ts b/src/auto-reply/reply/reply-threading.ts index 177f4ccbe0b..5c0e1e423bc 100644 --- a/src/auto-reply/reply/reply-threading.ts +++ b/src/auto-reply/reply/reply-threading.ts @@ -33,7 +33,12 @@ export function createReplyToModeFilter( } if (mode === "off") { const isExplicit = Boolean(payload.replyToTag) || Boolean(payload.replyToCurrent); - if (opts.allowExplicitReplyTagsWhenOff && isExplicit) { + // Compaction notices must never be threaded when replyToMode=off — even + // if they carry explicit reply tags (replyToCurrent). Honouring the + // explicit tag here would make status notices appear in-thread while + // normal assistant replies stay off-thread, contradicting the off-mode + // expectation. Strip replyToId unconditionally for compaction payloads. + if (opts.allowExplicitReplyTagsWhenOff && isExplicit && !payload.isCompactionNotice) { return payload; } return { ...payload, replyToId: undefined };