Fix Discord session routing continuity (enable lastRoute for groups)\n\nPreviously, 'updateLastRoute' was only enabled for Direct Messages.\nThis meant that group/channel sessions did not update their routing\nmetadata (last channel/to/accountId) in 'session-meta.json'.\n\nIf the bot restarted or a proactive cron job tried to send a message\nto a group session using 'sessions_send' without an explicit 'to' field,\nit would fail because 'lastRoute' was missing or stale.\n\nFix: Enable 'updateLastRoute' for all Discord messages (Group + DM),\nensuring the session store always has the latest valid routing target.
This commit is contained in:
@@ -557,14 +557,12 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
||||
storePath,
|
||||
sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
|
||||
ctx: ctxPayload,
|
||||
updateLastRoute: isDirectMessage
|
||||
? {
|
||||
sessionKey: route.mainSessionKey,
|
||||
channel: "discord",
|
||||
to: `user:${author.id}`,
|
||||
accountId: route.accountId,
|
||||
}
|
||||
: undefined,
|
||||
updateLastRoute: {
|
||||
sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
|
||||
channel: "discord",
|
||||
to: effectiveTo,
|
||||
accountId: route.accountId,
|
||||
},
|
||||
onRecordError: (err) => {
|
||||
logVerbose(`discord: failed updating session meta: ${String(err)}`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user