Skip to content

fix: resolve 3 bugs — missing issue stats, seer polling timeout, no-solution reason#973

Draft
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/sentry-cli-issues-da8d
Draft

fix: resolve 3 bugs — missing issue stats, seer polling timeout, no-solution reason#973
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/sentry-cli-issues-da8d

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 18, 2026

Summary

This PR fixes three bugs discovered through code analysis:


1. issue list omits count, userCount, firstSeen, lastSeen (fixes #969)

Root cause: buildIssueListCollapse() always included "lifetime" in the collapse array, telling the Sentry API to skip computing lifetime aggregate counts on the list endpoint.

Reproduction: sentry issue list my-org/ --json --fields count,firstSeen,lastSeen,userCount — all four fields are missing from output. Human table shows EVENTS: ? and SEEN: —.

Fix: Remove "lifetime" from buildIssueListCollapse(). The CLI needs these fields for table columns (EVENTS, USERS, AGE) and JSON output.


2. Seer polling spins to timeout when API returns "canceled" (US spelling)

Root cause: normalizeAgentStatus() falls through to status.toUpperCase() for unmapped values. When the Seer API returns "canceled" (US spelling), it becomes "CANCELED" — but TERMINAL_STATUSES uses "CANCELLED" (British). isTerminalStatus("CANCELED") returns false, so polling never terminates.

Reproduction: Any sentry issue explain or sentry issue plan call where the autofix run is cancelled — the CLI waits 6 minutes before timing out.

Fix: Add explicit mappings for "canceled"/"cancelled""CANCELLED" and "need_more_information""NEED_MORE_INFORMATION".


3. extractNoSolutionReason misses step-level description (partial fix for #958)

Root cause: The Seer API now returns solution data directly on steps (step.solution[] / step.description) rather than inside step.artifacts[]. While extractSolution was already updated for this, extractNoSolutionReason still only searched artifacts — always finding nothing on the new API format.

Reproduction: sentry issue plan on an issue where Seer cannot produce a fix → shows generic "No solution found" instead of the actual reason from the API.

Fix: Add searchContainersForStepLevelNoSolutionReason() that checks steps with key === "solution" and empty/missing solution array, returning their description field as the reason. Step-level is checked first (new API), artifact-level as fallback (legacy).

Open in Web View Automation 

cursoragent and others added 4 commits May 18, 2026 12:13
…rstSeen are returned (#969)

The buildIssueListCollapse function always included 'lifetime' in the
collapse array, which tells the Sentry API to skip computing aggregate
counts (count, userCount, firstSeen). This caused these fields to be
missing from both human table output (showing '?' for EVENTS) and JSON
output (omitting the fields entirely).

Remove 'lifetime' from the collapse array since the CLI uses these
fields in table rendering (EVENTS, USERS, AGE columns) and documents
them as available JSON fields.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
…nite polling

The normalizeAgentStatus function uses a fallback of status.toUpperCase()
for unmapped statuses. When the Seer API returns 'canceled' (US spelling),
it becomes 'CANCELED' which doesn't match TERMINAL_STATUSES ('CANCELLED'
with British spelling). This causes shouldStopPolling to never return true,
making the poll loop spin until the 6-minute timeout.

Add explicit mappings for 'canceled'/'cancelled' → 'CANCELLED' and
'need_more_information' → 'NEED_MORE_INFORMATION' to ensure all known
status values are correctly normalized.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
The Seer API returns solution data directly on steps with key='solution'
rather than inside the artifacts array (which is always empty on the
new API). extractNoSolutionReason only searched artifacts, so when Seer
couldn't produce a solution, the description explaining why was missed
and users got a generic 'No solution found' message.

Add searchContainersForStepLevelNoSolutionReason that checks for steps
where key='solution' with an empty/missing solution array and returns
the description field. Step-level reasons are preferred over artifact-
level (legacy fallback).

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-05-18 12:20 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

6981 passed | Total: 6981 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +12
Passed Tests 📈 +12
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 91.11%. Project has 14124 uncovered lines.
✅ Project coverage is 77.1%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/types/seer.ts 89.74% ⚠️ 4 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    77.09%    77.10%    +0.01%
==========================================
  Files          320       320         —
  Lines        61568     61685      +117
  Branches         0         0         —
==========================================
+ Hits         47465     47561       +96
- Misses       14103     14124       +21
- Partials         0         0         —

Generated by Codecov Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sentry issue list --json --fields omits count, firstSeen, lastSeen, userCount (missing expand=stats)

1 participant