diff --git a/src/auto-reply/command-auth.owner-default.test.ts b/src/auto-reply/command-auth.owner-default.test.ts index d2f99c1a995..dd6f8e350b0 100644 --- a/src/auto-reply/command-auth.owner-default.test.ts +++ b/src/auto-reply/command-auth.owner-default.test.ts @@ -53,6 +53,30 @@ describe("senderIsOwner only reflects explicit owner authorization", () => { expect(auth.isAuthorizedSender).toBe(true); }); + it("keeps channel-validated native group commands authorized without owner status", () => { + const cfg = { + channels: { telegram: {} }, + } as OpenClawConfig; + + const ctx = { + Provider: "telegram", + Surface: "telegram", + ChatType: "group", + From: "telegram:group:-100123", + SenderId: "200482621", + CommandSource: "native", + } as MsgContext; + + const auth = resolveCommandAuthorization({ + ctx, + cfg, + commandAuthorized: true, + }); + + expect(auth.senderIsOwner).toBe(false); + expect(auth.isAuthorizedSender).toBe(true); + }); + it("senderIsOwner is false when ownerAllowFrom is configured and sender does not match", () => { const cfg = { channels: { discord: {} }, diff --git a/src/auto-reply/command-auth.ts b/src/auto-reply/command-auth.ts index 2611be30436..072c6049beb 100644 --- a/src/auto-reply/command-auth.ts +++ b/src/auto-reply/command-auth.ts @@ -450,7 +450,10 @@ function resolveCommandSenderAuthorization(params: { !params.providerResolutionError && (commandsAllowAll || Boolean(matchedCommandsAllowFrom)) ); } - return params.commandAuthorized && params.isOwnerForCommands; + if (params.commandAuthorized) { + return true; + } + return params.isOwnerForCommands; } function isConversationLikeIdentity(value: string): boolean {