AI support copilot Phase 2: gated artisan changes over SSH#3578
Open
bernardhanna wants to merge 3 commits into
Open
AI support copilot Phase 2: gated artisan changes over SSH#3578bernardhanna wants to merge 3 commits into
bernardhanna wants to merge 3 commits into
Conversation
Lets the support copilot run server maintenance commands through the same dry-run -> APPROVE -> execute -> report pipeline as other write actions. Disabled by default (SUPPORT_AI_ARTISAN_ENABLED=false). - ArtisanActionRegistry: allowlist of permitted commands with per-argument type validation (email/token/name). Seeded with support:user-audit, support:event-audit, support:user-restore, support:user-update-profile. - ArtisanCommandRunner: builds/validates a plan, dry-runs (write commands get --dry-run; read-only run as-is; raw is never auto-simulated), and executes via the Process array form so values can't be shell-interpreted. Re-validates at execution time rather than trusting the stored approval payload. - Guarded raw fallback (SUPPORT_AI_ARTISAN_ALLOW_RAW): AI-proposed artisan commands are rejected on shell metacharacters and a destructive deny-list (migrate:fresh, db:wipe, tinker, down, ...), treated as writes, APPROVE-gated. - Triage gains the artisan_command case type (only offered when enabled) plus artisan_command_name/artisan_args/artisan_raw_command fields. - Wired into diagnostics (dry-run preview), the approval email (exact command + preview), execute job, and completion email (command + output). setup-check now reports artisan status; allowed_write_actions includes artisan_command. - Tests for registry validation and the raw-command guard; docs updated. Co-authored-by: Cursor <cursoragent@cursor.com>
Lets the support copilot make editorial text changes to allowlisted content records through the same dry-run -> APPROVE -> execute -> report pipeline. Records are Nova resources, so a human can also review/tweak them there. Disabled by default (SUPPORT_AI_CONTENT_ENABLED=false). - ContentActionRegistry: allowlist of editable content models (pages, slides, FAQ items, menus, events, podcasts, partners, ...). Page singletons resolve automatically; other records by id or a unique lookup field. - ContentFieldResolver: editable columns resolved at runtime to string/text columns minus a structural deny-list (URLs, slugs, flags, relations, identifiers, SEO/keyword/category) and minus non-string casts. No per-model column list to maintain. - ContentUpdateService: text-only value guards (rejects URLs, www refs, HTML/ markup, over-length), protects Laravel translation-key fields, computes an exact before/after diff for the approval email, and re-validates at execution time rather than trusting the stored payload. - Triage gains the content_update case type (only offered when enabled) plus content_model/content_identifier/content_changes/content_summary. - Wired into diagnostics (before/after preview), approval email (diff), execute job, and completion email; setup-check reports content status; allowed_write_actions includes content_update. - Unit tests for value guards, registry, and pre-DB plan validation; docs. Co-authored-by: Cursor <cursoragent@cursor.com>
5 tasks
AI support copilot Phase 3: content edits on Nova-managed records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on top of #3577 (Phase 1). Adds Phase 2: the support copilot can run server maintenance commands through the same dry-run → APPROVE → execute → report pipeline as every other write action. Disabled by default (
SUPPORT_AI_ARTISAN_ENABLED=false).ArtisanActionRegistry): the AI may only pick a permitted command; every arg/option is type-validated (email/token/name). Seeded withsupport:user-audit,support:event-audit,support:user-restore,support:user-update-profile.SUPPORT_AI_ARTISAN_ALLOW_RAW=true): AI-proposed commands are rejected on shell metacharacters and a destructive deny-list (migrate:fresh,db:wipe,tinker,down, …), treated as writes, and APPROVE-gated.ArtisanCommandRunner): runs via theProcessarray form (php artisan …) so values can't be shell-interpreted; write commands preview with--dry-run, read-only run as-is, raw is never auto-simulated. Re-validated at execution time rather than trusting the stored approval payload; output captured + truncated.artisan_commandcase type (only offered when enabled) +artisan_command_name/artisan_args/artisan_raw_command.support:ai:setup-checkreports artisan status;allowed_write_actionsincludesartisan_command.Review note
Base is the Phase 1 branch so the diff is only Phase 2. Merge after #3577. No migration needed — Phase 2 uses the existing action log.
Test plan
vendor/bin/phpunit tests/Unit/Support/ArtisanCommandRunnerTest.php(11 tests) greenSUPPORT_AI_ARTISAN_ENABLED=true: a maintenance ticket triages asartisan_command, dry-run email shows the exactphp artisan …command (+--dry-runpreview for write commands)artisan_commandis never offered and the runner fails safeMade with Cursor