fix: preserve subagent thread routing (#1241)

Thanks @gnarco.

Co-authored-by: gnarco <gnarco@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-20 17:22:07 +00:00
parent ae1c6f4313
commit 02ca148583
32 changed files with 195 additions and 32 deletions

View File

@@ -100,6 +100,11 @@ export async function routeReply(params: RouteReplyParams): Promise<RouteReplyRe
return { ok: false, error: "Reply routing aborted" };
}
const resolvedReplyToId =
replyToId ??
(channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : undefined);
const resolvedThreadId = channelId === "slack" ? null : (threadId ?? null);
try {
// Provider docking: this is an execution boundary (we're about to send).
// Keep the module cheap to import by loading outbound plumbing lazily.
@@ -110,8 +115,8 @@ export async function routeReply(params: RouteReplyParams): Promise<RouteReplyRe
to,
accountId: accountId ?? undefined,
payloads: [normalized],
replyToId: replyToId ?? null,
threadId: threadId ?? null,
replyToId: resolvedReplyToId ?? null,
threadId: resolvedThreadId,
abortSignal,
mirror: params.sessionKey
? {