Automation stuck on "still running"

I have what I think is a simple automation for turning on the light in a room after sunset when motion is detected. I wrote the automation several years ago, but within the last few weeks it has started getting “stuck” and no longer triggering unless I completely restart HA. I don’t see any relevant information in the logs as to what the problem is, and the automation trace only shows that it is “still running” when checking conditions. After an HA restart, the automation will usually run fine for several days until it becomes stuck again. I also cannot turn the automation off or on while it is stuck. Any help diagnosing would be appreciated.

Automation YAML:

id: '1699892236863'
alias: Living Room Auto Lights Debug
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.foyer_motion
    to: 'on'
    from: 'off'
condition:
  - condition: or
    conditions:
      - condition: sun
        before: sunrise
      - condition: sun
        after: sunset
        before_offset: '00:30:00'
      - condition: numeric_state
        entity_id: sensor.foyer_4_1_illuminance
        below: '10'
action:
  - service: light.turn_on
    target:
      entity_id: light.living_room
    data:
      brightness_pct: 95
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - if:
      - condition: or
        conditions:
          - condition: state
            entity_id: binary_sensor.living_room_motion_alarm
            state: 'on'
    then:
      - service: automation.trigger
        data:
          skip_condition: true
        target:
          entity_id:
            - automation.living_room_auto_lights
    else:
      - service: light.turn_off
        data: {}
        target:
          entity_id:
            - light.living_room
mode: restart

And a screenshot from the automation trace:

It seems to me that 2023.12 had broke the sunrise start. I have tod (time of day) integration and Night never ends, because sun had not been rising