I have flown to MGA dozens of times on Copa ex-YYZ and have never seen a 23 hour connection. There's only one flight a day to Toronto but surely there are better flights the same day from MGA even if it's via the triangle (e.g. via SJO or GUA hardly an issue).
Unless it is on purpose then I am sure Copa will treat it as a stopover and you'd collect the bags in Panama.