---
name: plugsky-support-tickets
slug: plugsky--plugsky-support-tickets
description: "Use when working Plugsky admin support tickets end-to-end \u2014 list tickets, investigate each customer's issue (plan sync, billing, API keys, model caps, fallbacks, refunds), reply in the customer's language (auto-emails them), close, transfer, or leave waiting for the customer. WHEN: support tickets, admin tickets, reply to ticket, close ticket, investigate ticket, customer says paid but free, cannot create key, charged annually, PLG ticket, respect tickets, triage inbox."
collection: Plugsky
category: Platform Ops
license: Plugsky
source: https://plugsky.com/skills
install: "Download the Plugsky skills pack (see below)"
---

# plugsky-support-tickets

Use when working Plugsky admin support tickets end-to-end — list tickets, investigate each customer's issue (plan sync, billing, API keys, model caps, fallbacks, refunds), reply in the customer's language (auto-emails them), close, transfer, or leave waiting for the customer. WHEN: support tickets, admin tickets, reply to ticket, close ticket, investigate ticket, customer says paid but free, cannot create key, charged annually, PLG ticket, respect tickets, triage inbox.

## Install

```bash
Download the Plugsky skills pack (see below)
```

## Skill

# Plugsky — support ticket triage & reply runbook

Last updated: **2026-11-06**. Full audit: `Plugsky/docs/ops/audit-skills.md` and `PLUGSKY-FULL-AUDIT-2026-10-27.md`.

Read → investigate → **fix if possible** → reply (auto-emails the customer) → set status.
Statuses: **open** (needs staff), **awaiting** (staff replied / waiting for customer), **closed** (done).
The admin KPI is **Unresolved tickets** = open + awaiting. Do not read it as “customers waiting on us.” On 2026-10-27 it showed **11 unresolved = 0 open + 11 awaiting**.

## 0. Access

| Thing | Value |
|---|---|
| Admin UI | `https://plugsky.com/admin#tickets` (tabs Open / Awaiting / Closed / All with auto-first-non-empty tab, search, **inline detail that opens directly under the clicked row**, same-line reply dropdown, transfer, close/reopen) |
| Admin API | `GET /api/admin/tickets?limit=300` · `GET /api/admin/tickets/{id}` · `POST /api/admin/tickets/{id}/reply {message, status?}` (emails the customer + defaults status→awaiting) · `PATCH /api/admin/tickets/{id} {status?, assigned_to?, priority?}` · `GET /api/admin/tickets/assignees` |
| Admin role | Only `role='admin'` users can use the admin API. Admins today: `admin@plugsky.com` (id 1), `mmarhama@gmail.com` (id 17). To run a scripted session: `UPDATE users SET role='admin' WHERE email='qa.audit@plugsky.com';` (token from `POST /api/auth/login`), then **revert to `user`** when done. AuthMiddleware re-reads users from the DB, so role changes apply to existing tokens immediately. |
| VPS | `ssh -i ~/.ssh/plugsky_deploy root@72.61.81.91` · backend `/var/www/plugsky/backend` (creds in `.env`) |
| Reply = email | The reply endpoint e-mails the ticket opener (non-fatal on failure). There is no separate "send email" step. |

## 1. Triage workflow

1. `GET /api/admin/tickets?limit=300` — group by class (below). Real tickets are the ones from customer emails; **test tickets** come from `@plugsky-test.com` / `@plugsky.invalid` / `qa-*` / `client-*` (delete them).
2. Investigate with the class recipe (all SQL runs on the VPS against the `plugsky` DB).
3. Apply the fix (comp, plan sync, clarification) when it is within the policy below.
4. `POST .../reply` with the answer in the **customer's language** (IT/PT/ES/RU/EN…) + sign `— Plugsky Support`. The customer gets it by email and the ticket becomes **awaiting**.
5. Close (`PATCH {status:'closed'}`) only when nothing is pending on us. Otherwise leave **awaiting** — the customer can reply to reopen.

