You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
laravel/ai is only a suggest in composer.json, but ApiController::aiApplyFix() (src/Controllers/ApiController.php:449-470) always instantiates WriteSourceFileTool and \Laravel\Ai\Tools\Request. WriteSourceFileTool implements Laravel\Ai\Contracts\Tool. Without the package, the endpoint throws a class-not-found error, which surfaces as a 500 instead of the 501 that aiSuggest returns.
Suggested fix
Guard with class_exists(\Laravel\Ai\Tools\Request::class) and return 501 like aiSuggest. Or move the file-patching logic into a plain class that doesn't depend on laravel/ai.
aiApplyFix now returns HTTP 501 when the optional laravel/ai SDK is unavailable, matching the existing AI endpoint behavior, and avoids constructing SDK-dependent tools before that check.
Validation completed with PHP lint across the project source, a regression script for Issue #7, composer validate --no-check-publish, and git diff --check.
Same root cause also hits aiSuggest and aiInvestigateException: class_exists(QueryFixerAgent::class) autoloads the agent, which uses the Laravel\Ai\Promptable trait, so the probe itself fatals without laravel/ai. The hardening PR replaces the probe with trait_exists(\Laravel\Ai\Promptable::class) in one helper used by all three endpoints, with a regression test.
Activity
mikemikimike commentedon Oct 31, 2026
Implemented in PR #10: #10
aiApplyFixnow returns HTTP 501 when the optionallaravel/aiSDK is unavailable, matching the existing AI endpoint behavior, and avoids constructing SDK-dependent tools before that check.Validation completed with PHP lint across the project source, a regression script for Issue #7,
composer validate --no-check-publish, andgit diff --check.Nejcc commentedon Oct 31, 2026
Same root cause also hits
aiSuggestandaiInvestigateException:class_exists(QueryFixerAgent::class)autoloads the agent, which uses theLaravel\Ai\Promptabletrait, so the probe itself fatals without laravel/ai. The hardening PR replaces the probe withtrait_exists(\Laravel\Ai\Promptable::class)in one helper used by all three endpoints, with a regression test.fix(gh-11)!: production hardening, any-DB support, tests + CI (#20)
refactor(gh-21)!: conventional package layout, 80 tests, Larastan (#23)
fix(gh-18): shared config-driven redactor for bindings, log context a…
fix(gh-16): register collector listeners once and reset state per req…
Nejcc commentedon Oct 31, 2026
Fixed in #20; covered by tests/Feature/SecurityTest.php.