fix(threading): honor replyToMode=off for compaction notices

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.
This commit is contained in:
zidongdesign 2026-03-08 21:06:35 +08:00 committed by Josh Lehman
parent e2dc9b1682
commit 0b236892ac
No known key found for this signature in database
GPG Key ID: D141B425AC7F876B

View File

@ -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 };