I usually have one dolphin and one kate instance on every activity, and they are not shared. Clicking on a text file will open this in a random (?) kate instance, which may or may not be the one on the same activity. Of course the subjective feeling is that it always picks the wrong one ;) This also happens when I click on a text file on a web page using Konqueror, so this is not Dolphin specific. Reproducible: Sometimes
This problem seems to reappear and disappear randomly after upgrades until this day.
I meanwhile have the feeling that the one used is simply the one that was active last.
I cannot quite confirm that. It's not even consistently the instance started first or last and if two or more instances are running on the same desktop and activity it seems the chosen instance is consistently the same one. Until another instance is started, then sometimes that one will be used and sometimes the previous one... very confusing.
commit cdb3da47ccda1c0600bbeb6c6a73180b9a3b9754 Author: Simone Scalabrino <s.scalabrino9@gmail.com> Date: Sun Aug 12 13:39:58 2018 +0200 Support activities when opening files FEATURE: 395954 Differential Revision: https://phabricator.kde.org/D13826