UI action "Open Case" appears unexpectedly



'Open Case' button showing on incorrect case states.


UI action is displaying due to State value.


The condition on the UI action is passing due to the State choice record with a value of 18.

Please note the condition on the UI action: 
(new global.StateFlow().validFlow(current, 'ca2aa5d2c33231005f76b2c712d3aeb3', 'manual')); 

This is checking the state flow: 


The state flow is looking for records with a state value of 6 or 18: 
gs.hasRole("sn_esm_agent") && (current.state == 6 || current.state == 18) 

Since the State choice 'Pending' has a value of 18, the state flow condition is passing which then in turn passes the condition on the UI action.