From 69aebe9d28940ba4116c0fcae8f87766e569e3ae Mon Sep 17 00:00:00 2001 From: srest2021 Date: Fri, 20 Nov 2026 14:41:33 -0800 Subject: [PATCH 1/5] fix(cli): Link Seer credit errors to the auto-reload modal The out-of-credits and daily-limit errors linked to the billing overview with ?product=seer, which doesn't open the auto-reload modal. They now link to #open-seer-auto-reload-modal, adding the denial reason for the daily limit so the modal can explain what stopped Seer. --- packages/cli/src/lib/errors.ts | 5 +++-- packages/cli/src/lib/sentry-urls.ts | 16 ++++++++++++++++ packages/cli/test/lib/errors.test.ts | 8 ++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/lib/errors.ts b/packages/cli/src/lib/errors.ts index dcc8bd198b..f4794f6d2e 100644 --- a/packages/cli/src/lib/errors.ts +++ b/packages/cli/src/lib/errors.ts @@ -33,6 +33,7 @@ import { redactCredentialText } from "./credential-redaction.js"; import { buildBillingUrl, buildOrgSettingsUrl, + buildSeerAutoReloadUrl, buildSeerSettingsUrl, buildSourceCodeIntegrationsUrl, } from "./sentry-urls.js"; @@ -932,8 +933,8 @@ export class SeerError extends CliError { // out_of_credits orgs already have Seer, so a trial is not the fix. // Sentry doesn't say whether auto-reload is off or has run through its // top-ups, so the advice covers both. - out_of_credits: `Someone with billing access can adjust Seer spend and auto-reload in Sentry:\n ${buildBillingUrl(this.orgSlug, "seer")}`, - daily_cap_exceeded: `Someone with billing access can raise the limit in Sentry, or you can try again tomorrow:\n ${buildBillingUrl(this.orgSlug, "seer")}`, + out_of_credits: `Someone with billing access can adjust Seer spend and auto-reload in Sentry:\n ${buildSeerAutoReloadUrl(this.orgSlug)}`, + daily_cap_exceeded: `Someone with billing access can raise the limit in Sentry, or you can try again tomorrow:\n ${buildSeerAutoReloadUrl(this.orgSlug, "daily_cap_exceeded")}`, // Setup gaps are fixed in Sentry settings, not with a trial. scm_integration_required: `Connect GitHub or GitLab to Sentry:\n ${buildSourceCodeIntegrationsUrl(this.orgSlug)}`, repos_not_linked: `Connect the project's repositories in Seer settings:\n ${buildSeerSettingsUrl(this.orgSlug)}`, diff --git a/packages/cli/src/lib/sentry-urls.ts b/packages/cli/src/lib/sentry-urls.ts index 3e8dbd5072..458dc605bc 100644 --- a/packages/cli/src/lib/sentry-urls.ts +++ b/packages/cli/src/lib/sentry-urls.ts @@ -308,6 +308,22 @@ export function buildBillingUrl(orgSlug: string, product?: string): string { return product ? `${base}?product=${product}` : base; } +/** + * Build URL to the billing page with the Seer auto-reload modal open. + * + * @param orgSlug - Organization slug + * @param denialReason - Why Seer stopped, which the modal uses for its copy + */ +export function buildSeerAutoReloadUrl( + orgSlug: string, + denialReason?: string, +): string { + const hash = denialReason + ? `#open-seer-auto-reload-modal:${denialReason}` + : "#open-seer-auto-reload-modal"; + return `${buildBillingUrl(orgSlug)}${hash}`; +} + // Logs URLs /** diff --git a/packages/cli/test/lib/errors.test.ts b/packages/cli/test/lib/errors.test.ts index 3ce5e75108..312c66553b 100644 --- a/packages/cli/test/lib/errors.test.ts +++ b/packages/cli/test/lib/errors.test.ts @@ -397,20 +397,20 @@ describe("SeerError", () => { expect(formatted).toContain("my-org"); }); - test("format() includes billing URL for out_of_credits with orgSlug", () => { + test("format() links auto-reload modal for out_of_credits with orgSlug", () => { const formatted = new SeerError("out_of_credits", "my-org").format(); expect(formatted).toContain("Your organization is out of Seer credits."); expect(formatted).toContain( - "https://my-org.sentry.io/settings/billing/overview/?product=seer", + "https://my-org.sentry.io/settings/billing/overview/#open-seer-auto-reload-modal", ); }); - test("format() includes billing URL for daily_cap_exceeded with orgSlug", () => { + test("format() links auto-reload modal with reason for daily_cap_exceeded with orgSlug", () => { const formatted = new SeerError("daily_cap_exceeded", "my-org").format(); expect(formatted).toBe( "Your organization has reached its daily Seer spend limit.\n\n" + "Someone with billing access can raise the limit in Sentry, or you can try again tomorrow:\n" + - " https://my-org.sentry.io/settings/billing/overview/?product=seer", + " https://my-org.sentry.io/settings/billing/overview/#open-seer-auto-reload-modal:daily_cap_exceeded", ); }); From cedc1cd66e7439efa173a039283dca388f09cdcb Mon Sep 17 00:00:00 2001 From: srest2021 Date: Fri, 20 Nov 2026 14:53:31 -0800 Subject: [PATCH 2/5] fix(cli): Only link Seer credit errors to billing on SaaS Billing and the auto-reload modal only exist on SaaS, so self-hosted orgs get the billing advice without a link. --- packages/cli/src/lib/errors.ts | 7 ++++++- packages/cli/test/lib/errors.test.ts | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lib/errors.ts b/packages/cli/src/lib/errors.ts index f4794f6d2e..e2eb33591c 100644 --- a/packages/cli/src/lib/errors.ts +++ b/packages/cli/src/lib/errors.ts @@ -36,6 +36,7 @@ import { buildSeerAutoReloadUrl, buildSeerSettingsUrl, buildSourceCodeIntegrationsUrl, + isSaaS, } from "./sentry-urls.js"; import { getLoginCommand, getUrlLoginCommand, sentry } from "./app-identity.js"; @@ -923,8 +924,12 @@ export class SeerError extends CliError { ? `\n\nStart a free trial:\n ${sentry`trial start seer ${this.orgSlug}`}` : `\n\nYou may be eligible for a free trial:\n ${sentry`trial list`}`; + // Billing only exists on SaaS, so credit errors link to it only there. + const isCreditReason = + this.reason === "out_of_credits" || this.reason === "daily_cap_exceeded"; + // When org slug is known, provide direct URLs to settings - if (this.orgSlug) { + if (this.orgSlug && (!isCreditReason || isSaaS())) { const suggestions: Record = { not_enabled: `To enable Seer:\n ${buildSeerSettingsUrl(this.orgSlug)}${trialHint}`, no_budget: `To use Seer features, upgrade your plan:\n ${buildBillingUrl(this.orgSlug, "seer")}${trialHint}`, diff --git a/packages/cli/test/lib/errors.test.ts b/packages/cli/test/lib/errors.test.ts index 312c66553b..06f36f3225 100644 --- a/packages/cli/test/lib/errors.test.ts +++ b/packages/cli/test/lib/errors.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from "vitest"; +import { withSentryBaseUrl } from "../../src/lib/sentry-urls.js"; import { AbortError, ApiError, @@ -414,6 +415,16 @@ describe("SeerError", () => { ); }); + test("format() skips billing link for daily_cap_exceeded on self-hosted", () => { + const formatted = withSentryBaseUrl("https://sentry.example.com", () => + new SeerError("daily_cap_exceeded", "my-org").format(), + ); + expect(formatted).toBe( + "Your organization has reached its daily Seer spend limit.\n\n" + + "Someone with billing access can raise the limit in your organization's billing settings, or you can try again tomorrow.", + ); + }); + test("format() shows fallback for daily_cap_exceeded without orgSlug", () => { const formatted = new SeerError("daily_cap_exceeded").format(); expect(formatted).toBe( From a1f5ceff1429d76abe6cf7bf81f863c5b376e810 Mon Sep 17 00:00:00 2001 From: srest2021 Date: Fri, 20 Nov 2026 15:11:39 -0800 Subject: [PATCH 3/5] test(cli): Name the self-hosted Seer credit test like the others --- packages/cli/test/lib/errors.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/test/lib/errors.test.ts b/packages/cli/test/lib/errors.test.ts index 06f36f3225..c6ec278cd0 100644 --- a/packages/cli/test/lib/errors.test.ts +++ b/packages/cli/test/lib/errors.test.ts @@ -415,7 +415,7 @@ describe("SeerError", () => { ); }); - test("format() skips billing link for daily_cap_exceeded on self-hosted", () => { + test("format() does not link auto-reload modal for daily_cap_exceeded on self-hosted", () => { const formatted = withSentryBaseUrl("https://sentry.example.com", () => new SeerError("daily_cap_exceeded", "my-org").format(), ); From 2cf801ae0bd3f7d5efc8f51b5ab428c520d179be Mon Sep 17 00:00:00 2001 From: srest2021 Date: Fri, 20 Nov 2026 15:17:11 -0800 Subject: [PATCH 4/5] ref(cli): Name the self-hosted credit error case in SeerError.format --- packages/cli/src/lib/errors.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/lib/errors.ts b/packages/cli/src/lib/errors.ts index e2eb33591c..6181372e7e 100644 --- a/packages/cli/src/lib/errors.ts +++ b/packages/cli/src/lib/errors.ts @@ -924,12 +924,13 @@ export class SeerError extends CliError { ? `\n\nStart a free trial:\n ${sentry`trial start seer ${this.orgSlug}`}` : `\n\nYou may be eligible for a free trial:\n ${sentry`trial list`}`; - // Billing only exists on SaaS, so credit errors link to it only there. - const isCreditReason = - this.reason === "out_of_credits" || this.reason === "daily_cap_exceeded"; + const isSelfHostedCreditError = + (this.reason === "out_of_credits" || + this.reason === "daily_cap_exceeded") && + !isSaaS(); // When org slug is known, provide direct URLs to settings - if (this.orgSlug && (!isCreditReason || isSaaS())) { + if (this.orgSlug && !isSelfHostedCreditError) { const suggestions: Record = { not_enabled: `To enable Seer:\n ${buildSeerSettingsUrl(this.orgSlug)}${trialHint}`, no_budget: `To use Seer features, upgrade your plan:\n ${buildBillingUrl(this.orgSlug, "seer")}${trialHint}`, From aa71df2a333339867ca74bc116ffc0f5b336212e Mon Sep 17 00:00:00 2001 From: srest2021 Date: Fri, 20 Nov 2026 15:21:15 -0800 Subject: [PATCH 5/5] ref(cli): Drop the self-hosted check from Seer credit errors Credit checks only deny orgs with token-billed Seer, which self-hosted doesn't have, so the check never applied. --- packages/cli/src/lib/errors.ts | 8 +------- packages/cli/test/lib/errors.test.ts | 11 ----------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/packages/cli/src/lib/errors.ts b/packages/cli/src/lib/errors.ts index 6181372e7e..f4794f6d2e 100644 --- a/packages/cli/src/lib/errors.ts +++ b/packages/cli/src/lib/errors.ts @@ -36,7 +36,6 @@ import { buildSeerAutoReloadUrl, buildSeerSettingsUrl, buildSourceCodeIntegrationsUrl, - isSaaS, } from "./sentry-urls.js"; import { getLoginCommand, getUrlLoginCommand, sentry } from "./app-identity.js"; @@ -924,13 +923,8 @@ export class SeerError extends CliError { ? `\n\nStart a free trial:\n ${sentry`trial start seer ${this.orgSlug}`}` : `\n\nYou may be eligible for a free trial:\n ${sentry`trial list`}`; - const isSelfHostedCreditError = - (this.reason === "out_of_credits" || - this.reason === "daily_cap_exceeded") && - !isSaaS(); - // When org slug is known, provide direct URLs to settings - if (this.orgSlug && !isSelfHostedCreditError) { + if (this.orgSlug) { const suggestions: Record = { not_enabled: `To enable Seer:\n ${buildSeerSettingsUrl(this.orgSlug)}${trialHint}`, no_budget: `To use Seer features, upgrade your plan:\n ${buildBillingUrl(this.orgSlug, "seer")}${trialHint}`, diff --git a/packages/cli/test/lib/errors.test.ts b/packages/cli/test/lib/errors.test.ts index c6ec278cd0..312c66553b 100644 --- a/packages/cli/test/lib/errors.test.ts +++ b/packages/cli/test/lib/errors.test.ts @@ -1,5 +1,4 @@ import { describe, expect, test } from "vitest"; -import { withSentryBaseUrl } from "../../src/lib/sentry-urls.js"; import { AbortError, ApiError, @@ -415,16 +414,6 @@ describe("SeerError", () => { ); }); - test("format() does not link auto-reload modal for daily_cap_exceeded on self-hosted", () => { - const formatted = withSentryBaseUrl("https://sentry.example.com", () => - new SeerError("daily_cap_exceeded", "my-org").format(), - ); - expect(formatted).toBe( - "Your organization has reached its daily Seer spend limit.\n\n" + - "Someone with billing access can raise the limit in your organization's billing settings, or you can try again tomorrow.", - ); - }); - test("format() shows fallback for daily_cap_exceeded without orgSlug", () => { const formatted = new SeerError("daily_cap_exceeded").format(); expect(formatted).toBe(