Work is considered performed where you were physically when the work was done. This work requires a work visa (or citizenship), whether for Canada or for said tropical paradise, otherwise you're subject to deportation. Lying about the purpose of your trip to gain unlawful entry is a whole other matter. Compensation you were provided for the work you did is then taxed by the relevant authorities where you were physically when performing the work. This is why US companies are very careful to tell employees never to work when on vacation because if you did they'd have a lot of paperwork to fill in.
If you're suggesting you can be a total non-resident of both countries by alternating between the two or splitting your time, luckily the tax authorities have thought of this too, I suggest you look up the definition of a Deemed Resident. Effectively, you are deemed a resident of the country to which you have the strongest connection. Or, you can be dual-status resident where you're a part year resident of one country and a part-year resident of another. Worst case they'll both deem you a resident and full on double-tax you if there's no treaty - but make no mistake you will pay taxes. Check out "What are residential ties?" [1] in the CRA handbook.
Now, I'd love to be wrong of course.
What I do know is that even if you're on vacation in the US, let's say on a B-2, it's a grey area to even contribute to open source projects. The US doesn't require that what you're doing be paid to be considered 'work'.
[1] https://www.canada.ca/en/revenue-agency/services/forms-publi...
scoffs
Can you provide some kind of source? I've worked for small companies and huge companies and I've never heard that.
You do have to be careful, in the US it's not permitted to do anything other than business meetings on a B1. The UK is similar. If you do any engineering work at all you're in violation of your entry status. This is just the rules. If you do productive work and are renumerated for it by a foreign employer taxes may well be due. It doesn't often come up as you're not supposed to be doing it per visa rules.
> Examples of activities for which a person would not normally be remunerated or which would not compete directly with Canadian citizens or permanent residents in the Canadian labour market and which would normally be part-time or incidental to the reason that the person is in Canada include, but are not limited to:
> long distance (by telephone or Internet) work done by a temporary resident whose employer is outside Canada and who is remunerated from outside Canada
From your excerpt it would be okay to work remotely so long it doesn't compete in the labor market AND it's incidental to the reason you're in Canada - invalidating my point about US employers telling people not to work in Canada while on vacation (though other countries it definitely varies). However, I'd posit that spending 6 months in Canada working remotely is anything but incidental to the reason that person is in Canada.