This article provides information on how to automatically restore the primary partition from the backup partition on a SRX device.
With the Junos event policy, when SRX boots from the backup partition, it will copy the OS from the backup partition to the primary partition:
set event-options policy boot-chk events system set event-options policy boot-chk attributes-match system.message matches "Host 0 Boot from backup root" set event-options policy boot-chk then execute-commands commands "request system snapshot slice alternate"