Immediately after appearing on the surface the worm lay the path to the base. If path is blocked worm go to the nearest gateway/gas chamber. If by the time the worm approaches, the path is still be blocked, then the worm will self-destruct.
Initially the worm will prefer a free path, even if it is much longer, which makes it possible to manage them.
But if the worm stumbles on the same obstacle more than twice, it self-destruct.
So this won't work.
Quite quickly the time will come, when the number of worms will exceed the number of gas chambers. To avoid the destruction of the colony, it is necessary to build such a structure of pipes and gateways that will be able to delay, redirect worms to free gas chambers.