Skip to content

fix(seer): Read sentry_run_id instead of the deprecated run_id#1224

Open
trevor-e wants to merge 5 commits into
mainfrom
fix/seer-sentry-run-id
Open

fix(seer): Read sentry_run_id instead of the deprecated run_id#1224
trevor-e wants to merge 5 commits into
mainfrom
fix/seer-sentry-run-id

Conversation

@trevor-e

@trevor-e trevor-e commented Jul 10, 2026

Copy link
Copy Markdown
Member

The autofix API is migrating run identifiers from a legacy numeric run_id to a UUID sentry_run_id, and the numeric field is slated for eventual removal. The CLI read run_id directly off autofix state and forwarded it when continuing a run, which would silently break once that field disappears from responses.

Added requireAutofixRunId() to prefer sentry_run_id, falling back to run_id for older responses, and used it everywhere the CLI reads a run identifier (issue plan's output and its continue-run call). The API dual-writes both fields on every non-null autofix state, so a missing run ID is a malformed response, not a legitimate in-progress state — the helper throws in that case rather than letting undefined flow into the CLI's JSON output.

The continue-run request sends the ID under whichever body field matches its type: sentry_run_id (a UUID field) or run_id (an integer field). The server validates these as two distinct, differently-typed fields, so a UUID sent under run_id would be rejected outright.

Verified against the live API: GET/POST responses return both fields as expected (int run_id, UUID sentry_run_id), and a real continue-run POST with a UUID under sentry_run_id returns 202.

The autofix API is migrating run identifiers from a legacy numeric run_id
to a UUID sentry_run_id, and will eventually drop run_id entirely. The CLI
was reading run_id directly off autofix state and forwarding it to the
continue-run endpoint, which would silently break once the numeric field
disappears.

Add getAutofixRunId() to prefer sentry_run_id (falling back to run_id for
older responses), and use it everywhere the CLI reads a run identifier.
The continue-run request now sends the ID under whichever body field
matches its type — sentry_run_id (UUID field) or run_id (integer field) —
since the server validates them as distinct, differently-typed fields and
a UUID under run_id would be rejected.

Verified against the live API: GET/POST responses return both fields as
documented, and a real continue-run POST with a UUID sentry_run_id returns
202.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1224/

Built to branch gh-pages at 2026-07-10 22:29 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 85.71%. Project has 5333 uncovered lines.
✅ Project coverage is 81.83%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/commands/issue/plan.ts 0.00% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.81%    81.83%    +0.02%
==========================================
  Files          423       423         —
  Lines        29343     29348        +5
  Branches     19118     19124        +6
==========================================
+ Hits         24006     24015        +9
- Misses        5337      5333        -4
- Partials      1989      1987        -2

Generated by Codecov Action

trevor-e and others added 4 commits July 10, 2026 17:46
getAutofixRunId returned undefined when neither run_id nor sentry_run_id
was present, and issue plan's buildPlanData let that flow straight into
the CLI's JSON output as run_id: undefined. The API dual-writes both
fields on every non-null autofix state, so a missing run ID there is a
malformed response, not a legitimate in-progress state — it shouldn't be
passed through silently.

Renamed to requireAutofixRunId and made it throw, so both call sites
(the plan output and the continue-run request) treat a missing run ID
as the same invariant violation instead of one silently swallowing it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
triggerRootCauseAnalysis only ever kicks off a brand-new run, so
sentry_run_id can't be null for the legacy-run reason that applies to
the GET/continue-run paths. Drop the misleading claim.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Cut prose that restated what the code/types already say, keeping only
the parts that explain non-obvious server behavior (why run_id vs
sentry_run_id must go under different body keys, why a missing run ID
means malformed state).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The comment claimed sentry_run_id is always present, but it's null for
legacy runs too — the real guarantee is that at least one of the two
fields is present. Also drop the 'check the issue in Sentry web UI'
hint from the error: this only fires on a malformed API response, and
there's nothing to see in the web UI that explains a missing run ID.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@trevor-e trevor-e marked this pull request as ready for review July 10, 2026 22:32
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 10, 2026
@trevor-e trevor-e requested a review from betegon July 10, 2026 22:45
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.

1 participant