Skip to content

ref(mcp,cli): Take Seer 402/409 codes from @sentry/api - #2243

Open
sentry-junior[bot] wants to merge 1 commit into
mainfrom
feat/seer-codes-from-sentry-api
Open

sentry-junior[bot] wants to merge 1 commit into
mainfrom
feat/seer-codes-from-sentry-api

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2234.

@sentry/api 2.1.0 now includes the 402 and 409 error bodies of the Autofix start endpoint, from getsentry/sentry#131067:

  • AutofixPaymentRequiredResponse: code is seer_out_of_credits or seer_out_of_quota.
  • AutofixConflictResponse: optional code, one of scm_integration_required, repos_not_linked or run_in_flight.

This bumps the catalog from 2.0.0 to 2.1.0 and stops hardcoding those codes.

CLI

  • formatters/seer.ts: OUT_OF_CREDITS_CODE and SETUP_REQUIRED_REASONS become exhaustive Records keyed by the generated code unions. They are PAYMENT_REQUIRED_REASONS and CONFLICT_REASONS, and run_in_flight maps to null.
  • errors.ts: the setup reasons in SeerErrorReason now come from AutofixConflictResponse["code"] via SeerSetupRequiredCode.

MCP

  • tool-helpers/seer.ts: the out-of-credits check and the setup-required code set follow the same pattern.

Why Records: if the schema adds or renames a code, type-checking fails until the code is handled. Removing run_in_flight from the MCP map, for example, gives TS2741: Property 'run_in_flight' is missing.

Behavior: unchanged. seer_out_of_quota is now mapped explicitly, but it lands where it already did: no_budget in the CLI, and the quota message in the MCP. Lookups use Object.hasOwn, so a body whose code happens to be constructor or toString doesn't match a prototype key. New tests cover that.

Pagination tests: the bump also pulls in @sentry/api 2.0.1's fix that keeps per_page the same for every page of a list walk (getsentry/sentry-api-schema#149). Sentry's OffsetPaginator cursor is <page size>:<page>:<is_prev>, so changing per_page partway through a walk dropped rows. Three client.test.ts pagination tests used numeric row-offset cursors and expected page sizes like [100, 100, 5]. They now model OffsetPaginator cursors and expect even pages, [69, 69, 69] for 205 rows and [67, 67, 67] for 201. The listOrganizations test also checks that the returned cursor resumes at the first row not returned (org-205), partway through the last page.

Verification

  • pnpm install --frozen-lockfile passes. The lockfile was edited by hand because the release-age policy flags the old 2.0.0 entries.
  • pnpm run tsc and pnpm run lint pass.
  • mcp-core vitest: 2311 passed. toolkit-core: 138 passed.
  • CLI unit suite (test/lib test/commands test/types test/script): 83 tests fail in this sandbox, and they are the same 83 that fail on main here, compared file by file. CI is the real check.

No UI change.

--

View Session [Sentry]

Bump @sentry/api to 2.1.0, which documents the 402 and 409 error bodies
of the Autofix start endpoint (getsentry/sentry#131067). The CLI and MCP
now key their Seer code maps by the generated AutofixPaymentRequiredResponse
and AutofixConflictResponse types instead of hardcoding the codes. A code
added to or renamed in the schema now fails type-checking until it is
handled. seer_out_of_quota is mapped explicitly; its behavior is unchanged.

@sentry/api 2.0.1 keeps per_page stable across a list walk so Sentry's
OffsetPaginator doesn't drop rows. The listOrganizations/listTeams/
listProjects pagination tests now model OffsetPaginator cursors and check
that the returned cursor resumes at the first row not returned.

Closes #2234

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 13, 2026 4:36pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — e6b9d580 Deployed Nov 13, 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.

Use @sentry/api types for Seer Autofix 402/409 error codes

0 participants