Automation trigger "for" option template error

Very good. You can change the condition to this:

  - condition: template
    value_template: >
      {{ states('input_number.pantry_autooff_delay')|int(0) != 0  }}

The inequality test will return true or false for you.

Though valid, you’re still using device actions. This would be better:

action:
  - service: light.turn_off
    target:
      entity_id: light.pantry_light_ha102_light