Skip to content

fix(scanners): settle orphaned season requests in the Sonarr orphan pass - #3606

Open
fallenbagel wants to merge 1 commit into
fix/sonarr-orphan-tmdb-gatefrom
fix/orphaned-season-requests
Open

fallenbagel wants to merge 1 commit into
fix/sonarr-orphan-tmdb-gatefrom
fix/orphaned-season-requests

Conversation

@fallenbagel

@fallenbagel fallenbagel commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Description

The Sonarr orphan cleanup only looks at shows whose own status is PROCESSING. A show with one season available and another requested and still downloading rolls up to partially available, so when its series is removed from Sonarr the requested season stays PROCESSING and its request stays approved. Both block that season from being requested again, and nothing ever resolves them. Availability sync reaches the same state from the other side. When a show's series is gone from Sonarr and the show is missing from the media server, it marks the show deleted but leaves a requested season PROCESSING, and the cleanup skips deleted shows too. A media server scan can also reset the requested season to UNKNOWN first, leaving only the approved request behind.

The cleanup now also picks up shows with a PROCESSING season or an approved request for that quality, once the series is confirmed missing from every Sonarr server as before. Their PROCESSING seasons are reset, and the show status is rolled up from its seasons instead of being forced to UNKNOWN, so a show that still has an available season ends up partially available. Their requests are settled the same way #3579 settles abandoned seasons at the end of a run. Abandoned seasons are removed from the request, a request whose remaining seasons are all delivered is completed, and one with nothing left is declined.

Note

Rolling the show up needs its season list, so a show whose lookup fails is left for the next scan rather than reset.

How Has This Been Tested?

  • Sonarr orphaned seasons: a deleted show with a PROCESSING season and an approved request has the season reset and the request declined while staying deleted, the same for 4K, and the same with no request. A request for a season a media server scan already reset is declined while the show stays partially available, and a partly delivered request is completed.
  • Sonarr orphan cleanup: a PROCESSING show with an available season now rolls up to partially available instead of UNKNOWN. The other orphan cleanup tests pass unchanged.

Screenshots / Logs (if applicable)

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Stack created with GitHub Stacks CLI • Give Feedback 💬

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of shows and seasons that are no longer available in Sonarr. Processing statuses are reset, and request outcomes are updated based on the remaining season status.
    • Orphaned-season cleanup now applies to both standard and 4K media, while preserving the status of other seasons.
    • When a show has no seasons remaining in an abandoned state, its request can be declined with an appropriate reason.

@fallenbagel
fallenbagel requested a review from a team as a code owner October 10, 2026 04:38
@fallenbagel
fallenbagel added this pull request to stack #3580 October 10, 2026 04:38
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2f965f07-b266-42d0-acc2-a496f079c9f7
Commits

Reviewing files that changed from the base of the PR and between ae2a878 and 94e1cf3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e475543c-f805-4291-9349-290bbe958447
📥 Commits

Reviewing files that changed from the base of the PR and between 15ecf91 and ae2a878.

📒 Files selected for processing (3)
  • server/lib/scanners/baseScanner.ts
  • server/lib/scanners/sonarr/index.ts
  • server/lib/scanners/sonarr/sonarr.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Walkthrough

Walkthrough

Sonarr orphan cleanup now retrieves season metadata before resolving status resets. It updates show and season statuses for standard and 4K media, and handles requests for seasons that leave Sonarr.

Changes

Sonarr orphan cleanup

Layer / File(s) Summary
Season reset reason and resolution
server/lib/scanners/baseScanner.ts
Season-reset candidates can carry an orphan reason. Resolution skips the abandonment check for these candidates and uses the reason when declining requests. rollUpShowStatus and recordSeasonReset are now protected.
Metadata lookup and per-show cleanup
server/lib/scanners/sonarr/index.ts
Metadata-provider selection is shared by scanned and orphaned shows. Orphan cleanup retrieves seasons, updates processing statuses, rolls up and saves show status, and records resets for abandoned seasons.
Candidate selection and scan integration
server/lib/scanners/sonarr/index.ts, server/lib/scanners/sonarr/sonarr.test.ts
Standard and 4K cleanup select shows with processing statuses or approved requests, then pass shows absent from Sonarr to shared cleanup. Tests cover standard and 4K resets, retained show statuses, and request outcomes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: Minimal · previous review ae2a8

This change settles orphaned season requests when Sonarr drops a series, so those seasons can be requested again. No merge-blocking risk is evident from the supplied review.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: settling orphaned season requests during the Sonarr orphan cleanup pass.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the seasons’ trail
And notes which shows have left the vale
The statuses settle, neat and clear
Requests find their endings here
Four-kay paths get the same review
Then hops away beneath the moonlit blue

@fallenbagel
fallenbagel force-pushed the fix/orphaned-season-requests branch from 12e1712 to ae2a878 Compare October 10, 2026 04:41
@fallenbagel fallenbagel added this to the v3.5.1 milestone Oct 10, 2026
@fallenbagel fallenbagel modified the milestones: v3.5.1, v3.5.2 Oct 21, 2026
@fallenbagel fallenbagel modified the milestones: v3.5.2, v3.5.3 Nov 1, 2026
The orphan cleanup only checked shows whose own status was PROCESSING, so a deleted or partially available show kept a PROCESSING season and an APPROVED request forever once its series left Sonarr, blocking that season from being requested again. Those shows are now cleaned up too, with the show status rolled up from its seasons and each request settled per season as at end of run.
@fallenbagel
fallenbagel force-pushed the fix/orphaned-season-requests branch from ae2a878 to 94e1cf3 Compare November 1, 2026 20:39
@cypress

cypress Bot commented Nov 1, 2026

Copy link
Copy Markdown

seerr    Run #3877

Run Properties:  status check passed Passed #3877  •  git commit 94e1cf3896: fix(scanners): settle orphaned season requests in the Sonarr orphan pass
Project seerr
Branch Review fix/orphaned-season-requests
Run status status check passed Passed #3877
Run duration 02m 21s
Commit git commit 94e1cf3896: fix(scanners): settle orphaned season requests in the Sonarr orphan pass
Committer fallenbagel
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 33
View all changes introduced in this branch ↗︎

@fallenbagel fallenbagel modified the milestone: v3.5.3 Nov 12, 2026

This branch has not been deployed

No deployments
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.

1 participant