Repository navigation
feat(seer-billing): Show out-of-credits Seer failures in MCP - #2031
Merged
Merged
Conversation
analyze_issue_with_seer checks the organization's Seer credits before starting a run, and tells the user when a run stopped because the organization ran out of credits. get_issue_details shows the same reason. A failed credit check never blocks a run. Refs CW-2330
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
srest2021
marked this pull request as ready for review
November 5, 2026 22:05
Say auto-reload, which is what the billing settings call it, and point to someone with billing access, since MCP users can have any role. Refs CW-2330
joseph-sentry
approved these changes
Nov 6, 2026
Sentry checks Seer credits when analyze_issue_with_seer starts a run and answers 402 if there aren't enough, so the extra credit-check request isn't needed. The tool now turns a 402 from starting a run into an "Analysis Not Started" message instead of an error. Refs CW-2330 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
srest2021
commented
Nov 10, 2026
Sentry now tags billing 402s with seer_out_of_credits or seer_out_of_quota. Branch on the code instead of the body shape. A 402 without the out-of-credits code, including the bare string older Sentry versions send, still reads as out of quota. Co-Authored-By: Sofia Rest <sofia.rest@sentry.io>
jaydgoss
reviewed
Nov 11, 2026
|
|
||
| if (existingStatus !== "completed") { | ||
| output += `\n**Status**: ${existingStatus}\n`; | ||
| output += getFailureReasonGuidance( |
Member
There was a problem hiding this comment.
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.
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
jaydgoss
reviewed
Nov 11, 2026
A 402 doesn't say whether auto-reload is off or the Seer spend limit was hit, so "turn on auto-reload" is wrong when it's already on. Use the same "adjust Seer spend and auto-reload" copy as #2150. Co-Authored-By: Sofia Rest <sofia.rest@sentry.io>
Co-Authored-By: Sofia Rest <sofia.rest@sentry.io>
sentry-junior
Bot
force-pushed
the
srest2021/CW-2330
branch
from
November 11, 2026 17:43
a697e12 to
1fe7ba4
Compare
sentry-junior
Bot
force-pushed
the
srest2021/CW-2330
branch
from
November 11, 2026 17:45
1fe7ba4 to
a697e12
Compare
BYK
pushed a commit
that referenced
this pull request
Nov 11, 2026
`sentry issue explain` and `sentry issue plan` treat every 402 from the autofix endpoint as "Seer requires a paid plan" and offer a free trial. An org on token-based billing that runs out of Seer credits gets that message too. A run that starts and then stops for credits reads as "Analysis completed but no root causes found" or "Plan creation failed". - A 402 with `code: "seer_out_of_credits"` (added in getsentry/sentry#130284) now raises a new `out_of_credits` Seer error. Any other 402, including `seer_out_of_quota` and the 402 with no code that older Sentry versions send, keeps the current no-budget error. - A run that ends with `failure_reason: "out_of_credits"` raises the same error from both commands. - The error has its own exit code, 43, and is left out of the free trial prompt. What the user sees: ``` Your organization is out of Seer credits. Someone with billing access can adjust Seer spend and auto-reload in Sentry: https://my-org.sentry.io/settings/billing/overview/?product=seer ``` A failed run is still retried on the next invocation, so someone who topped up recovers by running the command again. The 402 comes from getsentry/sentry#130283 and getsentry/sentry#130284, which have both merged. Sentry's credit checks are behind the `organizations:seer-credit-checks` flag, so for an org without it the CLI behaves as it does today. The MCP equivalent is #2031. Fixes CW-3075
srest2021
enabled auto-merge (squash)
November 11, 2026 17:52
vaind
added a commit
that referenced
this pull request
Nov 13, 2026
Fixes CW-3094 `analyze_issue_with_seer` returns an issue's existing run as soon as it has finished, and that includes failed runs. A run that stopped because the org ran out of Seer credits keeps coming back as the result, so it can't be retried after someone tops up. Follow-up to #2031, from [this review thread](#2031 (comment)). The tool now starts a new run whenever the last one ended in `error`, whatever the reason, matching the CLI (#2150). Completed and waiting-for-input runs are still returned as they are. If the org is still out of credits, the new start gets a 402, which the tool already explains as "Analysis Not Started". It now also shows whatever the failed run found before it stopped, such as a root cause. Tested manually against sentry.io with the local stdio server. On an issue whose last run had failed, the tool started a new run and returned its root cause, and the issue's latest run is now the completed one. The 402 path is covered only by unit tests, since it needs an org that's out of credits. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes CW-2330
Depends on getsentry/sentry#130284
analyze_issue_with_seernow says why a run didn't start when Sentry answers 402, for out-of-credits and out-of-quota orgs, instead of returning an API error. It tells the two apart bycode. A 402 without the out-of-credits code, including the bare-string out-of-quota body that Sentry sends before #130284, still reads as out of quota.When a run stopped because the org ran out of credits (
failure_reason=out_of_credits), the tool andget_issue_detailsnow say why.Until the Sentry PRs ship, a run that runs out of credits still starts and then stops with
out_of_credits, which this PR already explains. Both Sentry checks are behindorganizations:seer-credit-checks.