The AI-agent guard silently does nothing — destructive commands still run

When

After wiring laravel/pao's AgentDetector into DB::prohibitDestructiveCommands() via a dedicated service provider, when that provider is registered before AppServiceProvider in bootstrap/providers.php.

Why it happens

The React/Vue/Livewire starter kits ship an AppServiceProvider that already calls DB::prohibitDestructiveCommands(app()->isProduction()). Providers boot in registration order and prohibitDestructiveCommands() is a plain static setter, so the last call wins. A guard provider listed above AppServiceProvider sets the flag to true, then AppServiceProvider immediately resets it to false in any non-production environment — the guard looks correctly installed and is completely inert.

Fix

Register the guard provider last in bootstrap/providers.php so it boots after AppServiceProvider, or fold the agent check into the existing AppServiceProvider call:

DB::prohibitDestructiveCommands(app()->isProduction() || AgentDetector::detect()->isAgent);

Verify for real with sail artisan migrate:fresh — it must warn and refuse. AgentGuardConfigure appends the provider at the end of the array for exactly this reason.

Still stuck? Open an issue with your --log transcript.

All troubleshooting entries