Skip to content

Commit 5ee1dff

Browse files
committed
fix message copies
1 parent 1002311 commit 5ee1dff

3 files changed

Lines changed: 54 additions & 12 deletions

File tree

‎packages/mcp-core/src/internal/formatting.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import {
4747
getAutofixArtifactSummaries,
4848
getStatusDisplayName,
4949
isTerminalStatus,
50-
SEER_OUT_OF_CREDITS_MESSAGE,
50+
SEER_CONTINUE_OUT_OF_CREDITS_MESSAGE,
5151
} from "./tool-helpers/seer";
5252
import { formatToolCallInstruction } from "./tool-helpers/tool-call-formatting";
5353
import { isPlainObject } from "./type-guards";
@@ -2202,7 +2202,7 @@ function formatSeerSummary(autofixState: AutofixRunState | undefined): string {
22022202
parts.push("");
22032203
parts.push("**Status:** Analysis failed.");
22042204
if (autofix.failure_reason === "out_of_credits") {
2205-
parts.push(SEER_OUT_OF_CREDITS_MESSAGE);
2205+
parts.push(SEER_CONTINUE_OUT_OF_CREDITS_MESSAGE);
22062206
}
22072207
} else if (autofix.status === "awaiting_user_input") {
22082208
parts.push("");

‎packages/mcp-core/src/internal/tool-helpers/seer.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,25 @@ export function getHumanInterventionGuidance(status: string): string {
8686
return "";
8787
}
8888

89-
export const SEER_OUT_OF_CREDITS_MESSAGE =
90-
"Your organization does not have enough Seer credits. Someone with billing access can turn on auto-reload in Sentry.";
89+
export const SEER_START_OUT_OF_CREDITS_MESSAGE =
90+
"Your organization does not have enough credits to start an Autofix run. Someone with billing access can turn on auto-reload in Sentry.";
91+
92+
export const SEER_CONTINUE_OUT_OF_CREDITS_MESSAGE =
93+
"Your organization does not have enough credits to continue your Autofix run. Someone with billing access can turn on auto-reload in Sentry.";
94+
95+
const SEER_NO_QUOTA_MESSAGE =
96+
"Your organization does not have enough Seer quota to start an Autofix run.";
9197

9298
/**
93-
* Explain a 402 from starting a run. Sentry sends the credits 402 as
94-
* `{ detail }`. The quota 402 is a bare string the API client can't parse,
95-
* so it gets the fallback.
99+
* Explain a 402 from starting a run. Sentry sends the out-of-credits 402 as
100+
* `{ detail }` and the out-of-quota 402 as a bare string, which the API client
101+
* can't parse.
96102
*/
97103
export function getSeerPaymentRequiredMessage(responseBody: unknown): string {
98104
if (isPlainObject(responseBody) && typeof responseBody.detail === "string") {
99-
return responseBody.detail;
105+
return SEER_START_OUT_OF_CREDITS_MESSAGE;
100106
}
101-
return "Your organization does not have enough Seer budget to start an analysis.";
107+
return SEER_NO_QUOTA_MESSAGE;
102108
}
103109

104110
/**
@@ -108,7 +114,7 @@ export function getFailureReasonGuidance(
108114
failureReason: string | null | undefined,
109115
): string {
110116
if (failureReason === "out_of_credits") {
111-
return `\n${SEER_OUT_OF_CREDITS_MESSAGE}\n`;
117+
return `\n${SEER_CONTINUE_OUT_OF_CREDITS_MESSAGE}\n`;
112118
}
113119
return "";
114120
}

‎packages/mcp-core/src/tools/catalog/analyze-issue-with-seer.test.ts‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,12 @@ describe("analyze_issue_with_seer", () => {
446446
detail:
447447
"Your organization does not have enough credits to start an Autofix run.",
448448
},
449-
"Your organization does not have enough credits to start an Autofix run.",
449+
"Your organization does not have enough credits to start an Autofix run. Someone with billing access can turn on auto-reload in Sentry.",
450450
],
451451
[
452452
"out of quota",
453453
"No budget for Seer Autofix.",
454-
"Your organization does not have enough Seer budget to start an analysis.",
454+
"Your organization does not have enough Seer quota to start an Autofix run.",
455455
],
456456
])(
457457
"explains why the run did not start when Sentry answers 402 (%s)",
@@ -494,6 +494,42 @@ describe("analyze_issue_with_seer", () => {
494494
},
495495
);
496496

497+
it("explains a run that stopped because the org ran out of credits", async () => {
498+
mswServer.use(
499+
http.get(
500+
"https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/CLOUDFLARE-MCP-CREDITS/autofix/",
501+
() =>
502+
HttpResponse.json({
503+
autofix: {
504+
run_id: 456,
505+
status: "error",
506+
failure_reason: "out_of_credits",
507+
blocks: [],
508+
},
509+
}),
510+
),
511+
);
512+
513+
const result = await analyzeIssueWithSeer.handler(
514+
{
515+
organizationSlug: "sentry-mcp-evals",
516+
regionUrl: null,
517+
issueId: "CLOUDFLARE-MCP-CREDITS",
518+
instruction: undefined,
519+
},
520+
{
521+
constraints: { organizationSlug: undefined },
522+
accessToken: "access-token",
523+
userId: "1",
524+
},
525+
);
526+
527+
expect(result).toContain("## Analysis Failed");
528+
expect(result).toContain(
529+
"Your organization does not have enough credits to continue your Autofix run. Someone with billing access can turn on auto-reload in Sentry.",
530+
);
531+
});
532+
497533
it("returns unsupported message for metric issues without calling Seer", async () => {
498534
let autofixRequests = 0;
499535

0 commit comments

Comments
 (0)