fix: preserve Telegram approval agent fallback

This commit is contained in:
Gustavo Madeira Santana
2026-04-01 10:20:59 -04:00
parent 5846a261ee
commit 8d1ae4f845
3 changed files with 29 additions and 0 deletions

View File

@@ -86,6 +86,10 @@ Docs: https://docs.openclaw.ai
- Discord/gateway: hand reconnect ownership back to Carbon, keep runtime status aligned with close/reconnect state, and force-stop sockets that open without reaching READY so Discord monitors recover promptly instead of waiting on stale health timeouts. (#59019) Thanks @obviyus
- Config/Telegram: migrate removed `channels.telegram.groupMentionsOnly` into `channels.telegram.groups["*"].requireMention` on load so legacy configs no longer crash at startup. (#55336) thanks @jameslcowan.
### Fixes
- Telegram/exec approvals: preserve `agentFilter` matching when the agent is only encoded in `sessionKey`, so Telegram approval requests keep reaching configured approvers after the shared approval-capability refactor. (#58634) thanks @gumadeiras
## 2026.3.31
### Breaking

View File

@@ -7,6 +7,7 @@ import {
isTelegramExecApprovalClientEnabled,
isTelegramExecApprovalTargetRecipient,
resolveTelegramExecApprovalTarget,
shouldHandleTelegramExecApprovalRequest,
shouldEnableTelegramExecApprovalButtons,
shouldInjectTelegramExecApprovalButtons,
} from "./exec-approvals.js";
@@ -73,6 +74,29 @@ describe("telegram exec approvals", () => {
).toBe("dm");
});
it("matches agent filters from the Telegram session key when request.agentId is absent", () => {
const cfg = buildConfig({
enabled: true,
approvers: ["123"],
agentFilter: ["ops"],
});
expect(
shouldHandleTelegramExecApprovalRequest({
cfg,
request: {
id: "req-1",
request: {
command: "echo hi",
sessionKey: "agent:ops:telegram:direct:123:tail",
},
createdAtMs: 0,
expiresAtMs: 1000,
},
}),
).toBe(true);
});
it("only injects approval buttons on eligible telegram targets", () => {
const dmCfg = buildConfig({ enabled: true, approvers: ["123"], target: "dm" });
const channelCfg = buildConfig({ enabled: true, approvers: ["123"], target: "channel" });

View File

@@ -80,6 +80,7 @@ const telegramExecApprovalProfile = createChannelExecApprovalProfile({
normalizeAccountId(boundAccountId) === normalizeAccountId(accountId)
);
},
fallbackAgentIdFromSessionKey: true,
requireClientEnabledForLocalPromptSuppression: false,
});