You can file non-resident for as long as you want because of the tax treaty, the only difference is that you have to have the FICA
taxes withheld from your pay.
How it works is if you file Form 8843 for five years running (which could mean four years and one day) as F-1 then you have to then start having FICA
taxes withheld after that and you have to tell your employer by filing a new W-4 with them.
If you're on P-2 then you can't use Form 8843.
I have to say I find this to usually be an academic discussion as few people who file 8843 seem to be aware of the fact they're exempt from FICA withholding and their employers are never aware. The instructions for employers on this subject are incredibly obscure, they're hidden away somewhere in IRS publication 515.
Essentially what you're supposed to do is put down: "non-resident alien student" in the answer to question 6 on W-4 and your employer is supposed to divine from that not to perform FICA withholding. If they do, you can file Form 843 to recover it.
Most students don't realize this until years later in my experience.
However you can still file as non-resident after that, you just don't file Form 8843 anymore with your 1040NR. You may be required to formally claim the tax treaty provisions on Form 8833, you need to ask the IRS but usually if your income is fairly low they waive that requirement.
As a Canadian you're not subject to non-resident alien withholding so whomever issued the 1042-S made a mistake. To recover it you need to report it on your 1040NR and get a refund from the IRS.
Make sure with banks etc. ("income not effectively connected with a US trade or business") that you've filed a W-8BEN with them and declared your Canadian status to them.
The people issuing you the 1099s also made a mistake, they should be 1042-S instead (usually, there are exceptions) but generally it doesn't matter because as a Canadian you're not subject to withholding, it's just a paperwork error.
If you're filing as a US non-resident, that means you're a Canadian resident, so you have to file T1 etc. in Canada. You use your W-2s, 1099s etc. to do this, you claim a foreign tax credit using T2209 and T2036 as described in the general guide. Which will usually mean you owe tax as the Canadian rates are higher (usually, if you're in a low bracket in Alberta you may not owe much).
Your slight wrinkle is that you're waiting on a
tax refund for the 1042-S so you can either wait or figure out what the refund will be and reduce your foreign tax credit claim by that much. I.e. do 1040NR first and figure out your refund.
Steve.