OP is right about the gene turning on, but it still seems a bit under-explained.
"the researchers first added a gene to the organism from a related bacterium that can better tolerate oxygen, enabling it to live longer near the outside of a targeted tumour."
"They then found a way to activate the oxygen-resistant gene at just the right time โ critical to preventing bacteria from inadvertently growing in oxygen-rich places such as the bloodstream"
https://uwaterloo.ca/news/media/beating-cancer-eating-cancer
I can see why they the gene isn't necessary, at first - the center of the tumor doesn't contain oxygen.
And I can see why they the gene becomes necessary, the edges of the tumor do contain oxygen.
So that switch does keeps the bacteria from wandering where they shouldn't, at least at first.
Not clear to me what stops the bacteria from going for a wander once there are lots of them, but at least they'll destroy the tumor before that that happens. I guess.
Perhaps the article has it flipped, except that doesn't make sense either - it would allow the bacteria to go places they shouldn't as long as there aren't too many of them.
@pvanheus @a_cubed @FluentInFinance