Skip to content

fix(plex): prevent repeated watchlist auto-requests - #207

Closed
snapetech wants to merge 1 commit into
mainfrom
codex/plex-watchlist-entry-tracking-20261012
Closed

snapetech wants to merge 1 commit into
mainfrom
codex/plex-watchlist-entry-tracking-20261012

Conversation

@snapetech

@snapetech snapetech commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Description

SeerrNG's Plex auto-request already paginates watchlists and handles movies and series. This adds durable per-user entry tracking so deleting a handled request or downloaded media does not trigger another request while the Plex item stays listed. Removing and re-adding the item starts a new request cycle.

The state is scoped to the user's Plex account, existing auto-request history seeds tracking on upgrade, and TV seasons are recorded independently so later seasons can be requested without restoring deliberately deleted ones. If Plex cannot provide an item timestamp, that item remains eligible for a later sync.

This adapts the behavior to SeerrNG's existing paginated, multi-format request flow.

AI assistance was used to prepare and implement this change.

How Has This Been Tested?

  • pnpm test:node -- server/lib/watchlistsync.test.ts server/api/plextv.test.ts server/migration/sqlite/1791849700000-CreatePlexWatchlistSyncEntries.test.ts — 21 passed.
  • ESLint on the changed TypeScript files — passed.
  • pnpm typecheck:server — passed.
  • Prettier and git diff --check — passed.
  • pnpm release-notes:preview --base origin/main --head HEAD — reviewed.
  • The complete GitHub-hosted validation mode will run on this PR; no full local build was run.

Screenshots / Logs

Not applicable.

Release Notes

  • I added a release-note fragment under release-notes/.
  • This change is internal-only and does not need a user-facing release note.
  • The fragment includes audience, area, action, and breaking-change status.
  • I previewed the release text with pnpm release-notes:preview.

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. (Focused suites passed; complete mode is pending.)
  • Successful build pnpm build.
  • Translation keys pnpm i18n:extract. (Not applicable; no translations changed.)
  • Database migration (if required).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T00:24:56.078500Z d3fbfc9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3fbfc93e3

ℹ️ 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".

Comment on lines +290 to +292
if (unavailableItems.length === 0) {
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow tracked series through the per-season scan

When a TV show's earlier auto-request remains in history and its media status is PENDING, PROCESSING, or PARTIALLY_AVAILABLE, autoRequestedTmdbIds removes the show from unavailableItems, and this early return prevents loadTvSeasonNumbers from ever checking for new seasons. Thus the new per-season tracking only works after the prior request/media becomes DELETED; normal retained request history can leave later seasons unrequested. The new test masks this because its MediaRequest.request mock never persists the first request.

Useful? React with 👍 / 👎.

Comment on lines +591 to +594
entry.watchlistedAt = watchlistedAt;
entry.processedSeasonNumbers = mergeSeasonNumbers(processedSeasonNumbers);
await repository.save(entry);
} catch (error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate failures to persist handled state

If request creation succeeds but this save fails, the error is swallowed and the sync reports the request as created without durable tracking. If the user subsequently deletes that request or its media before a later successful history backfill, the next sync sees neither an entry nor request history and recreates the request—the exact behavior this change is intended to prevent. Let the save failure propagate or otherwise make request creation and tracking recoverable as one operation.

Useful? React with 👍 / 👎.

@snapetech snapetech mentioned this pull request Oct 13, 2026
6 of 11 tasks
@snapetech

Copy link
Copy Markdown
Collaborator Author

Superseded by #305, rebuilt from the current main line with the watchlist tracking change and regression coverage.

@snapetech snapetech closed this Oct 15, 2026
@snapetech
snapetech deleted the codex/plex-watchlist-entry-tracking-20261012 branch October 16, 2026 01:38
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