Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(support): update support severity drop down (#14190)

Jannik Maierhöfer049954eec1b2
diff --git a/web/src/__tests__/supportCaseSeverity.clienttest.ts b/web/src/__tests__/supportCaseSeverity.clienttest.ts
index 4b59626249..9685187128 100644
--- a/web/src/__tests__/supportCaseSeverity.clienttest.ts
+++ b/web/src/__tests__/supportCaseSeverity.clienttest.ts
@@ -1,65 +1,136 @@
// pylonClient imports the shared server logger at module load; stub it so this
-// stays a lightweight client-side unit test of the pure mapping function.
+// stays a lightweight client-side unit test of the pure mapping functions.
vi.mock("@langfuse/shared/src/server", () => ({
logger: { error: vi.fn(), warn: vi.fn(), info: vi.fn() },
}));
-import { mapToPylonCaseSeverity } from "@/src/features/support-chat/pylon/pylonClient";
+import {
+ mapToPylonCaseSeverity,
+ mapCaseSeverityToPylonPriority,
+} from "@/src/features/support-chat/pylon/pylonClient";
+import {
+ SEVERITY_1,
+ SEVERITY_2,
+ SEVERITY_3,
+ isSeverityAllowedForPlan,
+ highestSupportPlan,
+} from "@/src/features/support-chat/formConstants";
-describe("mapToPylonCaseSeverity", () => {
- const HIGH_TIER = "cloud:enterprise";
- const LOW_TIER = "cloud:pro";
+const HIGH_TIER = "cloud:enterprise"; // may raise Sev-1, Sev-2, Sev-3
+const MID_TIER = "cloud:pro"; // may raise Sev-2, Sev-3
+const LOW_TIER = "cloud:hobby"; // may raise Sev-3 only
+const CORE = "cloud:core"; // may raise Sev-3 only
- it("returns Sev-1 for outages on high-tier plans", () => {
+describe("mapToPylonCaseSeverity", () => {
+ it("maps Severity 1 to Sev-1 only on high-tier plans", () => {
expect(
- mapToPylonCaseSeverity({
- severity: "Outage, data loss, or data breach",
- plan: HIGH_TIER,
- }),
+ mapToPylonCaseSeverity({ severity: SEVERITY_1, plan: HIGH_TIER }),
).toBe("Sev-1");
});
- it("honors a manual high-priority request on high-tier plans", () => {
+ it("downgrades Severity 1 to Sev-2 for Pro-tier plans", () => {
expect(
- mapToPylonCaseSeverity({
- severity: "Question or feature request",
- plan: HIGH_TIER,
- isHighPriority: true,
- }),
- ).toBe("Sev-1");
+ mapToPylonCaseSeverity({ severity: SEVERITY_1, plan: MID_TIER }),
+ ).toBe("Sev-2");
});
- it("ignores the high-priority flag for non-high-tier plans", () => {
+ it("downgrades Severity 1 to Sev-3 for Hobby/Core plans", () => {
expect(
- mapToPylonCaseSeverity({
- severity: "Question or feature request",
- plan: LOW_TIER,
- isHighPriority: true,
- }),
+ mapToPylonCaseSeverity({ severity: SEVERITY_1, plan: LOW_TIER }),
).toBe("Sev-3");
+ expect(mapToPylonCaseSeverity({ severity: SEVERITY_1, plan: CORE })).toBe(
+ "Sev-3",
+ );
});
- it("ignores the high-priority flag when no plan is known", () => {
- expect(
- mapToPylonCaseSeverity({
- severity: "Question or feature request",
- isHighPriority: true,
- }),
- ).toBe("Sev-3");
+ it("downgrades Severity 1 to Sev-3 when no plan is known", () => {
+ expect(mapToPylonCaseSeverity({ severity: SEVERITY_1 })).toBe("Sev-3");
});
- it("keeps existing mapping when high-priority is not set", () => {
+ it("maps Severity 2 to Sev-2 for Pro tier and above", () => {
+ expect(
+ mapToPylonCaseSeverity({ severity: SEVERITY_2, plan: HIGH_TIER }),
+ ).toBe("Sev-2");
expect(
- mapToPylonCaseSeverity({
- severity: "Feature is not working at all",
- plan: HIGH_TIER,
- }),
+ mapToPylonCaseSeverity({ severity: SEVERITY_2, plan: MID_TIER }),
).toBe("Sev-2");
+ });
+
+ it("downgrades Severity 2 to Sev-3 for Hobby/Core plans", () => {
+ expect(
+ mapToPylonCaseSeverity({ severity: SEVERITY_2, plan: LOW_TIER }),
+ ).toBe("Sev-3");
+ expect(mapToPylonCaseSeverity({ severity: SEVERITY_2, plan: CORE })).toBe(
+ "Sev-3",
+ );
+ });
+
+ it("maps Severity 3 to Sev-3 regardless of plan", () => {
expect(
- mapToPylonCaseSeverity({
- severity: "Question or feature request",
- plan: HIGH_TIER,
- }),
+ mapToPylonCaseSeverity({ severity: SEVERITY_3, plan: HIGH_TIER }),
).toBe("Sev-3");
+ expect(mapToPylonCaseSeverity({ severity: SEVERITY_3 })).toBe("Sev-3");
+ });
+});
+
+describe("isSeverityAllowedForPlan", () => {
+ it("allows Severity 1 only for high-tier plans", () => {
+ expect(isSeverityAllowedForPlan(SEVERITY_1, HIGH_TIER)).toBe(true);
+ expect(isSeverityAllowedForPlan(SEVERITY_1, MID_TIER)).toBe(false);
+ expect(isSeverityAllowedForPlan(SEVERITY_1, LOW_TIER)).toBe(false);
+ expect(isSeverityAllowedForPlan(SEVERITY_1, undefined)).toBe(false);
+ });
+
+ it("allows Severity 2 for Pro tier and above but not Hobby/Core", () => {
+ expect(isSeverityAllowedForPlan(SEVERITY_2, HIGH_TIER)).toBe(true);
+ expect(isSeverityAllowedForPlan(SEVERITY_2, MID_TIER)).toBe(true);
+ expect(isSeverityAllowedForPlan(SEVERITY_2, LOW_TIER)).toBe(false);
+ expect(isSeverityAllowedForPlan(SEVERITY_2, CORE)).toBe(false);
+ expect(isSeverityAllowedForPlan(SEVERITY_2, undefined)).toBe(false);
+ });
+
+ it("always allows Severity 3", () => {
+ expect(isSeverityAllowedForPlan(SEVERITY_3, LOW_TIER)).toBe(true);
+ expect(isSeverityAllowedForPlan(SEVERITY_3, undefined)).toBe(true);
+ });
+});
+
+describe("highestSupportPlan", () => {
+ it("returns the plan granting the highest severity from a list", () => {
+ expect(highestSupportPlan(["cloud:hobby", "cloud:enterprise"])).toBe(
+ "cloud:enterprise",
+ );
+ expect(highestSupportPlan(["cloud:hobby", "cloud:pro"])).toBe("cloud:pro");
+ });
+
+ it("ignores undefined/empty entries", () => {
+ expect(highestSupportPlan([undefined, "cloud:team", undefined])).toBe(
+ "cloud:team",
+ );
+ });
+
+ it("returns a low-tier plan when that is all the user has", () => {
+ expect(highestSupportPlan(["cloud:hobby", "cloud:core"])).toBe(
+ "cloud:hobby",
+ );
+ });
+
+ it("returns undefined when there are no plans", () => {
+ expect(highestSupportPlan([])).toBeUndefined();
+ expect(highestSupportPlan([undefined])).toBeUndefined();
+ });
+
+ it("a Team/Enterprise member filing off-context can still raise Sev-1", () => {
+ // Regression: support form opened from a no-org page must not wrongly gate.
+ const best = highestSupportPlan(["cloud:hobby", "cloud:enterprise"]);
+ expect(isSeverityAllowedForPlan(SEVERITY_1, best)).toBe(true);
+ });
+});
+
+describe("mapCaseSeverityToPylonPriority", () => {
+ it("derives Pylon priority from the effective case severity", () => {
+ expect(mapCaseSeverityToPylonPriority("Sev-1")).toBe("urgent");
+ expect(mapCaseSeverityToPylonPriority("Sev-2")).toBe("high");
+ expect(mapCaseSeverityToPylonPriority("Sev-3")).toBe("low");
});
});
diff --git a/web/src/features/support-chat/SupportFormSection.tsx b/web/src/features/support-chat/SupportFormSection.tsx
index 7c7cbb2102..0a9287640b 100644
--- a/web/src/features/support-chat/SupportFormSection.tsx
+++ b/web/src/features/support-chat/SupportFormSection.tsx
@@ -6,11 +6,15 @@ import { type z } from "zod";
import {
MESSAGE_TYPES,
SEVERITIES,
+ SEVERITY_1,
+ SEVERITY_2,
+ SEVERITY_3,
INTEGRATION_TYPES,
TopicGroups,
type MessageType,
SupportFormSchema,
- isHighTierSupportPlan,
+ isSeverityAllowedForPlan,
+ highestSupportPlan,
} from "./formConstants";
import { api } from "@/src/utils/api";
@@ -25,13 +29,7 @@ import {
FormLabel,
FormMessage,
} from "@/src/components/ui/form";
-import { Checkbox } from "@/src/components/ui/checkbox";
import { RadioGroup } from "@/src/components/ui/radio-group";
-import {
- Tooltip,
- TooltipContent,
- TooltipTrigger,
-} from "@/src/components/ui/tooltip";
import {
Select,
SelectContent,
@@ -41,6 +39,7 @@ import {
} from "@/src/components/ui/select";
import { Textarea } from "@/src/components/ui/textarea";
import { useQueryProjectOrOrganization } from "@/src/features/projects/hooks";
+import { useSession } from "next-auth/react";
import { useMemo, useState } from "react";
import {
@@ -48,7 +47,7 @@ import {
DropzoneContent,
DropzoneEmptyState,
} from "@/src/components/ui/shadcn-io/dropzone";
-import { Info, Paperclip, Trash2 } from "lucide-react";
+import { Paperclip, Trash2 } from "lucide-react";
import { showErrorToast } from "@/src/features/notifications/showErrorToast";
import { PYLON_MAX_FILE_SIZE_BYTES } from "./pylon/pylonConstants";
import Spinner from "@/src/components/design-system/Spinner/Spinner";
@@ -168,12 +167,20 @@ export function SupportFormSection({
onSuccess: () => void;
}) {
const { organization, project } = useQueryProjectOrOrganization();
-
- // Team / Enterprise customers may manually escalate a request to Sev-1.
- const canRequestHighPriority = isHighTierSupportPlan(organization?.plan);
-
- // Controlled so the high-priority info tooltip opens on hover and on click.
- const [highPriorityInfoOpen, setHighPriorityInfoOpen] = useState(false);
+ const session = useSession();
+
+ // The support drawer is mounted globally and reachable from pages without an
+ // org/project in the URL (home, setup, onboarding, account settings), where
+ // `organization` is null. Fall back to the user's highest-tier org plan so
+ // severity eligibility reflects what the user actually has access to instead
+ // of being wrongly restricted. The server applies the same fallback.
+ const effectivePlan =
+ organization?.plan ??
+ highestSupportPlan(
+ (session.data?.user?.organizations ?? []).map((o) => o.plan),
+ );
+ const isSev1Allowed = isSeverityAllowedForPlan(SEVERITY_1, effectivePlan);
+ const isSev2Allowed = isSeverityAllowedForPlan(SEVERITY_2, effectivePlan);
// Tracks whether we've already warned about a short message
const [warnedShortOnce, setWarnedShortOnce] = useState(false);
@@ -192,8 +199,7 @@ export function SupportFormSection({
resolver: zodResolver(SupportFormSchema),
defaultValues: {
messageType: "Question" as MessageType,
- severity: "Question or feature request",
- isHighPriority: false,
+ severity: SEVERITY_3,
topic: "",
message: "",
integrationType: "",
@@ -221,8 +227,7 @@ export function SupportFormSection({
}
form.reset({
messageType: "Question",
- severity: "Question or feature request",
- isHighPriority: false,
+ severity: SEVERITY_3,
topic: "",
message: "",
});
@@ -297,7 +302,6 @@ export function SupportFormSection({
await createSupportThread.mutateAsync({
messageType: parsed.messageType,
severity: parsed.severity,
- isHighPriority: parsed.isHighPriority,
topic: parsed.topic as any,
integrationType: parsed.integrationType,
message: parsed.message,
@@ -385,71 +389,42 @@ export function SupportFormSection({
)}
/>
- {/* Severity */}
+ {/* Priority (maps to Pylon case_severity). Severity 1 is gated to
+ Team / Enterprise plans. */}
<FormField
control={form.control}
name="severity"
render={({ field }) => (
<FormItem>
- <FormLabel>Severity</FormLabel>
- <div className="flex items-center gap-3">
- <FormControl>
- <Select value={field.value} onValueChange={field.onChange}>
- <SelectTrigger className="flex-1">
- <SelectValue placeholder="Select severity" />
- </SelectTrigger>
- <SelectContent>
- {SEVERITIES.map((s) => (
- <SelectItem key={s} value={s}>
- {s}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </FormControl>
-
- {/* High priority (Sev-1) — only for Team / Enterprise plans */}
- {canRequestHighPriority && (
- <FormField
- control={form.control}
- name="isHighPriority"
- render={({ field: priorityField }) => (
- <FormItem className="flex shrink-0 flex-row items-center gap-1.5 space-y-0">
- <FormControl>
- <Checkbox
- checked={priorityField.value ?? false}
- onCheckedChange={priorityField.onChange}
- />
- </FormControl>
- <FormLabel className="cursor-pointer text-sm font-normal whitespace-nowrap">
- Urgent (Sev-1)
- </FormLabel>
- <Tooltip
- open={highPriorityInfoOpen}
- onOpenChange={setHighPriorityInfoOpen}
- >
- <TooltipTrigger asChild>
- <button
- type="button"
- onClick={() =>
- setHighPriorityInfoOpen((open) => !open)
- }
- className="text-muted-foreground hover:text-foreground"
- aria-label="High priority info"
- >
- <Info className="h-3.5 w-3.5" />
- </button>
- </TooltipTrigger>
- <TooltipContent className="max-w-xs">
- Mark as high priority only for time-critical
- issues such as production outages.
- </TooltipContent>
- </Tooltip>
- </FormItem>
- )}
- />
- )}
- </div>
+ <FormLabel>Priority</FormLabel>
+ <FormControl>
+ <Select value={field.value} onValueChange={field.onChange}>
+ <SelectTrigger>
+ <SelectValue placeholder="Select a priority" />
+ </SelectTrigger>
+ <SelectContent>
+ {SEVERITIES.map((s) => (
+ <SelectItem
+ key={s}
+ value={s}
+ disabled={!isSeverityAllowedForPlan(s, effectivePlan)}
+ >
+ {s}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </FormControl>
+ {/* Explain the gating for all input modalities (keyboard /
+ screen-reader users can't reach a per-item tooltip, and a
+ tooltip portal can stack behind the dropdown). */}
+ {!isSev1Allowed && (
+ <FormDescription>
+ {isSev2Allowed
+ ? "Severity 1 is available on the Team and Enterprise plans."
+ : "Severity 1 (Team and Enterprise) and Severity 2 (Pro and above) are not available on your current plan."}
+ </FormDescription>
+ )}
<FormMessage />
</FormItem>
)}
diff --git a/web/src/features/support-chat/formConstants.ts b/web/src/features/support-chat/formConstants.ts
index c577a17f8b..f990f07aa0 100644
--- a/web/src/features/support-chat/formConstants.ts
+++ b/web/src/features/support-chat/formConstants.ts
@@ -38,16 +38,24 @@ export const ALL_TOPICS = [
export const TopicSchema = z.enum(ALL_TOPICS);
export type Topic = z.infer<typeof TopicSchema>;
+/**
+ * Severity levels shown to the user. Wording mirrors the Pylon issue
+ * "Priority" field. Each maps to a Pylon `case_severity` value
+ * (Sev-1/Sev-2/Sev-3) in `mapToPylonCaseSeverity`.
+ */
export const SeveritySchema = z.enum([
- "Question or feature request",
- "Feature not working as expected",
- "Feature is not working at all",
- "Outage, data loss, or data breach",
+ "Severity 1 (Critical Business Impact)",
+ "Severity 2 (Major Business Impact)",
+ "Severity 3 (Minor Business Impact or General Questions)",
]);
export type Severity = z.infer<typeof SeveritySchema>;
+export const SEVERITY_1 = SeveritySchema.options[0];
+export const SEVERITY_2 = SeveritySchema.options[1];
+export const SEVERITY_3 = SeveritySchema.options[2];
+
/**
- * Plans that may manually flag a support request as high priority (Sev-1).
+ * Plans that may raise a Severity 1 (Sev-1) support request.
* Mirrors the high-tier check in `mapToPylonCaseSeverity`.
*/
export const HIGH_TIER_SUPPORT_PLANS = [
@@ -56,10 +64,64 @@ export const HIGH_TIER_SUPPORT_PLANS = [
"self-hosted:enterprise",
] as const;
-/** Whether the given plan may manually escalate a support request to Sev-1. */
+/**
+ * Plans that may raise a Severity 2 (Sev-2) support request — Pro tier and
+ * above. Hobby/Core (and free/unknown plans) are limited to Severity 3.
+ */
+export const SEV2_SUPPORT_PLANS = [
+ "cloud:pro",
+ "cloud:team",
+ "cloud:enterprise",
+ "self-hosted:pro",
+ "self-hosted:enterprise",
+] as const;
+
+/** Whether the given plan may raise a Severity 1 support request. */
export const isHighTierSupportPlan = (plan?: string): boolean =>
!!plan && (HIGH_TIER_SUPPORT_PLANS as readonly string[]).includes(plan);
+/** Whether the given plan may raise a Severity 2 support request. */
+export const canRaiseSeverity2 = (plan?: string): boolean =>
+ !!plan && (SEV2_SUPPORT_PLANS as readonly string[]).includes(plan);
+
+/**
+ * Whether a given severity level can be selected on the given plan. Used both
+ * to grey out options in the UI and as a server-side safeguard in
+ * `mapToPylonCaseSeverity`.
+ */
+export const isSeverityAllowedForPlan = (
+ severity: string,
+ plan?: string,
+): boolean => {
+ if (severity === SEVERITY_1) return isHighTierSupportPlan(plan);
+ if (severity === SEVERITY_2) return canRaiseSeverity2(plan);
+ return true; // Severity 3 is always available
+};
+
+/**
+ * Picks the plan granting the highest support severity from a list. Used as a
+ * fallback when no specific org/project is in context (e.g. the support form is
+ * opened from a page without an org/project in the URL): eligibility should
+ * reflect the best plan the user has access to rather than defaulting to none.
+ */
+export const highestSupportPlan = (
+ plans: Array<string | undefined>,
+): string | undefined => {
+ const rank = (plan?: string) =>
+ isHighTierSupportPlan(plan) ? 3 : canRaiseSeverity2(plan) ? 2 : 1;
+ let best: string | undefined;
+ let bestRank = 0;
+ for (const plan of plans) {
+ if (!plan) continue;
+ const r = rank(plan);
+ if (r > bestRank) {
+ bestRank = r;
+ best = plan;
+ }
+ }
+ return best;
+};
+
export const IntegrationTypeSchema = z.enum([
"Python SDK",
"TypeScript SDK",
@@ -79,11 +141,6 @@ export type IntegrationType = z.infer<typeof IntegrationTypeSchema>;
export const SupportFormSchema = z.object({
messageType: MessageTypeSchema.default("Question"),
severity: SeveritySchema,
- /**
- * Manual high-priority (Sev-1) escalation. Only honored server-side for
- * high-tier plans (see {@link isHighTierSupportPlan}).
- */
- isHighPriority: z.boolean().default(false),
integrationType: z.string().optional(),
topic: z
.union([TopicSchema, z.literal("")])
diff --git a/web/src/features/support-chat/pylon/pylonClient.ts b/web/src/features/support-chat/pylon/pylonClient.ts
index feae19d32c..bce8a87948 100644
--- a/web/src/features/support-chat/pylon/pylonClient.ts
+++ b/web/src/features/support-chat/pylon/pylonClient.ts
@@ -1,5 +1,10 @@
import { logger } from "@langfuse/shared/src/server";
-import { isHighTierSupportPlan } from "../formConstants";
+import {
+ isHighTierSupportPlan,
+ canRaiseSeverity2,
+ SEVERITY_1,
+ SEVERITY_2,
+} from "../formConstants";
const PYLON_API_BASE = "https://api.usepylon.com";
@@ -169,17 +174,20 @@ export async function updatePylonAccountCustomFields(
}
}
-export function mapSeverityToPylonPriority(
- severity: string,
-): "urgent" | "high" | "medium" | "low" {
- switch (severity) {
- case "Outage, data loss, or data breach":
+/**
+ * Maps the effective Pylon `case_severity` to the Pylon issue `priority`.
+ * Derived from the (already plan-gated) case severity so the two fields stay
+ * consistent.
+ */
+export function mapCaseSeverityToPylonPriority(
+ caseSeverity: "Sev-1" | "Sev-2" | "Sev-3",
+): "urgent" | "high" | "low" {
+ switch (caseSeverity) {
+ case "Sev-1":
return "urgent";
- case "Feature is not working at all":
+ case "Sev-2":
return "high";
- case "Feature not working as expected":
- return "medium";
- case "Question or feature request":
+ case "Sev-3":
default:
return "low";
}
@@ -254,31 +262,31 @@ export function mapMessageTypeToPylonQuestionType(messageType: string): string {
}
}
+/**
+ * Maps the user-selected severity level to the Pylon `case_severity` value,
+ * capped by what the plan is eligible for.
+ *
+ * Severity 1 requires a high-tier plan (Team/Enterprise); Severity 2 requires
+ * Pro tier or above. These options are disabled in the UI for ineligible plans,
+ * but we also enforce it here as a server-side safeguard: a selection above the
+ * plan's eligibility is downgraded to the highest level it can raise (a
+ * Hobby/Core request therefore never exceeds Sev-3).
+ */
export function mapToPylonCaseSeverity(params: {
severity: string;
plan?: string;
- /** Customer manually requested high priority via the support form. */
- isHighPriority?: boolean;
}): "Sev-1" | "Sev-2" | "Sev-3" {
- const { severity, plan, isHighPriority } = params;
- const isHighTierPlan = isHighTierSupportPlan(plan);
+ const { severity, plan } = params;
- // High-tier customers (Team/Enterprise) get Sev-1 either automatically for
- // outages, or when they manually flag a time-critical request as urgent.
- if (
- isHighTierPlan &&
- (isHighPriority || severity === "Outage, data loss, or data breach")
- ) {
+ if (severity === SEVERITY_1 && isHighTierSupportPlan(plan)) {
return "Sev-1";
}
-
if (
- severity === "Outage, data loss, or data breach" ||
- severity === "Feature is not working at all"
+ (severity === SEVERITY_1 || severity === SEVERITY_2) &&
+ canRaiseSeverity2(plan)
) {
return "Sev-2";
}
-
return "Sev-3";
}
diff --git a/web/src/features/support-chat/trpc/supportRouter.ts b/web/src/features/support-chat/trpc/supportRouter.ts
index d96fcdfed9..19bba31b53 100644
--- a/web/src/features/support-chat/trpc/supportRouter.ts
+++ b/web/src/features/support-chat/trpc/supportRouter.ts
@@ -15,14 +15,14 @@ import {
SeveritySchema,
TopicSchema,
TopicGroups,
- isHighTierSupportPlan,
+ highestSupportPlan,
} from "../formConstants";
import {
createPylonIssue,
buildPylonIssueBodyHtml,
buildPylonMetadataString,
- mapSeverityToPylonPriority,
+ mapCaseSeverityToPylonPriority,
updatePylonAccountCustomFields,
mapPlanToPylonCustomerTier,
mapToPylonCaseSeverity,
@@ -35,8 +35,6 @@ import {
const CreateSupportThreadInput = z.object({
messageType: MessageTypeSchema,
severity: SeveritySchema,
- /** Manual Sev-1 escalation; only honored for high-tier plans (enforced below). */
- isHighPriority: z.boolean().optional(),
topic: TopicSchema,
message: z.string().trim().min(1),
url: z.url().optional(),
@@ -151,11 +149,23 @@ export const supportRouter = createTRPCRouter({
currentSupportRequestContext.organizationId = organization.id;
}
- // Only honor a manual high-priority request for high-tier plans; ignore
- // the client-supplied flag otherwise so it cannot be used to force Sev-1.
- const honorHighPriority =
- input.isHighPriority === true &&
- isHighTierSupportPlan(currentSupportRequestContext.plan);
+ // When no specific org/project is in context (the support form is
+ // reachable from pages without org/project in the URL), fall back to the
+ // user's highest-tier org plan. This mirrors the client-side gating so a
+ // legitimate Team/Enterprise user is not silently downgraded.
+ if (!currentSupportRequestContext.plan) {
+ currentSupportRequestContext.plan = highestSupportPlan(
+ ctx.session.user.organizations.map((o) => o.plan),
+ );
+ }
+
+ // Resolve the Pylon case severity (Sev-1/2/3). Sev-1 is gated to
+ // high-tier plans inside mapToPylonCaseSeverity, so a Severity 1 selection
+ // from a non-high-tier plan is safely downgraded server-side.
+ const caseSeverity = mapToPylonCaseSeverity({
+ severity: input.severity,
+ plan: currentSupportRequestContext.plan,
+ });
const { topLevel, subtype } = splitTopic(input.topic);
@@ -199,9 +209,7 @@ export const supportRouter = createTRPCRouter({
requesterEmail: email,
requesterName: fullName,
tags: ["Langfuse"],
- priority: honorHighPriority
- ? "urgent"
- : mapSeverityToPylonPriority(input.severity),
+ priority: mapCaseSeverityToPylonPriority(caseSeverity),
attachmentUrls: input.pylonAttachmentUrls,
customFields: [
...(input.url
@@ -223,11 +231,7 @@ export const supportRouter = createTRPCRouter({
{ slug: "langfuse_metadata", value: pylonMetadata },
{
slug: "case_severity",
- value: mapToPylonCaseSeverity({
- severity: input.severity,
- plan: currentSupportRequestContext.plan,
- isHighPriority: honorHighPriority,
- }),
+ value: caseSeverity,
},
],
});