create(); $run = AutomationRun::factory()->for($automation)->create([ 'status' => Status::Failed, 'error' => ['message' => 'previous failure'], 'finished_at' => now(), 'current_node_id' => 'g', ]); app(RetryRunFromNode::class)($run, 'g'); $fresh = $run->fresh(); expect($fresh->status)->toBe(Status::Pending); expect($fresh->error)->toBeNull(); expect($fresh->finished_at)->toBeNull(); Queue::assertPushed(ProcessAutomationNode::class); }); it('rejects retry for runs that are not failed', function () { $automation = Automation::factory()->create(); $run = AutomationRun::factory()->for($automation)->create(['status' => Status::Completed]); expect(fn () => app(RetryRunFromNode::class)($run, 'g')) ->toThrow(DomainException::class); });