## 2. Investigation recipes (by class)

### A. "I paid but API says free / model not available on your free plan"  ← most common
Class: plan-sync mismatch. Check:
```sql
SELECT w.id, w.plan AS ws_plan, u.email, u.plan AS user_plan, s.plan AS sub_plan, s.status,
       s.interval, s.stripe_price_id, s.current_period_end::date, s.canceled_at::date
  FROM workspaces w LEFT JOIN users u ON u.id=w.owner_id
  LEFT JOIN subscriptions s ON s.workspace_id=w.id
 WHERE w.id = <WS>;
SELECT type, processed_at::date FROM stripe_events WHERE workspace_id=<WS> ORDER BY processed_at DESC LIMIT 10;
SELECT * FROM plan_overrides WHERE workspace_id=<WS>;
```
- Price→plan map: `STRIPE_PRICE_*` in `backend/.env`; verify the sub's `stripe_price_id` resolves (Stripe `Price::retrieve`).
- If a **paid period exists but the plan never applied** (old webhook bug, fixed 2026-09): apply a goodwill comp (below) — 1 month of the paid plan — and say so in the reply. Offer a refund as an alternative (owner approval, see §4).
- Reconcile cron (`bin/reconcile-plans.php`, */15) now auto-heals active subs; check `storage/logs/reconcile.log`.

**Comp procedure (goodwill / partner):**
```bash
ssh … 'php -r '"'"'
require "/var/www/plugsky/backend/vendor/autoload.php";
use Dotenv\Dotenv; Dotenv::createImmutable("/var/www/plugsky/backend")->safeLoad();
$pdo = new PDO(sprintf("pgsql:host=%s;port=%d;dbname=%s", $_ENV["DB_HOST"], $_ENV["DB_PORT"], $_ENV["DB_NAME"]), $_ENV["DB_USER"], $_ENV["DB_PASS"]);
\Plugsky\Application\Billing\PlanOverrides::set($pdo, <WS>, "<plan>", "<reason>", date("Y-m-d H:i:s", strtotime("+30 days")));
$pdo->prepare("UPDATE workspaces SET plan=:p WHERE id=:w")->execute(["p"=>"<plan>","w"=><WS>]);
$pdo->prepare("UPDATE users SET plan=:p WHERE id=(SELECT owner_id FROM workspaces WHERE id=:w)")->execute(["p"=>"<plan>","w"=><WS>]);
'"'"''
```
PlanOverrides win over Stripe (reconcile keeps them).

### B. Billing: monthly vs annual / checkout problems
- Verify the real Stripe prices (they must match `backend/.env`):
  `STRIPE_PRICE_{HOBBY,STARTER,BUILDER,SCALE}` monthly and `..._ANNUAL` yearly (Builder: $60/mo · $720/yr).
- Selector: dashboard Billing → **Monthly/Annual** toggle above the plan cards; the active button is the inline-highlighted one. The click handler detects annual via the annual button's active state (the old *inverted* mapping is fixed — if a customer selected monthly but Stripe opened annual, that was this bug; nothing was charged while the sub is `pending`).
- `subscriptions.status='pending'` = checkout opened but never completed → **no charge**. Tell them the price, how to pick the interval, and that a pending checkout can be discarded/re-done.
- Coupon prices: launch coupons are 30% monthly / 50% annual (e.g., Starter monthly $8 → $5.60 with coupon).

### C. API keys
- Policy: **unlimited keys** (no per-plan cap; scopes still filtered by plan). Revoking frees instantly.
- Create flow: Dashboard → API Keys → `+ New key` → name → key is copied to clipboard and shown once. Use reveal-latest / create a new key if missed.
- Keys display masked (`sk-live-****<last4>`). Keys are non-expiring; revoke/rotate anytime.
- If a customer can't create: verify with the API (`POST /api/keys`) using their plan; check `api_keys.revoked_at IS NULL` count; ask for a screenshot + hard refresh.

