fix: 3 bug fixes — seer root cause extraction, release set-commits masking, issue selector hint#1023
Closed
cursor[bot] wants to merge 3 commits into
Closed
fix: 3 bug fixes — seer root cause extraction, release set-commits masking, issue selector hint#1023cursor[bot] wants to merge 3 commits into
cursor[bot] wants to merge 3 commits into
Conversation
… fallback searchContainersForRootCauses returned early when container.causes was an empty array ([]) because [] is truthy in JavaScript. This prevented fallthrough to the agent artifact format (searchBlocksForAgentRootCause), causing 'no root causes found' errors when the API returned empty legacy causes alongside valid agent root_cause artifacts. Added length check so empty arrays fall through to agent format. Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
…missing repo integration setCommitsDefault() caught any ApiError with status 400 from setCommitsAuto() and treated it as 'no repository integration'. However, setCommitsAuto() internally calls setCommitsWithRefs() which can also return HTTP 400 for unrelated reasons (invalid commit refs, bad release state, etc.). This caused: 1. A false 1-hour negative cache (cacheNoRepoIntegration) 2. Silent fallback to local git history 3. The real API error being hidden from the user Narrowed the catch to only match the specific 'No repository integrations' error message from setCommitsAuto's own check. Unrelated 400 errors now propagate to the user. Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
When @latest or @most_frequent found no unresolved issues, the ResolutionError hint directed users to 'sentry issue list <org>/ -q "is:resolved"'. This was misleading because: 1. The selectors only work on unresolved issues 2. Listing resolved issues doesn't help find the issue they wanted 3. The suggested command can't be combined with the selector Changed the hint to 'sentry issue list <org>/' (no filter) so users see all available issues and can determine what to do next. Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 4275 uncovered lines. Generated by Codecov Action |
Member
BYK
added a commit
that referenced
this pull request
Jun 3, 2026
…1051) ## Summary Consolidates the five open Cursor BugBot PRs (#908, #947, #973, #1023, #1044) into a single, de-duplicated, rebased PR. Each genuinely-needed fix is verified against current `main`; overlapping fixes use the best variant; stale and subjective changes are dropped. ## Why consolidate The five BugBot PRs heavily overlapped and had gone stale (7–113 commits behind `main`): the cache `JSON.parse` guard appeared 3×, the `withTTY` test fix 2×, the pagination guard 3×. Several also failed CI only on unrelated base drift. This PR lands the real fixes once and adds guardrails so the duplication/staleness doesn't recur. ## Fixes included **Cache hardening** (`fix(db)`) — from #908/#947/#1044 - New `safeParseJson()` db helper; used in `getPaginationState()` (with `Array.isArray` validation) and `getCachedDetection()` so corrupt cached JSON is a cache miss, not a crash. - `log.debug()` added to three silent catch blocks in `sentry-client.ts`. **Event pagination** (`fix(events)`) — from #947 - `listIssueEvents` now uses the shared `autoPaginate()` helper and drops `nextCursor` when a page overshoots `limit`, so `-c next` never skips events. Adds a property test for the `autoPaginate` trim-drops-cursor invariant plus a focused overshoot regression test. **Relative time** (`fix(formatters)`) — from #1044 - `formatRelativeTime` clamps `diffMs` to `>= 0` ("0m ago" instead of "-5m ago"). **Seer** (`fix(seer)`) — from #973/#1023, relates to #958 - `normalizeAgentStatus` maps `canceled`/`cancelled` → `CANCELLED` (fixes a polling-timeout bug) and `need_more_information` → `NEED_MORE_INFORMATION`. - `searchContainersForRootCauses` requires `causes.length > 0` so an empty legacy array no longer blocks the agent-artifact fallthrough. - `extractNoSolutionReason` reads the step-level `description` (current API) before the artifact-level `reason` (legacy). **Release set-commits** (`fix(release)`) — from #1023 - Narrow the default-mode 400 fallback to the exact `NO_REPO_INTEGRATIONS_MESSAGE` so unrelated 400s (invalid refs, bad release state) propagate instead of being masked as "no integration". **Test isolation** (`test`) — from #1044/#947 - `withTTY` now saves/restores `NO_COLOR` and `FORCE_COLOR` (CI sets `NO_COLOR=1`). ## Systemic guardrails - `script/check-error-patterns.ts` gains an advisory silent-catch scan (`SENTRY_STRICT_SILENT_CATCH=1` to enforce). - `AGENTS.md` documents automated-fix-PR rules: check existing PRs/issues first, rebase before review, separate correctness from opinion, prefer shared helpers. - Removed a stale, now-unused `biome-ignore` in `formatters/local.ts` that broke repo-wide lint under biome 2.3.8. ## Dropped (intentionally) - **`issue list` "lifetime" collapse removal** (#973) — superseded on `main` by the `shouldCollapseLifetime` param; issue #969 is already closed. - **Issue selector hint `is:resolved` → bare list** (#1023) — subjective UX; `main`'s current behavior is deliberate. ## Follow-up - A scheduled stale-bot to auto-close inactive bot PRs (out of scope here). ## Testing - `pnpm run typecheck` ✓ - `pnpm run lint` ✓ (766 files) - `pnpm run check:errors` ✓ · `pnpm run check:deps` ✓ - `pnpm run test:unit` ✓ (325 files, 7419 passed, 13 skipped) Closes #908, #947, #973, #1023, #1044.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Three independent bug fixes, each in its own commit.
1. fix(seer): extractRootCauses empty causes array blocks agent artifact fallback
Root Cause:
searchContainersForRootCauses()insrc/types/seer.tsreturned early when a legacy container hadcauses: [](empty array), because[]is truthy in JavaScript. This prevented fallthrough to the agent artifact format (searchBlocksForAgentRootCause).Trigger: Seer API returns a block with
key: "root_cause_analysis"andcauses: [](legacy format, empty) alongside agent artifacts withkey: "root_cause"and valid data.issue explainreports "no root causes found" even though agent data exists.Fix: Added
container.causes.length > 0check so empty arrays fall through to the agent artifact format. Added regression test.Related: #958
2. fix(release): set-commits default mode masks unrelated 400 errors as missing repo integration
Root Cause:
setCommitsDefault()insrc/commands/release/set-commits.tscaught anyApiErrorwith status 400 fromsetCommitsAuto()and treated it as "no repository integration". However,setCommitsAuto()internally callssetCommitsWithRefs()which can return HTTP 400 for unrelated reasons (invalid commit refs, bad release state).Trigger: Run
sentry release set-commits <version>(default mode, no flags) when the repo integration exists but the refs are invalid. The real error is silently swallowed, a false 1-hour negative cache is created, and the command falls back to local git.Fix: Narrowed the catch to only match the specific "No repository integrations" error message from
setCommitsAuto's client-side check. Unrelated 400 errors now propagate to the user. Added two regression tests.3. fix(issue): selector error hint suggests misleading is:resolved query
Root Cause: In
resolveSelector()insrc/commands/issue/utils.ts, when@latest/@most_frequentfound no unresolved issues, the error hint directed users tosentry issue list <org>/ -q "is:resolved". This was misleading because the selectors only work on unresolved issues and listing resolved issues doesn't help find the issue the user wanted.Trigger: Run
sentry issue view @latestwhen the organization has no unresolved issues.Fix: Changed the hint to
sentry issue list <org>/(no filter) so users see all available issues. Updated the corresponding test assertion.