@@ -69,9 +69,25 @@ describe("slack exec approvals", () => {
6969
7070 expect ( getSlackExecApprovalApprovers ( { cfg } ) ) . toEqual ( [ "U456" ] ) ;
7171 expect ( isSlackExecApprovalApprover ( { cfg, senderId : "U456" } ) ) . toBe ( true ) ;
72+ expect ( isSlackExecApprovalApprover ( { cfg, senderId : "u456" } ) ) . toBe ( true ) ;
7273 expect ( isSlackExecApprovalApprover ( { cfg, senderId : "U123" } ) ) . toBe ( false ) ;
7374 } ) ;
7475
76+ it ( "canonicalizes configured exec approver ids before matching uppercase senders" , ( ) => {
77+ const explicitCfg = buildConfig ( { approvers : [ "u456" ] } ) ;
78+ expect ( getSlackExecApprovalApprovers ( { cfg : explicitCfg } ) ) . toEqual ( [ "U456" ] ) ;
79+ expect ( isSlackExecApprovalApprover ( { cfg : explicitCfg , senderId : "U456" } ) ) . toBe ( true ) ;
80+
81+ const ownerFallbackCfg = {
82+ ...buildConfig ( { enabled : true } ) ,
83+ commands : { ownerAllowFrom : [ "slack:u123owner" ] } ,
84+ } as OpenClawConfig ;
85+ expect ( getSlackExecApprovalApprovers ( { cfg : ownerFallbackCfg } ) ) . toEqual ( [ "U123OWNER" ] ) ;
86+ expect ( isSlackExecApprovalApprover ( { cfg : ownerFallbackCfg , senderId : "U123OWNER" } ) ) . toBe (
87+ true ,
88+ ) ;
89+ } ) ;
90+
7591 it ( "does not infer approvers from allowFrom or DM default routes" , ( ) => {
7692 const cfg = buildConfig (
7793 { enabled : true } ,
@@ -115,16 +131,18 @@ describe("slack exec approvals", () => {
115131 enabled : true ,
116132 mode : "targets" ,
117133 targets : [
118- { channel : "slack" , to : "user:U123TARGET " } ,
134+ { channel : "slack" , to : "user:u123target " } ,
119135 { channel : "slack" , to : "channel:C123" } ,
120136 ] ,
121137 } ,
122138 } ,
123139 } as OpenClawConfig ;
124140
125141 expect ( isSlackExecApprovalTargetRecipient ( { cfg, senderId : "U123TARGET" } ) ) . toBe ( true ) ;
142+ expect ( isSlackExecApprovalTargetRecipient ( { cfg, senderId : "u123target" } ) ) . toBe ( true ) ;
126143 expect ( isSlackExecApprovalTargetRecipient ( { cfg, senderId : "U999OTHER" } ) ) . toBe ( false ) ;
127144 expect ( isSlackExecApprovalAuthorizedSender ( { cfg, senderId : "U123TARGET" } ) ) . toBe ( true ) ;
145+ expect ( isSlackExecApprovalAuthorizedSender ( { cfg, senderId : "u123target" } ) ) . toBe ( true ) ;
128146 } ) ;
129147
130148 it ( "keeps the local Slack approval prompt path active" , ( ) => {
@@ -154,7 +172,15 @@ describe("slack exec approvals", () => {
154172
155173 it ( "normalizes wrapped sender ids" , ( ) => {
156174 expect ( normalizeSlackApproverId ( "user:U123OWNER" ) ) . toBe ( "U123OWNER" ) ;
175+ expect ( normalizeSlackApproverId ( "user:u123owner" ) ) . toBe ( "U123OWNER" ) ;
176+ expect ( normalizeSlackApproverId ( "slack:u123owner" ) ) . toBe ( "U123OWNER" ) ;
157177 expect ( normalizeSlackApproverId ( "<@U123OWNER>" ) ) . toBe ( "U123OWNER" ) ;
178+ expect ( normalizeSlackApproverId ( "<@u123owner>" ) ) . toBe ( "U123OWNER" ) ;
179+ expect ( normalizeSlackApproverId ( "u123owner" ) ) . toBe ( "U123OWNER" ) ;
180+ expect ( normalizeSlackApproverId ( "C123CHANNEL" ) ) . toBeUndefined ( ) ;
181+ expect ( normalizeSlackApproverId ( "slack:C123CHANNEL" ) ) . toBeUndefined ( ) ;
182+ expect ( normalizeSlackApproverId ( "user:C123CHANNEL" ) ) . toBeUndefined ( ) ;
183+ expect ( normalizeSlackApproverId ( "<@C123CHANNEL>" ) ) . toBeUndefined ( ) ;
158184 } ) ;
159185
160186 it ( "applies agent and session filters to request handling" , ( ) => {
0 commit comments