@php $engineEnabled = (bool) ($settings['ai_healing_enabled'] ?? false) && (bool) ($providerInfo['enabled'] ?? false) && (bool) ($providerInfo['has_key'] ?? false); @endphp {{ $engineEnabled ? 'ENGINE ACTIVE' : 'ENGINE DISABLED' }} · Provider: {{ $providerInfo['provider'] }} · Last incident: {{ $lastIncident ? $lastIncident->diffForHumans() : '—' }}
{{ $stats['last_24h'] }} in last 24h
Requires manual review
Healing success ratio
| INCIDENT TIME | STATUS | EXCEPTION MANIFEST | AI DIAGNOSIS | INTEL |
|---|---|---|---|---|
| {{ $log->created_at->format('d M, H:i:s') }} | @if($log->status === 'resolved') RESOLVED @elseif($log->status === 'failed') FAILED @else {{ strtoupper($log->status) }} @endif |
{{ Str::limit(class_basename($log->error_type), 38) }}
{{ Str::limit($log->error_message, 56) }}
|
{{ Str::limit($log->ai_diagnosis ?? '-', 60) }} |
@can('manage ai self-healing')
@if(in_array($log->status, ['failed', 'diagnosing', 'pending']))
@endif
@endcan
|
No data yet
Top exceptions will appear here.
provider={{ strtolower($providerInfo['provider']) }} · enabled={{ $engineEnabled ? 'true' : 'false' }} · keyed={{ $providerInfo['has_key'] ? 'true' : 'false' }}
When an exception is thrown anywhere in the application, the engine intercepts it, reads
25 lines of code around the fault, and asks the AI to
classify the bug into one of three tiers with a confidence score.
Tier 1 & 2 errors are auto-fixed immediately — no confirmation required.
Tier 3 errors (truly ambiguous) are logged for human review. Every code edit writes a
.bak.YYYYMMDDhhmmss backup, and one click rolls it back.
AI must return a remedy. Applied immediately without human confirmation.
use import@@can / @@if in Blade text::set vs ::put)AI attempts the most likely fix when it can identify a concrete change.
(int) $id)DATE_FORMAT) → use Carbon in PHPAI returns null with a precise diagnosis. A human must review.
vendor/[conf=0.92][tier=1] Found unescaped @@can directive in documentation text at line 1140. Replaced with @@can to make Blade output it as literal HTML.
[conf=0.00–1.00] — how confident the AI was in this fix[tier=1|2|3] — which decision tier was applied
Visible in the terminal INCIDENT_DUMP modal under the AI_DIAGNOSIS section.
Before the AI overwrites a file, the original is copied to filename.bak.YYYYMMDDhhmmss in the same directory.
Open the INCIDENT_DUMP modal of any resolved code-edit incident and you'll see a
↻ ROLLBACK button in the modal header.
Clicking it restores the file from the backup, runs optimize:clear, and tags the log with
[rolled back by <user>] in the diagnosis. The rollback button only appears when the backup file
still exists on disk — if you delete .bak files manually, rollback becomes unavailable.
ai_healing_logs with status pending. Duplicate exceptions within 2 minutes are skipped.'],
['icon'=>'bi-cpu', 'color'=>'#3b82f6', 'title'=>'3. Diagnosing', 'desc'=>'The healer job runs synchronously, reads ±25 lines of context, builds a tiered prompt with your enabled commands, and calls the AI.'],
['icon'=>'bi-bullseye', 'color'=>'#8b5cf6', 'title'=>'4. Tier & gate', 'desc'=>'AI returns {confidence, tier, code_edit?, action_command?}. Tier 1/2 → proceed. Tier 3 → bail with diagnosis. Commands must pass capability-toggle gate.'],
['icon'=>'bi-floppy', 'color'=>'#06b6d4', 'title'=>'5. Backup', 'desc'=>'Before any code edit, the original file is copied to .bak.YYYYMMDDhhmmss in the same directory. This is what makes rollback possible.'],
['icon'=>'bi-check2-circle', 'color'=>'#22c55e', 'title'=>'6. Resolved', 'desc'=>'Edit applied or Artisan command executed. optimize:clear runs automatically after code edits. Diagnosis is tagged with [conf=][tier=].'],
['icon'=>'bi-arrow-counterclockwise','color'=>'#f59e0b','title'=>'7. Rollback (optional)','desc'=>'Anytime later, open the incident modal → click ↻ ROLLBACK. File is restored from .bak, caches cleared, log tagged [rolled back by <user>].'],
['icon'=>'bi-x-octagon', 'color'=>'#dc2626', 'title'=>'Failed (alt)', 'desc'=>'If invalid JSON, target not found, command refused, or AI marked it Tier 3 — status becomes failed with a precise reason. Click to retry.'],
];
@endphp
@foreach($steps as $s)
cache:clear — stale class / model cacheview:clear — deleted / renamed bladeconfig:clear — .env not reflectedroute:clear — route not found after editoptimize:clear — catch-all (most common)queue:restart — Horizon workers staledown / up — maintenance gatemigrate — pending schema change (HIGH RISK)use imports?->)Cache::set → ::put)vendor/', 'Healer refuses to touch third-party code.'],
['Multi-file refactors', 'Only one file / one string replacement per incident.'],
['migrate:fresh', 'Always refused, even when DB toggle is ON (data loss).'],
['Errors from the healer itself', 'Trace-based filter prevents infinite loops.'],
];
@endphp
@foreach($blockers as $b)
action_taken.[1] Provider link is {{ $providerInfo['enabled'] && $providerInfo['has_key'] ? 'LINKED' : 'OFFLINE — set API key in Global Settings → AI Config' }} [2] Healing engine is {{ $engineEnabled ? 'ENABLED' : 'DISABLED — toggle on Configuration tab' }} [3] Cache toggle: {{ ($settings['ai_healing_allow_cache'] ?? false) ? 'on' : 'off' }} [4] Queue toggle: {{ ($settings['ai_healing_allow_queue'] ?? false) ? 'on' : 'off' }} [5] Maintenance toggle: {{ ($settings['ai_healing_allow_maintenance'] ?? false) ? 'on' : 'off' }} [6] DB migration toggle: {{ ($settings['ai_healing_allow_db'] ?? false) ? 'on (HIGH RISK)' : 'off' }} # DEBUGGING A SPECIFIC INCIDENT: # 1. Click row in Activity Feed → opens terminal modal # 2. Read [conf=][tier=] tag — tells you why AI chose this path # 3. If FAILED, action_taken explains the exact refusal reason # 4. If RESOLVED but fix is wrong, click ↻ ROLLBACK in modal header # 5. To re-run AI on a failed/stuck log, click ↻ RE-RUN AI
vendor/,
never runs migrate:fresh, and
never applies a command that your capability toggles have disabled.
Every code edit produces a timestamped .bak next to the original and is reversible via the
↻ ROLLBACK button.
A re-entrancy guard (AI_HEALER_RUNNING constant + trace-based filter) prevents the healer from
healing its own exceptions.