### D. Model availability / fallbacks / vision
- Plan caps: free = plugsky-micro + plugsky-lite only; trial/hobby/starter/builder/scale unlock progressively (`PlanLimits::for()` / `rank()`); error text states the cap (`Model "X" is not available on your "free" plan (cap: plugsky-lite)`).
- Failover: internal worker fallback stays inside the **same plugsky alias**; plan and alias never change; each response exposes the actually-served upstream in `x_plugsky_served_model` **and the `X-Plugsky-Served-Model` header**. No per-request switch to disable failover.
- **Class contract (2026-10-03 revamp)**: entry/free aliases only ever serve entry engines; professional/frontier aliases never fall back to the free entry engine. **Frontier (max/frontier/ultra) may receive a professional engine under the published failover policy — exact 550B delivery is not promised.** If everything in-class is at capacity the customer gets a clean retryable 503, not a silent downgrade. Rescue is a reviewed list (opencode/zen/openrouter/groq/selfhost), never random routers. Cite these rules — not "scam" framing — and ask for 2–3 request IDs if they dispute the served engine.
- Vision: models analyze images (incl. technical drawings) — Plugsky does **not** generate/edit images.
- Trial: 14-day full-access trial (up to plugsky-plus), no card. There is no 1-hour trial.

### E. Refunds / cancels / chargebacks  ← owner approval required
Find the sub (`subscriptions`), payments (`revenue_records` by reference), and **escalate to the owner** (mustafa).
Never promise a refund yourself; reply that we're reviewing and it's being handled.

**When a refund IS issued (owner decision / already processed in Stripe), complete the round-trip:**
1. Verify in Stripe: `\Stripe\Refund::all(['limit' => 10])` → match the charge; note `amount_refunded` (Basil+ moved
   `Invoice.charge`/`paid` — use `Charge::all(['customer' => $cid])` + `Refund::all()`; `Subscription.current_period_end`
   now lives on `items->data[0]`).
2. Cancel the subscription if still active: `\Stripe\Subscription::retrieve($id)->cancel()` (a refund + live access
   is wrong). The webhook syncs `subscriptions.status='canceled'` + workspace/user plan → free (or set manually).
3. Mark revenue: `UPDATE revenue_records SET status='refunded' WHERE reference IN (...)` — the Revenue page
   (series + totals) filters `status='paid'`, so refunded money drops out automatically.
4. Reply to the ticket with the amount + "5–10 business days to appear", then **close** it
   (`POST .../reply {message, status:'closed'}` — one call does both; the customer is emailed).
5. Log in `Plugsky/error-logs/RESOLUTIONS.md` if a product bug caused the refund.

**2026-09-28 worked example:** PLG-87 ($20, ws 683) and PLG-96 ($14, ws 242503 — refund + cancel, sub canceled)
both completed + closed. ednsinf@gmail.com (ws 596, $10 charge `ch_3U4P8nDsL1mFEYtj03irLAGN`) reported a refund
but Stripe showed none — sub already canceled in our system; record left `paid` until the refund is really issued.

### F. Cancels
`PATCH`/dashboard cancel sets `cancel_at_period_end` (access until period end) or `canceled` in Stripe; confirm no further charges and that they can re-subscribe anytime.

### G. Data deletion / GDPR (Settings → Privacy)

