This morning I bought an intraday buy trade for BANKNIFTY 20 OCT 39800 CALL and I also setup OCO forever order for the trade. When the stoploss was hit, the OCO order tried to take a fresh sell position instead of squaring off the existing trade.
NOTE: I had no pending orders for this trade at that time.
I think this is a bug and needs to be fixed. I was fortunate enough that the fresh sell order did not go through due to insufficient funds and I had to manually exit the trade with additional loss than intended.