fix: thread accountId through subagent announce delivery

Co-authored-by: Adam Holt <adam91holt@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-17 02:45:07 +00:00
parent dbf8829283
commit 0291105913
9 changed files with 209 additions and 22 deletions

View File

@@ -19,6 +19,7 @@ import {
isInternalMessageChannel,
resolveGatewayMessageChannel,
} from "../../utils/message-channel.js";
import { normalizeAccountId } from "../../utils/account-id.js";
import type { AgentCommandOpts } from "./types.js";
type RunResult = Awaited<
@@ -49,11 +50,8 @@ export async function deliverAgentCommandResult(params: {
const targetMode: ChannelOutboundTargetMode =
opts.deliveryTargetMode ?? (opts.to ? "explicit" : "implicit");
const resolvedAccountId =
typeof opts.accountId === "string" && opts.accountId.trim()
? opts.accountId.trim()
: targetMode === "implicit"
? sessionEntry?.lastAccountId
: undefined;
normalizeAccountId(opts.accountId) ??
(targetMode === "implicit" ? normalizeAccountId(sessionEntry?.lastAccountId) : undefined);
const resolvedTarget =
deliver && isDeliveryChannelKnown && deliveryChannel
? resolveOutboundTarget({