- Customers can delete their account in **Settings → Privacy**. Deletion removes API keys, RAG documents, and configuration; anonymized usage metadata may remain for billing integrity.
- Verify the request from the account email before acting. Do not delete an account from a ticket alone.
- After deletion, record the user id, timestamp, and what was removed in the ticket. Do not paste personal data into the reply.
- **PLG-126 worked example:** account **1826** was deleted/anonymized; the customer re-signed up as **5789** (free), paid **$5.60** on Oct 23, and canceled Oct 26 20:07 UTC. **No refund was issued**; the agreed path is for the customer to retest first. Ticket 127 stays **awaiting**.
- Subprocessor questions: use `frontend/legal/privacy.html` v1.1 (updated 2026-10-27). It lists NVIDIA, OpenCode, OpenRouter, BytePlus, Groq, Cloudflare, Gemini, TokenHarbor, LLM7, Ollama, FreeLLMAPI, GPU Share operators, Stripe, PostgreSQL, certbot. Free-tier providers may retain short-lived abuse logs; they may not train. Do not promise a blanket no-retention guarantee.

## 3. Reply mechanics & status semantics

- `POST /api/admin/tickets/{id}/reply {message}` → inserts the staff message, **e-mails the customer**, sets status **awaiting** (explicit `status` overrides).
- `PATCH /api/admin/tickets/{id} {status}` → open/awaiting/closed (closing sets `resolved_at`; reopening clears it). `assigned_to` = an admin user id (transfer), `priority` = low/normal/high/urgent.
- **Close** when resolved with nothing pending; **awaiting** when the ball is in the customer's court (most replies);
  **open** for new/unread AND for tickets pending an **internal** action (refunds/cancels → set `open` + `assigned_to` the owner).
- **Status transitions:** customer reply ⇒ `open` (clears `resolved_at`) — fixed 2026-09-28 (previously stayed `awaiting`).
  Admin reply with the awaiting checkbox ⇒ `awaiting`. The list flags **💬 user replied** when the newest message is
  the customer's (`last_customer_message > last_staff_message`).
- Languages seen in the wild: Italian (PLG-95), Portuguese (PLG-92), Russian/Yandex (PLG-93), English (most). Always answer in the ticket's language.
- Never include secrets (API keys, tokens), never promise timelines/pricing you can't verify, never blame upstream providers.

## 4. Guardrails

- Money: comps/goodwill are fine within policy (≤1 month for a proven paid-without-access case); **refunds and legal/enterprise issues → owner escalation**.
- Security/privacy questions → answer from `legal/privacy` + DPA; escalate data requests.
- After any DB change: state exactly what changed in the reply; if comped, say the plan is active until <date>.
- Log-worthy events (bugs found, comps applied) go to `Plugsky/error-logs/RESOLUTIONS.md` (see the error-triage skill).

## 5. Session log

- **2026-09-28** — Tickets module revamped (tabs, search, transfer, close/reopen, reply dropdown, customer email) + admin role fix for owner + 83 test tickets deleted. Triaged 11 real tickets: 3× plan-sync (comps applied: ws 20134/47264 → scale, ws 683 → starter, 30 days), billing interval verified (monthly/annual fixed), key-creation verified, model/fallback questions answered.

## UI notes (2026-09-28, final)
- Clicking a ticket inserts a `.ticket-detail-row` **immediately after that ticket's row** (accordion; click again to collapse).
  Functions: `toggleTicketDetail(id, trEl)` / `renderTicketDetailInto(id, box)` / `closeInlineDetail()`;
  state: `TICKET_DETAIL_ID`. There is **no** bottom detail container.
- Reply is a **same-line dropdown** (`#tkReplyToggle` in the action bar → `#tkReplyBox` hidden by default).
- Keys UI: masked `sk-live-••••••<last4>` via `maskApiKey()` (note: the global `maskKey()` is for integration
  credentials — do not reuse it for API keys).

## 2026-10-27 — current queue and resolutions

