Skip to content

AI support copilot Phase 1: AI triage + frontend code PRs#3577

Merged
bernardhanna merged 1 commit into
devfrom
ai-support-copilot-phase1
Jun 23, 2026
Merged

AI support copilot Phase 1: AI triage + frontend code PRs#3577
bernardhanna merged 1 commit into
devfrom
ai-support-copilot-phase1

Conversation

@bernardhanna

Copy link
Copy Markdown
Collaborator

Summary

Integrates Cursor AI into the support copilot (Phase 1). All gated behind SUPPORT_AI_ENABLED (default false); writes still require an emailed APPROVE while SUPPORT_GMAIL_DRY_RUN=true. Nothing deploys automatically.

  • AI triage via the Cursor headless CLI (agent -p --output-format json), with the existing keyword rules kept as automatic fallback (TriageProvider + CursorCliTriageProvider; TriageAgentService merges AI over heuristic).
  • code_change action: a Cursor Cloud Agent implements a frontend fix on a branch and opens a PR into dev, threaded through the existing dry-run → APPROVE → execute → completion-email pipeline.
  • Gated dev → live release PR (pr_only) via the GitHub API — opens/reuses a PR for a human to merge; never auto-merges.
  • New commands: support:ai:setup-check, support:ai:poll-agents (scheduled every minute when enabled), support:ai:promote-dev-to-live.
  • config/support_ai.php + .env.example keys; migration adds cursor_agent_id, cursor_agent_status, cursor_pr_url, live_promotion_pr_url to support_cases.
  • Docs: docs/support-copilot-ai.md.

How it's wired

One CURSOR_API_KEY powers both the CLI (triage brain) and the Cloud Agents API (code PRs). Verified on codeweek-prod-1: CLI returns valid triage JSON; composer-2.5 confirmed in /v1/models.

Test plan

  • php artisan migrate adds the four support_cases columns
  • php artisan support:ai:setup-check passes (key, CLI binary path, cloud model, columns, allowed actions)
  • With SUPPORT_AI_ENABLED=true, SUPPORT_AI_CODE_CHANGE_ENABLED=false: a ticket gets AI triage; falls back to keywords if AI disabled/fails
  • With code changes enabled: a code_change ticket sends a dry-run email showing the exact agent prompt + target branch
  • After APPROVE: a PR opens into dev; support:ai:poll-agents reports the PR link
  • vendor/bin/phpunit tests/Unit/Support/CursorAgentServiceTest.php green

Notes

  • Triage via the CLI carries ~30k input tokens/ticket (workspace context) — fine at current volume.
  • Phase 2 (AI artisan changes: allowlist-first, dry-run + APPROVE) will follow in a separate PR.

Made with Cursor

Integrates Cursor AI into the support bot, replacing deterministic-only triage
and adding an autonomous frontend fix path.

- AI triage via the Cursor headless CLI (agent -p --output-format json), with
  the existing keyword rules kept as automatic fallback (TriageProvider +
  CursorCliTriageProvider; TriageAgentService merges AI over heuristic).
- New code_change action: a Cursor Cloud Agent implements a frontend fix on a
  branch and opens a PR into dev, threaded through the existing dry-run ->
  APPROVE -> execute -> completion-email pipeline. Nothing deploys automatically.
- Gated dev -> live release PR (pr_only) via GitHub API; never auto-merges.
- support:ai:setup-check, support:ai:poll-agents, support:ai:promote-dev-to-live
  commands; poll scheduled every minute when enabled.
- config/support_ai.php + .env.example keys; migration adds cursor_agent_id,
  cursor_agent_status, cursor_pr_url, live_promotion_pr_url to support_cases.
- Docs: docs/support-copilot-ai.md; unit tests for the Cloud Agents client.

All gated behind SUPPORT_AI_ENABLED (default false); writes still require an
emailed APPROVE while SUPPORT_GMAIL_DRY_RUN=true.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant