fix: merge accountId when preferring live delivery context for restart sentinel
When liveContext (gateway-tool.ts) or paramsDeliveryContext (config.ts) is present but lacks an accountId, fall back to the accountId from the extracted session store rather than dropping it entirely. This prevents restart follow-up notices from being misrouted on multi-account channels when callers supply channel/to without an explicit accountId. Addresses CR comments on PR #34580.
This commit is contained in:
parent
645def7535
commit
fd1dd6fa80
@ -157,7 +157,13 @@ export function createGatewayTool(opts?: {
|
||||
}
|
||||
: undefined;
|
||||
const extracted = extractDeliveryInfo(sessionKey);
|
||||
const deliveryContext = liveContext ?? extracted.deliveryContext;
|
||||
const deliveryContext =
|
||||
liveContext != null
|
||||
? {
|
||||
...liveContext,
|
||||
accountId: liveContext.accountId ?? extracted.deliveryContext?.accountId,
|
||||
}
|
||||
: extracted.deliveryContext;
|
||||
// Guard threadId with the same session check as deliveryContext. When
|
||||
// targeting another session, opts.agentThreadId belongs to the current
|
||||
// session's thread and must not be written into the sentinel — it would
|
||||
|
||||
@ -205,7 +205,13 @@ function resolveConfigRestartRequest(params: unknown): {
|
||||
const { deliveryContext: extractedDeliveryContext, threadId: extractedThreadId } =
|
||||
extractDeliveryInfo(sessionKey);
|
||||
const paramsDeliveryContext = parseDeliveryContextFromParams(params);
|
||||
const deliveryContext = paramsDeliveryContext ?? extractedDeliveryContext;
|
||||
const deliveryContext =
|
||||
paramsDeliveryContext != null
|
||||
? {
|
||||
...paramsDeliveryContext,
|
||||
accountId: paramsDeliveryContext.accountId ?? extractedDeliveryContext?.accountId,
|
||||
}
|
||||
: extractedDeliveryContext;
|
||||
const threadId = paramsDeliveryContext?.threadId ?? extractedThreadId;
|
||||
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user