Skip to content

fix(plan): surface context when Seer produces no solution#953

Merged
MathurAditya724 merged 8 commits into
mainfrom
issue-951-plan-no-solution-context
May 12, 2026
Merged

fix(plan): surface context when Seer produces no solution#953
MathurAditya724 merged 8 commits into
mainfrom
issue-951-plan-no-solution-context

Conversation

@MathurAditya724
Copy link
Copy Markdown
Member

When sentry issue plan completes but Seer can't produce a code fix, the output now shows:

  • The reason from the API (when available), e.g. "root cause is infrastructure-level"
  • The root cause description that was analyzed
  • The files Seer examined during analysis

Previously it just said "No solution found. Check the Sentry web UI for details."

Testing

bun test test/types/seer.test.ts — 22 tests pass (10 new for extractNoSolutionReason and extractExaminedFiles).

Closes #951

When `sentry issue plan` completes but Seer can't produce a code fix,
show the reason (from the API artifact), the root cause that was
analyzed, and the files Seer examined — instead of the bare
"No solution found" message.

Fixes #951
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

PR Preview Action v1.8.1

QR code for preview link

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

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

Codecov Results 📊

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

📊 Comparison with Base Branch

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

All tests are passing successfully.

❌ Patch coverage is 55.45%. Project has 14077 uncovered lines.
❌ Project coverage is 76.99%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
src/commands/issue/plan.ts 1.30% ⚠️ 76 Missing
src/types/seer.ts 85.12% ⚠️ 18 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    77.05%    76.99%    -0.06%
==========================================
  Files          319       319         —
  Lines        60944     61166      +222
  Branches         0         0         —
==========================================
+ Hits         46953     47089      +136
- Misses       13991     14077       +86
- Partials         0         0         —

Generated by Codecov Action

@MathurAditya724
Copy link
Copy Markdown
Member Author

fix-ci: attempt 1 — lint failures: cognitive complexity in buildPlanData, return undefined in seer.ts, and formatting in the test file. straightforward fixes.

Extract buildNoSolutionContext helper to reduce cognitive complexity
of buildPlanData below the 15-point threshold. Replace return undefined
with bare return, and fix formatting in test file.
@MathurAditya724 MathurAditya724 marked this pull request as ready for review May 12, 2026 03:50
@MathurAditya724
Copy link
Copy Markdown
Member Author

All CI checks green, self-review clean — marked ready for review.

Changes: when sentry issue plan finishes but Seer can't produce a code fix, the output now includes the API's reason string, the root cause description analyzed, and which files were examined. The previous bare "No solution found" message is replaced with structured context. --json consumers get the same data in a no_solution_context field (omitted when there's a valid solution).

Move root_cause display inside the no-reason branch to avoid
redundancy when the API already provides an explanation.
The Seer API uses "N/A" as file_path for external/non-code
reproduction steps. Filter these out so only real paths appear.
Comment thread src/commands/issue/plan.ts
extractRootCauses only searched state.steps, missing root causes
returned in the newer blocks API format. Mirrors the pattern already
used by extractSolution and extractNoSolutionReason.
@MathurAditya724
Copy link
Copy Markdown
Member Author

Live testing results

Tested against 3 real issues (DOCS-84Y, CLI-A0, SENTRY-5PE8). The no-solution context now shows root cause description + examined files instead of the bare message.

While testing, discovered a pre-existing issue: extractSolution() searches step.artifacts[] but the API returns solution data directly on the step as step.solution[] + step.description. This means the plan command never extracts a successful solution even when one exists. Filed as #958 — separate from this PR's scope (improving the no-solution message).

…d polling

- extractSolution() now reads step.solution[] + step.description
  (current API shape) with artifact-level as legacy fallback
- triggerSolutionPlanning() sends select_root_cause to /autofix/update/
  with the correct cause_id and stopping_point
- shouldStopPolling() stops on NEED_MORE_INFORMATION (solution ready)
- Plan command passes stopOnWaitingForUser and selectedCause.id

Tested against live API: SENTRY-5K7G (1-step), MCP-SERVER-FTB (2-step),
DOCS-84Y (5-step) all return solutions correctly now.

Fixes #958
@MathurAditya724
Copy link
Copy Markdown
Member Author

fix-ci: attempt 2 — unit test in api-client.seer.test.ts still expects old triggerSolutionPlanning signature and payload shape, updating to match the new 4-arg signature with causeId and the select_root_cause payload

@MathurAditya724 MathurAditya724 merged commit d04f782 into main May 12, 2026
28 checks passed
@MathurAditya724 MathurAditya724 deleted the issue-951-plan-no-solution-context branch May 12, 2026 09:14
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.

plan: "No solution found" gives no context

1 participant