Support Tickets¶
The support ticket system lets backoffice users report issues directly to the engineering team via Linear. It supports two issue types: chatbot issues (flagged from a specific conversation) and general issues (free-form).
Architecture¶
Issue Types¶
Chatbot Issue¶
Reported from the conversation timeline panel via the Report issue button. The URL carries domainId and sessionId as query parameters so the form can load the conversation context.
| Field | Source |
|---|---|
domain_id |
URL param / selected domain |
session_id |
URL param |
conversation_link |
Auto-built from domain + session; carries domain and workspace so the link opens on the conversation's workspace |
workspace |
Optional name and public URL of the workspace that answered the reported turn (messages.resolved_workspace); shown as the ticket's Workspace line |
selected_message_content |
User picks an assistant message |
issue_subtype |
accurate_but_not_ok or not_accurate |
expected_answer |
Free-text |
reporter_name / reporter_email |
Pre-filled from auth context |
Other Issue¶
A free-form report for anything not tied to a specific conversation.
| Field | Source |
|---|---|
title |
User input (max 200 chars) |
description |
Free-text |
reporter_name / reporter_email |
Pre-filled from auth context |
Reports from an AI assistant¶
The client MCP offers both issue types through preview then apply. A conversation
report selects an assistant message from read_conversation, by conversation UUID
or the session value in a backoffice conversation link. The shared ixrose_client
code reads the stored answer and preceding visitor question, uses the selected
turn's resolved_workspace.site_id (falling back to conversation ownership only
for legacy turns without a snapshot), and builds the same chatbot report fields.
The conversation must belong to the selected workspace (its workspace_id, which
export_conversations filters on) or have been served on one of its hosts: the
registered domain or the host of one of its roots. An alias root keeps its own host
in site_domain (welcome.example.com/fr-signup on a French path workspace), so a
conversation exported from that workspace can be read and reported there (IX-6411).
Either way, only the turns answered in the selected workspace are shown or reported.
POST /admin/support/tickets independently checks workspace access and rebuilds the
preview using the caller's token and current confirmed Auth email. A changed email,
workspace or source message requires a fresh preview. The Admin API forwards that
canonical payload to the support function and persists the returned reference in
support_tickets, so it appears under Support. The MCP gains no privileged key
and direct connector writes to that table remain denied.
The function derives reporter email from Supabase Auth for every caller; submitted reporter identity cannot override it. OAuth tokens cannot use the legacy submission path without a workspace and submission id. The function also checks the selected workspace and canonical source messages independently, including their conversation link. Aliased path workspaces use an exact same-client root mapping to the registered domain; no hostname or email-domain guessing is involved.
For MCP reports, the stable Linear issue UUID is namespaced to the authenticated user, workspace, submission and canonical report content. Retrying the same unexpired preview recovers that issue even after its description is edited or it is archived, attempts missing customer attribution, and does not reset its synced status. Customer linking remains best-effort; a Linear customer API failure does not hide a created ticket from Support. A failed customer link is logged and remains missing unless staff repair it or the submission is retried for another reason; no automatic repair is scheduled. Reusing a submission id for different content cannot discard the changed report. Recovery metadata is not added to the client-visible description. Client attribution uses the selected workspace/domain, never an email-domain guess. Previews expire after ten minutes; a new preview is a separately confirmed submission. Cross-boundary builder/validator contract tests run in the PR checks; the standalone function release filter watches its own sources, since it has no runtime dependency on the shared client package.
The deployed test and production Admin APIs use the existing shared support
function and Rose's real Linear queue, just as the backoffice does. Local runs
require an explicit SUPPORT_FUNCTION_URL; use an isolated local function to avoid
writing real Linear tickets. Supabase environment names do not isolate its rows.
Frontend¶
Route & Navigation¶
- Route:
/support(lazy-loadedSupportPage) - Sidebar: "Support" item with
LifeBuoyicon in bottom nav - Timeline panel: "Report issue" button navigates to
/support?domainId=X&sessionId=Y
Components¶
| Component | Path | Purpose |
|---|---|---|
SupportPage |
pages/SupportPage.tsx |
Issue type tabs, form orchestration, submission + toast |
ChatbotIssueForm |
components/support/ChatbotIssueForm.tsx |
Conversation-aware form with message selector |
OtherIssueForm |
components/support/OtherIssueForm.tsx |
Simple title + description form |
MessageSelector |
components/support/MessageSelector.tsx |
Scrollable list of assistant messages to select |
Service Layer¶
services/supportTicket.ts exports:
createSupportTicket(payload)- POSTs to the cloud function with a Supabase bearer tokenSupportTicketError- Custom error class with HTTPstatusChatbotIssuePayload/OtherIssuePayload- TypeScript interfaces matching the backend models
Backend — Cloud Function¶
Location: backend/functions/linear-ticket/
A standalone GCP Cloud Function (Python 3.12, functions-framework) that receives ticket payloads, validates auth, and creates Linear issues.
Files¶
| File | Purpose |
|---|---|
main.py |
HTTP entry point, CORS, request routing |
models.py |
Pydantic v2 models with discriminated union (issue_type) |
auth.py |
Supabase bearer token validation |
linear_client.py |
Linear GraphQL client (httpx, async) |
Request / Response¶
POST /create-ticket
Authorization: Bearer <supabase_access_token>
Content-Type: application/json
{
"payload": { ... ChatbotIssuePayload | OtherIssuePayload }
}
Response:
{
"success": true,
"issue_id": "abc-123",
"issue_identifier": "IX-100",
"issue_url": "https://linear.app/inboundx/issue/IX-100",
"error": null
}
CORS¶
Allowed origins:
https://backoffice.userose.aihttp://localhost:3002http://localhost:5173http://localhost:5174
Deployment¶
The function is deployed via GitHub Actions (.github/workflows/deploy-linear-ticket-fn.yml):
- Trigger: Push to
mainordeveloptouchingbackend/functions/linear-ticket/**, or manualworkflow_dispatch - Region:
europe-west9 - Runtime: Python 3.12
- Entry point:
create_support_ticket
Environment Variables¶
| Variable | Where | Purpose |
|---|---|---|
VITE_SUPPORT_FUNCTION_URL |
Frontend .env |
Cloud function URL |
LINEAR_API_KEY |
GCP Secret Manager | Linear API authentication |
SUPABASE_URL |
GCP Secret Manager | Token validation endpoint |
SUPABASE_ANON_KEY |
GCP Secret Manager | Supabase anon key |
SUPPORT_FUNCTION_URL |
Admin API environment | Existing support function URL, resolved by the Admin deploy recipe; required explicitly for local submission |