Skip to content

Commit 13613ec

Browse files
committed
fix(telegram): align account inspection default routing
1 parent 85771ae commit 13613ec

3 files changed

Lines changed: 41 additions & 1 deletion

File tree

‎extensions/telegram/src/account-inspect.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,27 @@ describe("inspectTelegramAccount SecretRef resolution", () => {
107107
expect(account.config.reactionLevel).toBe("ack");
108108
});
109109

110+
it("routes omitted-account inspection through the configured defaultAccount (#61012)", () => {
111+
withEnv({ TELEGRAM_BOT_TOKEN: "123:env" }, () => {
112+
const cfg: OpenClawConfig = {
113+
channels: {
114+
telegram: {
115+
botToken: "123:channel",
116+
defaultAccount: "ops",
117+
accounts: {
118+
ops: { botToken: "123:ops" },
119+
},
120+
},
121+
},
122+
};
123+
124+
const account = inspectTelegramAccount({ cfg });
125+
expect(account.accountId).toBe("ops");
126+
expect(account.tokenSource).toBe("config");
127+
expect(account.token).toBe("123:ops");
128+
});
129+
});
130+
110131
it("blocks channel-token fallback for unknown scoped accounts in multi-account config", () => {
111132
const cfg: OpenClawConfig = {
112133
channels: {

‎extensions/telegram/src/account-inspect.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ export function inspectTelegramAccount(params: {
252252
accountId?: string | null;
253253
envToken?: string | null;
254254
}): InspectedTelegramAccount {
255+
const resolvedAccountId = params.accountId ?? resolveDefaultTelegramAccountId(params.cfg);
255256
return resolveAccountWithDefaultFallback({
256-
accountId: params.accountId,
257+
accountId: resolvedAccountId,
257258
normalizeAccountId,
258259
resolvePrimary: (accountId) =>
259260
inspectTelegramAccountPrimary({

‎extensions/telegram/src/reaction-level.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,24 @@ describe("resolveTelegramReactionLevel", () => {
122122
expectExtensiveFlags(result);
123123
});
124124

125+
it("resolves omitted-account reaction level from the configured defaultAccount (#61012)", () => {
126+
const cfg: OpenClawConfig = {
127+
channels: {
128+
telegram: {
129+
botToken: "tok-default",
130+
reactionLevel: "off",
131+
defaultAccount: "work",
132+
accounts: {
133+
work: { botToken: "tok-work", reactionLevel: "extensive" },
134+
},
135+
},
136+
},
137+
};
138+
139+
const result = resolveTelegramReactionLevel({ cfg });
140+
expectExtensiveFlags(result);
141+
});
142+
125143
it("falls back to global level when account has no reactionLevel", () => {
126144
const cfg: OpenClawConfig = {
127145
channels: {

0 commit comments

Comments
 (0)