fix(routing): make bindings dynamic by calling loadConfig() per-message (#11372)

This commit is contained in:
juanpablodlc
2026-02-08 22:34:55 -08:00
committed by GitHub
parent 0cf93b8fa7
commit 8d96955e19
6 changed files with 22 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ import { logInboundDrop } from "../channels/logging.js";
import { resolveMentionGatingWithBypass } from "../channels/mention-gating.js";
import { recordInboundSession } from "../channels/session.js";
import { formatCliCommand } from "../cli/command-format.js";
import { loadConfig } from "../config/config.js";
import { readSessionUpdatedAt, resolveStorePath } from "../config/sessions.js";
import { logVerbose, shouldLogVerbose } from "../globals.js";
import { recordChannelActivity } from "../infra/channel-activity.js";
@@ -163,8 +164,9 @@ export const buildTelegramMessageContext = async ({
const { groupConfig, topicConfig } = resolveTelegramGroupConfig(chatId, resolvedThreadId);
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
const parentPeer = buildTelegramParentPeer({ isGroup, resolvedThreadId, chatId });
// Fresh config for bindings lookup; other routing inputs are payload-derived.
const route = resolveAgentRoute({
cfg,
cfg: loadConfig(),
channel: "telegram",
accountId: account.accountId,
peer: {

View File

@@ -449,8 +449,9 @@ export function createTelegramBot(opts: TelegramBotOptions) {
: undefined;
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
const parentPeer = buildTelegramParentPeer({ isGroup, resolvedThreadId, chatId });
// Fresh config for bindings lookup; other routing inputs are payload-derived.
const route = resolveAgentRoute({
cfg,
cfg: loadConfig(),
channel: "telegram",
accountId: account.accountId,
peer: { kind: isGroup ? "group" : "direct", id: peerId },