Repository navigation
feat(seer-billing): Show out-of-credits Seer failures in MCP #2031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d6462bc
42b1ecf
1002311
5ee1dff
b7c81a6
d40da01
a697e12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,10 @@ import { | |
| } from "../../internal/tool-helpers/issue"; | ||
| import { | ||
| getActiveAutofixTodo, | ||
| getFailureReasonGuidance, | ||
| getHumanInterventionGuidance, | ||
| getOutputForAutofixRun, | ||
| getSeerPaymentRequiredMessage, | ||
| getSeerUnsupportedIssueMessage, | ||
| getStatusDisplayName, | ||
| isSeerSupportedIssue, | ||
|
|
@@ -141,12 +143,23 @@ export default defineTool({ | |
|
|
||
| // Step 2: Start analysis if none exists | ||
| if (!autofixState.autofix) { | ||
| let startResult: Awaited<ReturnType<typeof apiService.startAutofix>>; | ||
| try { | ||
| startResult = await apiService.startAutofix({ | ||
| organizationSlug: orgSlug, | ||
| issueId: parsedIssueId, | ||
| instruction: params.instruction, | ||
| }); | ||
| } catch (error) { | ||
| // Sentry answers 402 before starting a run when the org is out of | ||
| // Seer credits or quota. | ||
| if (error instanceof ApiError && error.status === 402) { | ||
| output += `## Analysis Not Started\n\n${getSeerPaymentRequiredMessage(error.responseBody)}\n`; | ||
| return output; | ||
| } | ||
| throw error; | ||
| } | ||
| output += `Starting new analysis...\n\n`; | ||
| const startResult = await apiService.startAutofix({ | ||
| organizationSlug: orgSlug, | ||
| issueId: parsedIssueId, | ||
| instruction: params.instruction, | ||
| }); | ||
| output += `Analysis started with Run ID: ${startResult.run_id}\n\n`; | ||
|
|
||
| // Give it a moment to initialize | ||
|
|
@@ -182,6 +195,9 @@ export default defineTool({ | |
|
|
||
| if (existingStatus !== "completed") { | ||
| output += `\n**Status**: ${existingStatus}\n`; | ||
| output += getFailureReasonGuidance( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This keeps returning the old out-of-credits run even after the org tops up, since we only start a new run when none exists. The CLI (#2150) starts a new run when the last one errored. Worth doing the same here? Fine as a follow-up.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah I noticed that too, we can definitely do a followup 👍 Added a ticket to track it here https://linear.app/getsentry/issue/CW-3094/mcp-restart-a-run-when-the-last-one-failed |
||
| autofixState.autofix.failure_reason, | ||
| ); | ||
| output += getHumanInterventionGuidance(existingStatus); | ||
| output += "\n"; | ||
| } | ||
|
|
@@ -215,6 +231,9 @@ export default defineTool({ | |
|
|
||
| if (status !== "completed") { | ||
| output += `\n**Status**: ${status}\n`; | ||
| output += getFailureReasonGuidance( | ||
| autofixState.autofix.failure_reason, | ||
| ); | ||
| output += getHumanInterventionGuidance(status); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.