Issue #22567: Turret Override Program reports turrets as allied when returning even when they're not
One of the easiest places to reproduce this is Dunwich Borers - by fast traveling to The Slog, one can sneak to the terminal that controls the turrets without getting attacked by them.
The first time I use the Turret Override Program in a given location, the alliance shows as blank, or "Turret Control System", etc. depending on location, then it changes to "Allied" when I use the "Override Alliance Parameters" option (I'm not sure I'm correctly rememberign the exact wording of the option).
When the location resets (such as when I get a new quest sending me there), the alliance shows as "Allied" upon playing the tape, but the turrets will still attack me until I use the "Override Alliance Parameters" option again.
Side note: in previous playthroughs I had gotten the impression that turrets would remember being hacked even when the rest of the location had reset. However, I think that was really a glitched incomplete reset of the location, possibly because I had heavily exploited the respawning synths in the "Call to Arms" quest, which could be a variant of the glitches mentioned at https://afkmods.iguanadons.net/index.php?/topic/4462-fo4-unlimited-settlementssettlers-a-caveat-for-mod-users/ - it wouldn't surprise me if the synths were running into that array size limitation mentioned.