Skip to content

Machines reportedly power back on after an Oops is cleared (safety) #201

Closed

Description

@jantman

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() sets relay_desired_state = False and current_user = None. It does not clear rfid_value.
  • MachineState.unoops() sets relay_desired_state = False unless machine.always_enabled. No machine in the current machines.json sets always_enabled.
  • update() after an unoops with the same card still inserted: rfid_value is 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't always_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:

  1. 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.
  2. Firmware-side relay handling. For example, the MCU acts on a stale relay_desired_state after reconnecting, or the MCU resumes relay state locally after a power blip. I haven't verified this against the firmware.
  3. A server path I missed. Possible candidates: oops override sessions (oops_override users) and logout with was_override, cache reload on server restart (save_cache / load), and the unoops/clear triggered from the Slack bot or DELETE /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 (OOPS and AUTH loggers). Look for un-Oopsed followed by a relay-on with no RFID login between 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_state stays 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 sets display_text and the LED back to the default, even though is_oopsed is 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.

Activity

  1. added
    robot-army
    on Nov 20, 2026
  2. jantman commented on Nov 21, 2026

    @jantman
    ContributorAuthor

    🤖 robot-army dispatched a session for this issue.

    • Host: phoenix.jasonantman.com
    • Session: ra-machine-access-control-201
    • Session id: 2d44c40b-3ced-4d89-bf14-58e08c989a14
    • Branch: robot-army/issue-201-machines-reportedly-power-back-on-after
    • Worktree: /home/jantman/worktrees/machine-access-control/issue-201
  3. added a commit that references this issue on Nov 21, 2026
  4. jantman commented on Nov 21, 2026

    @jantman
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    robot-army

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions