Skip to content

feat(cli): Tell users when Seer is out of credits - #2150

Merged
BYK merged 3 commits into
mainfrom
jaygoss/cw-3075-cli-gating-recognize-402
Nov 11, 2026
Merged

BYK merged 3 commits into
mainfrom
jaygoss/cw-3075-cli-gating-recognize-402

Conversation

@jaydgoss

@jaydgoss jaydgoss commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

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 feat(seer-billing): Handle SeerOutOfCreditsException at Autofix callers 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

issue explain and issue plan now say the organization is out of Seer credits
when Sentry answers 402 with code seer_out_of_credits, or when a run stops
with failure_reason out_of_credits. Before, the 402 read as "Seer requires a
paid plan" with a free trial offer, and a stopped run read as an analysis
with no results.

Fixes CW-3075
@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 11, 2026 5:03pm UTC

Request Review

@linear-code

linear-code Bot commented Nov 10, 2026

Copy link
Copy Markdown

CW-3075

Nothing failed if the commands stopped passing the 402 code to the Seer error mapping. issue explain and issue plan now have a test for a 402 with seer_out_of_credits, and the API client test checks the code reaches the ApiError.

The trial tests mock isatty, so they can assert that no_budget and not_enabled offer a trial in a terminal and out_of_credits does not.

Refs CW-3075
The message told users to turn on auto-reload. An org with auto-reload on can still run out once it hits its daily usage limit, and Sentry does not say which case applies. The advice now covers both.

Refs CW-3075
@jaydgoss
jaydgoss marked this pull request as ready for review November 11, 2026 17:07
@jaydgoss
jaydgoss requested a review from srest2021 November 11, 2026 17:07
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 11, 2026
sentry-junior Bot added a commit that referenced this pull request 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>
@BYK
BYK merged commit c290a10 into main Nov 11, 2026
28 checks passed
@BYK
BYK deleted the jaygoss/cw-3075-cli-gating-recognize-402 branch November 11, 2026 17:50
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 previously deployed

1 inactive deployment
Preview — 154bac72 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants