diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index f06bec45c..cb7995082 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -57,7 +57,7 @@ class Kernel extends ConsoleKernel // V5 host JWT rotation: re-mints and SSH-pushes a fresh host token // before the on-disk token expires so coold reconnects stay authorized. - $this->scheduleInstance->job(new V5RotateAgentTokensJob)->hourly()->withoutOverlapping()->onOneServer(); + $this->scheduleInstance->job(new V5RotateAgentTokensJob)->everyFifteenMinutes()->withoutOverlapping()->onOneServer(); if (isDev()) { // Instance Jobs diff --git a/tests/Feature/ScheduleOnOneServerTest.php b/tests/Feature/ScheduleOnOneServerTest.php index 167d16bfa..3d31b9139 100644 --- a/tests/Feature/ScheduleOnOneServerTest.php +++ b/tests/Feature/ScheduleOnOneServerTest.php @@ -48,3 +48,15 @@ it('schedules every production job with onOneServer', function () { ); }); }); + +it('runs v5 agent token rotation often enough for the default ttl and refresh threshold', function () { + $schedule = app(Schedule::class); + + $event = collect($schedule->events())->first( + fn ($e) => str_contains((string) $e->description, 'V5RotateAgentTokensJob') + ); + + expect($event)->not->toBeNull(); + expect($event->expression)->toBe('*/15 * * * *'); + expect($event->onOneServer)->toBeTrue(); +});