- **Queue:** **0 open / 0 needs-reply**, **11 awaiting customer**. The admin KPI now says **Unresolved tickets** (open + awaiting), which is why it reads 11.
- **PLG-128:** replied and emailed with detailed model/tool guidance and the concurrency correction. No further action unless the customer replies.
- **PLG-126:** account 1826 deleted/anonymized, new 5789 free, $5.60 paid Oct 23, subscription canceled Oct 26 20:07 UTC. **No refund until the customer retests.** Ticket 127 remains awaiting; keep the GDPR evidence.
- **Concurrency:** user 5187 had a manual Redis override of **5**; the package default is **12**. The override was removed on 2026-10-27. If the customer reports 429s, verify the override keys and check paid-watch before changing anything.
- **Admin metric corrections:** “Unresolved tickets” = open + awaiting; “Alias routes serving” is 40 public aliases, separate from 11 engine rows. Do not quote the 51-row table as 51 chat models.

## 2026-11-06 — admin access after the security incident

The admin surface changed during the incident response:

- `admin@plugsky.com` (user 1) and `mmarhama@gmail.com` (user 17) passwords were rotated. The new credentials are **not** in Git; they are in a `0600` recovery file at `/Users/mmarhama/Documents/Plugsky-Admin-Recovery-20261106-1729.txt`. Move them to a password manager and delete the file.
- Email OTP is enabled for both admins. TOTP 2FA is still off; enroll it. `mmarhama@gmail.com` retains Google sign-in; enable Google 2FA or disable Google login for admin.
- All admin API keys were revoked. The old keys in scripts, shell history, or `OUTAGE_FALLBACK_KEYS.md` are dead. Create a new admin key only after logging in with the new password + email OTP.
- Trusted devices and login challenges were cleared. A new browser/device must complete the email code.
- `admin@plugsky.com` and `mmarhama@gmail.com` are the only active admins. `qa.audit@plugsky.com` is automation, not a production admin; never use it for customer data or refunds.
- All 20 `@fldubai.com` scanner accounts and user 29811 are suspended. Do not reopen them.
- If an admin API returns 401/403, check password/OTP/TOTP/token_version and API-key revocation before investigating plan sync.
- The live Stripe key is still pending rotation. Do not promise refunds or billing changes from a key that may be compromised; owner must roll it first.

## 2026-11-07 — ticket triage and billing fix

Queue at 07:02 UTC: **4 open / 13 awaiting / 31 closed**.

- **PLG-147 (Eugenio, user 6612, workspace 1629009):** Starter → Builder upgrade charged at 23:59 UTC; webhook set Builder, then the 00:00 reconcile cron reverted it to Starter. Root cause: reconcile trusted stale `metadata.plan_slug` before the current Stripe price. Fixed in r45; Builder restored; `PlanCaps::for` now shows no daily cap, 24 concurrent, 1,500 RPM, 256K input. Replied in English; awaiting customer retest.
- **PLG-146 (user 29836, Hobby):** Agent tool requests fail with 69 upstream 503s, 46 rate-limit/cooldown responses, and 7 context-window rejections. 503s are capacity/tool-lane exhaustion while paid fallback is paused; Hobby has 4 concurrent, 64K input. Replied in Russian with concurrency/backoff/context guidance; awaiting customer retest.
- **PLG-110 (Chase, user 1801, legacy Starter):** Asked what the administrative pause means. Explained it is our temporary paid-fallback pause, not a plan limit; legacy entitlements remain 0 daily caps, 262K input, 12 concurrent, 600 RPM. Also noted 18 `max_tokens_too_large` rejections (non-stream cap 8,192; use stream=true) and 5 context-window rejections. Replied; awaiting customer.
- **PLG-145 (Nukri, Super Protocol):** Partnership/confidential GPU inquiry. Replied politely, left **open** and assigned to owner 1 for internal review.
- All four replies were emailed (`mail.sent` confirmed for eugenio…, mytko…, chasemikoto…, nukri@superprotocol.com).

Admin replies were sent through the real admin API using a **short-lived JWT for user 1**, minted server-side and discarded. No admin password/OTP was changed, no API key was created, and no persistent credential was stored.

## Notes

Listed by Plugsky. Skill text and behaviour belong to the upstream author.
If you redistribute it, keep the upstream license and attribution.
