Hi Michalycz,
We found a repeatable construction-robot recall loop in Service Train 1.0.1 on Factorio 2.1.24 (with Space Exploration and Krastorio 2). We traced it to the hatch readiness check and tested a small fix on an isolated copy of the affected save.
Symptoms and reproduction conditions
- A charged service locomotive, 50 active construction robots, sufficient refined concrete, and a large group of tile ghosts within construction range.
- Start a Build and repair order. Our affected train also had parked local work enabled.
- Robots launch, travel a few tiles, are recalled, and repeat this about every second without making construction progress. Spare robots in the reserve bay do not prevent the loop.
- This looks like a power problem, but the train was essentially fully charged (500 MJ including its roboport buffer), and sampled returning robots still had approximately 0.93-1.46 MJ.
Cause
In scripts/hatch.lua, work(state) only counts construction robots remaining in the hidden worker's inventory. Once all available robots are outside, if not robots then return false end clears state.hatch_work_ready at the next 60-tick probe. H.tick() then sets worker.allow_dispatching_robots to false, cancelling the robots' jobs and recalling them. Their return makes the check pass again, so the cycle repeats.
The availability of idle robots/materials should not revoke permission while already-dispatched robots are still doing the work. A small test with fewer ghosts than robots can miss this because an idle robot remains inside.
Minimal tested change
Insert this immediately before if not robots then return false end in work(state). It uses the existing own_network() helper:
-- Keep the roboport enabled while dispatched construction robots finish their work.
-- The main inventory can have no idle robots/materials while they are in flight.
local active_network=own_network(worker)
if active_network and #active_network.construction_robots>0 then
local active_job=state.job_id and storage.rst and storage.rst.jobs[state.job_id]
if not active_job or active_job.status=='working' then return true end
end
The existing hatch_requested gate still controls whether work is wanted; this does not unconditionally enable the roboport after a cancellation or a low-energy stop.
Validation
- Unmodified 1.0.1: 0 additional tiles built during 600 simulated ticks; dispatch permission alternated on/off at the one-second probe.
- Same save, with only this gameplay change plus read-only observation: 166 additional tiles built during 1,800 simulated ticks, with the recall loop gone.
- Unmodified official 0.1.3 also builds normally in the same save. Its older code does not use this hatch gate.
This candidate fix was tested for the affected construction case; delivery, cancellation and multiplayer edge cases have not all been acceptance-tested. Sharing the diagnosis and working change so players can stay on official releases rather than distributing a private fork.