Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/support_gmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
return [
'enabled' => env('SUPPORT_GMAIL_ENABLED', false),

// How often support:gmail:poll runs (minutes). 1 is fine for low-volume support mailboxes.
'poll_interval_minutes' => max(1, (int) env('SUPPORT_GMAIL_POLL_INTERVAL_MINUTES', 1)),

// In a load-balanced setup, use a distributed lock so only one node polls at a time.
'lock' => [
'name' => env('SUPPORT_GMAIL_LOCK_NAME', 'support:gmail:poll'),
Expand Down
1 change: 1 addition & 0 deletions docs/support-copilot-allowed-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Configured in `config/support_gmail.php` → `allowed_write_actions`.
| Variable | Typical prod | Effect |
|----------|--------------|--------|
| `SUPPORT_GMAIL_ENABLED` | `true` | Turns on polling |
| `SUPPORT_GMAIL_POLL_INTERVAL_MINUTES` | `1` | Scheduler frequency (1–5 typical; increase if Gmail rate limits) |
| `SUPPORT_GMAIL_DRY_RUN` | `true` | Pipeline sends summaries; writes need **APPROVE** |
| `SUPPORT_GMAIL_NOTIFY_EMAIL` | `codeweek@matrixinternet.ie` | Dry-run summary recipient |
| `SUPPORT_GMAIL_ALLOWED_DOMAINS` | `matrixinternet.ie,codeweek.eu` | Ingest + approve senders |
Expand Down
10 changes: 5 additions & 5 deletions docs/support-copilot-stakeholder-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CodeWeek has an automated **support assistant** that:

- Watches a dedicated support inbox
- Picks up qualifying emails automatically (about every 5 minutes)
- Picks up qualifying emails automatically (about every minute by default)
- Runs basic checks on the user account mentioned in the email
- Sends a **summary email** to **codeweek@matrixinternet.ie** so the team can review before any change is made

Expand Down Expand Up @@ -144,7 +144,7 @@ Reported by: Rachele (EU CodeWeek coordination)
| `cw25-x6LtQ` | Extra context for manual verification (V1 may not auto-use the code yet) |
| Work email sender | Required for ingest and for any later **APPROVE** reply |

**What the team receives (~5 minutes later)**
**What the team receives (~1 minute later)**

An email to **codeweek@matrixinternet.ie** similar to:

Expand Down Expand Up @@ -325,7 +325,7 @@ Please update the profile name fields. Email address must stay the same.

| When | What happens |
|------|----------------|
| **Within ~5 minutes** | The system reads the inbox and creates a support case |
| **Within ~1 minute** | The system reads the inbox and creates a support case |
| **Shortly after** | A summary is emailed to **codeweek@matrixinternet.ie** |
| **Subject of summary** | `[CW-SUPPORT #123] Support copilot - dry run review` |
| **Sender** | Code Week Bot (automated) |
Expand Down Expand Up @@ -362,7 +362,7 @@ Read the summary email carefully.

(`YES` or `PROCEED` also work.)
3. Send from **`@matrixinternet.ie`** or **`@codeweek.eu`**
4. Wait up to ~5 minutes for the system to process your reply
4. Wait up to ~1 minute for the system to process your reply
5. You will receive a **follow-up email** in the same thread:
- **`action completed`** — change was applied
- **`action failed`** — change was not applied (see errors in the email; check Nova)
Expand Down Expand Up @@ -431,7 +431,7 @@ BODY: User email: someone@example.com
Problem: ...
Request: ...

WAIT: ~5 min → summary at codeweek@matrixinternet.ie
WAIT: ~1 min → summary at codeweek@matrixinternet.ie

APPROVE: Only if summary asks — reply with first line: APPROVE
```
Expand Down
11 changes: 9 additions & 2 deletions routes/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
Schedule::command('events:generate-recurring')->dailyAt('01:00');

// Support Gmail copilot: ingest tickets by subject (codeweek-support), run dry-run, email for APPROVE.
Schedule::command('support:gmail:poll --max=10')
->everyFiveMinutes()
$supportGmailPoll = Schedule::command('support:gmail:poll --max=10')
->when(fn () => (bool) config('support_gmail.enabled'));
$supportPollMinutes = (int) config('support_gmail.poll_interval_minutes', 1);
if ($supportPollMinutes <= 1) {
$supportGmailPoll->everyMinute();
} elseif ($supportPollMinutes === 5) {
$supportGmailPoll->everyFiveMinutes();
} else {
$supportGmailPoll->cron('*/'.$supportPollMinutes.' * * * *');
}
Loading