Repository navigation
Closed
Labels
robot-armyDispatch this issue to robot-army
Description
Report
On 2026-10-08, staff posted a safety notice to members:
once an Oops is cleared, any machine that wasn't properly shut down will turn back on by itself. We've had a couple of close calls because of this.
Members are now told to turn the machine OFF before pressing Oops. That is a workaround, and it only helps if people follow it. The intended behavior is that clearing an Oops never energizes a machine. A machine should only power up when an authorized RFID login happens after the clear. If the relay closes on clear without an RFID card present, that is a bug.
What the server code does (origin/main, b7c4c3e)
Reading src/dm_mac/models/machine.py:
MachineState.oops()setsrelay_desired_state = Falseandcurrent_user = None. It does not clearrfid_value.MachineState.unoops()setsrelay_desired_state = Falseunlessmachine.always_enabled. No machine in the currentmachines.jsonsetsalways_enabled.update()after an unoops with the same card still inserted:rfid_valueis unchanged, so the code takes the "no RFID change" branch. The relay stays off and no login happens._handle_reboot()sets the relay off when the machine isn'talways_enabled.
So I can't find a server-side path that turns the relay on at unoops time without a fresh RFID insert. Likely explanations, in rough order:
- No no-volt-release switch (most likely). MAC cuts power with the relay, but the machine's own switch stays in the ON position. At the next authorized RFID login after the clear, the relay closes and the machine starts immediately. To the person badging in, it "turned on by itself". This is a hardware and safety-design gap rather than a code bug. The fix is NVR or magnetic switches on the affected machines, or interlocks that sense the machine switch, or both.
- Firmware-side relay handling. For example, the MCU acts on a stale
relay_desired_stateafter reconnecting, or the MCU resumes relay state locally after a power blip. I haven't verified this against the firmware. - A server path I missed. Possible candidates: oops override sessions (
oops_overrideusers) and logout withwas_override, cache reload on server restart (save_cache/ load), and the unoops/clear triggered from the Slack bot orDELETE /api/machine/oops/<name>while a card is inserted.
To investigate
- Find out from staff which machines had the close calls, roughly when, and whether a card was in the reader when the machine started.
- Correlate with the MAC logs (
OOPSandAUTHloggers). Look forun-Oopsedfollowed by a relay-on with noRFID loginbetween them. Note that older logs may have aged out of Loki. - Review the firmware relay logic on boot, on reconnect and on the oops button.
- Add a regression test: Oops with the card present, then unoops, then update with the same card. Assert that
relay_desired_statestays False. Do the same across a simulated server restart (cache reload) and an MCU reboot. - If the cause is (1): list which machines lack NVR switches, and decide on a hardware fix or a documented procedure.
Related, minor
_handle_reboot()overwrites the Oops display. On a reboot of an oopsed machine it setsdisplay_textand the LED back to the default, even thoughis_oopsedis still True. The relay stays off, so nothing energizes, but the reader stops showing the Oops message. Observed on Resaw on 2026-11-18 after two reboots while oopsed.
Metadata
Metadata
Assignees
Labels
robot-armyDispatch this issue to robot-army
Activity
jantman commentedon Nov 21, 2026
🤖 robot-army dispatched a session for this issue.
phoenix.jasonantman.comra-machine-access-control-2012d44c40b-3ced-4d89-bf14-58e08c989a14robot-army/issue-201-machines-reportedly-power-back-on-after/home/jantman/worktrees/machine-access-control/issue-201Merge pull request #206 from DecaturMakers/robot-army/issue-201-machi…
jantman commentedon Nov 21, 2026
I'm going to call this closed for now via #206 ; if it happens again, I'll need specific times of occurrence in order to investigate in the logs.