Repository navigation
fix(scanners): reconcile orphaned Sonarr season requests - #214
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c842ef3bac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ( | ||
| this.failedShowKeys.has(this.movieStatusKey(candidate.tmdbId, is4k)) || | ||
| [...candidate.tvdbIds].some((tvdbId) => | ||
| this.failedShowTvdbKeys.has(this.movieStatusKey(tvdbId, is4k)) | ||
| ) |
There was a problem hiding this comment.
Skip deferred resets after unresolved cross-ID failures
When two same-quality Sonarr instances carry the same show under different TVDB IDs, one instance can enqueue a reset while the other fails its metadata lookup before resolvedTmdbId is assigned. markShowScanFailed then records only the second TVDB ID, while this guard checks the first ID stored on the candidate, so the reset proceeds and can decline a request even though the failed instance still monitors that season. Treat an unresolved profile scan failure as blocking deferred resets, as orphan cleanup already does.
AGENTS.md reference: AGENTS.md:L75-L77
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91ce0d4ca5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (deferStatusReset) { | ||
| const key = this.movieStatusKey(tmdbId, is4k); | ||
| if (processing) this.processingMovieKeys.add(key); |
There was a problem hiding this comment.
Track processing movies before branching on persistence
- Confidence: high. When the same movie is first discovered on two same-quality Radarr servers, with the first instance monitoring it without a file and a later instance listing it as unmonitored, the first pass creates the
PROCESSINGmedia row but never addsprocessingMovieKeysbecause this bookkeeping is inside theexistingbranch. The later pass queues a deferred reset, which consequently changes the newly discovered movie toUNKNOWNdespite the first instance still monitoring it. Record processing activity for new rows as well as existing rows so the final reconciliation preserves active scans.
AGENTS.md reference: AGENTS.md:L75-L77
Useful? React with 👍 / 👎.
| if (deferStatusReset) { | ||
| if (season.is4kOverride && season.processing) { | ||
| this.processingSeasonKeys.add( | ||
| this.seasonStatusKey(tmdbId, true, season.seasonNumber) | ||
| ); | ||
| } else if (!season.is4kOverride && season.processing) { | ||
| this.processingSeasonKeys.add( | ||
| this.seasonStatusKey(tmdbId, false, season.seasonNumber) | ||
| ); |
There was a problem hiding this comment.
Track processing seasons created during this scan
- Confidence: high. When a series is first discovered on one same-quality Sonarr instance with a monitored, fileless season and is subsequently scanned from another instance where that season is unmonitored, the first pass creates the season as
PROCESSINGbut does not register its processing key because this block only runs forexistingSeason. The second pass then queues the season as stale, and deferred reconciliation resets both the season and potentially the series toUNKNOWNeven though the first Sonarr instance still monitors it. Register processing keys before the existing/new-season split.
AGENTS.md reference: AGENTS.md:L75-L77
Useful? React with 👍 / 👎.
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged. |
# Conflicts: # server/lib/scanners/sonarr/index.ts # server/subscriber/MediaRequestSubscriber.ts # src/components/RequestModal/TvRequestModal.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fafe0b17a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const remainingKnownSeason = media.seasons.some( | ||
| (season) => | ||
| season[statusField] === MediaStatus.PROCESSING || | ||
| season[statusField] === MediaStatus.PARTIALLY_AVAILABLE || | ||
| season[statusField] === MediaStatus.AVAILABLE |
There was a problem hiding this comment.
Exclude specials from the aggregate reset check
When special episodes are enabled and season 0 remains PROCESSING, resetting an unmonitored regular season to UNKNOWN leaves the series aggregate permanently PROCESSING because this predicate counts season 0 as remaining activity. The normal processShow rollup deliberately considers only non-special seasons, so deferred reconciliation should apply the same exclusion; otherwise the request is declined while the series still appears in progress on every subsequent scan. Confidence: high.
AGENTS.md reference: AGENTS.md:L75-L77
Useful? React with 👍 / 👎.
Description
When Sonarr loses a series, SeerrNG now resolves stale work per season for partially available or deleted shows. It settles affected requests when seasons are unmonitored and unavailable, including season rows already marked UNKNOWN by an earlier scan. Completed seasons stay intact, and requests with no active selections can be submitted again. Cleanup leaves state unchanged when metadata lookup or a series scan fails.
This builds on SeerrNG #209 and #213. It adapts the failure cases documented in Seerr PR #3606, which builds on Seerr PR #3579 and the identity guard in Seerr PR #3605. The legacy UNKNOWN rows described in Seerr issue #3576 are also covered through the verified scan path tracked in #3577. Per SeerrNG's contribution guide, this PR targets
main; its history includes the #209 and #213 prerequisite commits.OpenAI Codex assisted with the upstream audit, implementation, conflict resolution, and regression tests. Upstream references are disclosed here, and SeerrNG attribution is preserved.
How Has This Been Tested?
pnpm test:node server/lib/scanners/mediaCleanupBatches.test.ts server/lib/scanners/radarr/radarr.test.ts server/lib/scanners/sonarr/sonarr.test.ts server/test/MediaRequestSubscriber.test.ts— 90 passed, 0 failed, 0 skipped.pnpm test:vitest src/components/RequestModal/TvRequestModal.tree.test.tsx src/components/RequestModal/TvCollectionRequestModal.contract.test.ts src/components/RequestModal/requestTreeData.test.ts src/components/RequestModal/requestAvailability.test.ts— 30 passed.pnpm typecheck:server,pnpm typecheck:client, ESLint, Prettier, andgit diff --check— passed.pnpm release-notes:preview --base origin/main --head HEAD— passed.e284420ee3683dd4ba3bfa2facc241c84cdba41e. The conflict resolution keeps its metadata-provider routing, available-request completion, failed-request repair flow, and active-season quota accounting alongside the per-season orphan cleanup and scan-failure guard.Screenshots / Logs
No rendered screenshots are available. Focused local check results are summarized above; GitHub Actions will retain the hosted logs for the full validation run.
Release Notes
release-notes/.pnpm release-notes:preview.Checklist:
pnpm build.pnpm i18n:extract.