Skip to content

Merge upstream v2.13.0/v2.13.1/v2.14.0 into personnal - #2

Open
PascalGodin wants to merge 47 commits into
mainfrom
personnal
Open

PascalGodin wants to merge 47 commits into
mainfrom
personnal

Conversation

@PascalGodin

Copy link
Copy Markdown
Owner

Summary

  • Merges upstream releases v2.13.0, v2.13.1, and v2.14.0 into personnal.
  • v2.13.0: TMDb keyword exclusion for job filters, openai 3.0 compatibility fix, dependency bumps.
  • v2.13.1: outbound webhook delivery system, personal feedback ranking (re-ranks LLM recommendations based on past "not interested"/"interested" marks), per-user request limits, Vue CLI → Vite migration, observability/Prometheus metrics.
  • v2.14.0: version bump only (no additional code changes).
  • Conflicts in base_handler.py, job_manager.py, and blueprints/jobs/routes.py were resolved to preserve this branch's existing customizations (genre-affinity candidate-pool ranking, non-blocking background job execution) alongside the new upstream features.
  • Also gates docker_hub_build.yml/docker_hub_build_nightly.yml to the upstream repo only, since they were auto-bumping versions and pushing to main unintentionally on this fork.

Test plan

  • Backend: python -m pytest api_service — 973 passed, only 3 pre-existing/unrelated cron test failures (timezone quirk, present before this merge too).
  • Docker dev build (ghcr_feature_build.yml on push to personnal) — succeeded, confirms the Vite frontend build works.
  • This PR's CI (ci.yml): backend pytest, frontend lint/unit tests/build/Playwright e2e — pending, opening this PR to trigger it.

🤖 Generated with Claude Code

PascalGodin and others added 30 commits August 5, 2026 08:23
… calls

Adds a threading.Semaphore(1) to JobManager so that multiple scheduled or
manually triggered jobs are queued rather than run concurrently. This is
critical for local LLM providers (e.g. Ollama) that cannot handle parallel
inference requests without timing out.

Jobs are validated before acquiring the slot so invalid/unconfigured jobs
fail fast without blocking the queue. The semaphore is always released in a
finally block, including on executor failure. A 1-hour timeout prevents a
stuck job from blocking the queue indefinitely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Builds and pushes linux/amd64 image to ghcr.io/pascalgodin/suggestarr:dev
on every push to feature/enhanced-ai-recommendations. Uses GITHUB_TOKEN
so no secrets need to be configured on the fork.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Lowercase the image name via shell (GHCR requires all-lowercase repository
names). Opt into Node.js 24 for all actions via FORCE_JAVASCRIPT_ACTIONS_TO_NODE24.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GITHUB_TOKEN cannot push packages on forked repositories regardless of
workflow permissions settings. Switch to a personal access token stored
as CR_PAT repository secret.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ations

Adds POST /api/jobs/<id>/duplicate endpoint that copies all settings from
an existing job, appends ' (Copy)' to the name, sets enabled=False so the
user can review before activating, and assigns ownership to the requesting
user. Includes a copy icon button on each job card in the UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…calls

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Build candidates from TMDbClient.find_similar_movies/tvshows (same pipeline
as the non-AI discover path) plus TMDbDiscover popularity results, then ask
the LLM to SELECT from that pool instead of generating titles freely.
Matched candidates skip the redundant TMDb search step.
Falls back to generation mode if the pool cannot be built.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tag each candidate with its origin (_candidate_source) so the LLM prompt
presents two labeled sections: 'Recommended For You' (personalised, from
TMDb recommendations) and 'Currently Popular' (discover filler). The LLM
is instructed to prioritise the personalised list and only draw from popular
to fill remaining slots.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Skip candidates already in the user's library (existing_content_sets) or
already discovered by Seerr (seer_discovered_ids) before passing to the LLM.
Uses only in-memory set lookups — no extra API calls. Per-item checks
(already_requested, watch_providers) still run downstream as usual.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All history items (up to the existing MAX_HISTORY_ITEMS=20 in llm_service)
are now used as similar-item sources, consistent with the non-AI path.
_MAX_CANDIDATES=50 remains the only cap on what the LLM sees.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each candidate shown to the LLM now includes TMDb rating and genre names
alongside the overview, so the LLM can evaluate obscure or newer titles
it may not recognise from training data alone.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ction mode

Added source_title to the selection mode prompt so the LLM identifies
which watched item inspired each recommendation. The resolve step now
looks up the source even for matched candidates instead of falling back
to the sentinel object.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Recommended and popular sections are each sorted by TMDb rating
descending before the 50-item cap, ensuring the highest-quality
candidates reach the LLM rather than whichever appeared first.
Section headers in the prompt now note the sort order so the LLM
can use position as an additional quality signal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The LLM now returns a one-sentence taste_profile summarising the user's
watch history, logged at INFO level. Each recommendation also carries a
score (0-100) indicating how well it matches the profile, logged at DEBUG
alongside the rationale.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…top N

Instead of asking the LLM to pick N items, it now scores every candidate
0-100 with a one-sentence fit reason. We sort by score and take the top N
programmatically, giving objective ranking independent of LLM output order.

Also adds LLM_MAX_CANDIDATES env var (default 50) to control the candidate
pool size sent to the LLM, and a CandidateScoringResponse Pydantic schema
for the new response format.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both are logged through _call_with_validation so all LLM call paths
(scoring, generation, AI search) are covered automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prompt now instructs the LLM to use the full 0-100 range with most scores
between 20-80, reserving 85+ for exceptional fits, to prevent score
clustering. Default candidate pool sent to LLM reduced from 50 to 25 to
cut CPU inference time roughly in half while keeping quality high since
candidates are already sorted by rating.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Jobs now wait indefinitely for the semaphore slot so none are dropped
from the queue. The 1-hour cap moves to the execution phase via
asyncio.wait_for, so each job gets a full hour to run regardless of how
long it waited.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…avior

The cherry-picked timeout commit made jobs wait indefinitely for a
semaphore slot instead of giving up after an hour, moving the 1-hour
cap to execution instead. The old test still asserted the removed
"skip on failed acquire" behavior; replaced it with a test for the
new execution-timeout skip path.
The workflow was still wired to the old feature/enhanced-ai-recommendations
branch name; the active working branch is now personnal.
Sorting candidates by rating alone let niche high-rated but off-theme
items (a wrestling PPV, an obscure war drama) crowd out genuinely
similar titles once the pool was capped to LLM_MAX_CANDIDATES — the
LLM then had to work with, and confidently rationalize, a pool that
didn't reflect the user's actual taste.

Candidates are now ranked by a lightweight TF-IDF-style genre affinity
score first (term frequency of each genre across the user's watch
history, weighted by inverse document frequency across the current
candidate pool so genres common to nearly everything don't count for
much), with rating only as a tiebreaker. Inspired by the TF-IDF/cosine
similarity approach in the jellyfin-plugin-localrecs fork.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ate pool

Rating/vote thresholds, include_no_ratings, language, release year, and
genre include/exclude were only ever checked on the single item the LLM
picked, after the fact — candidates the job is configured to reject
could still occupy slots in the capped pool, wasting the LLM's limited
attention on choices it was never allowed to make. Excluded streaming
services weren't checked anywhere in the LLM path at all.

_build_candidate_pool now runs the job's local quality filters
(_apply_filters) over the whole pool before ranking/capping, and checks
excluded streaming services on the final capped list (bounded cost,
and get_watch_providers is already a no-op when that filter isn't
configured). Deliberately checks each candidate's own TMDb ID, not the
seed's — the non-LLM path (jellyfin_handler.py/plex_handler.py) checks
get_watch_providers(source_tmdb_obj['id'], ...) instead of the
candidate's id, which appears to be a pre-existing bug from when the
feature was introduced (fde25e0); flagging separately rather than
carrying it into this new code path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
request_similar_media in jellyfin_handler.py/plex_handler.py called
get_watch_providers(source_tmdb_obj['id'], media_type) — checking
whether the already-watched seed is on an excluded streaming service,
not the candidate being considered for a request. In the non-dry-run
path this meant one check gated ALL candidates for a seed at once
(skip everything or nothing); in dry-run it repeated the same
seed-based check per candidate and mislabeled the result against each
one, even though the log message ("excluded by streaming service")
implied it was about that candidate. Traced back to the feature's
introduction (fde25e0, Feb 2025) — this looks like it never worked as
intended.

Now checks media.get('id') for each candidate individually, inside the
per-candidate loop, so only the candidate actually on an excluded
service is skipped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The scoring prompt's example "reason" text ("Matches the user's love of
dark sci-fi thriller pacing", "Too slow and romance-focused...") was a
concrete, plausible-sounding sentence — exactly the kind of one-shot
example a smaller/local LLM tends to imitate rather than generalize
from. Production logs showed this happening directly: Shang-Chi (not
sci-fi at all) got labeled "dark sci-fi thriller pacing" verbatim, and
nearly every other reason followed the same "Too X-focused for this Y
viewer" template as the second example line.

Replaced both example reasons with placeholder text and added an
explicit rule against reusing the example's or another item's wording,
so each reason has to be grounded in that candidate's own genre tags.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Investigating why the TV Shows job's candidate pool stayed dominated
by sitcoms/cozy mysteries despite the genre-affinity ranking fix,
unlike the Movies job which changed dramatically. None of the ranked
candidates shared a genre with "Avatar: The Last Airbender"
(Animation/Sci-Fi & Fantasy/Family) even though it's one of only 4
seeds — suggesting that seed may not be resolving to the TMDb entry
we'd expect via search_tv, so its real genre profile never enters the
affinity calculation. This logs each seed's title/year alongside what
it actually matched (title, TMDb id, genre_ids) so the next run
confirms or rules that out before any further fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Root cause of the TV Shows job's candidate pool staying stuck on
comedy/sitcom recommendations regardless of the genre-affinity fix:
diagnostic logging showed 3 of 4 seeds ('Tulsa King', 'Avatar: The
Last Airbender', 'Landman') failing to resolve via search_tv, leaving
only one seed's genres feeding the whole ranking.

search_tv passes the caller's year as first_air_date_year, a strict
TMDb filter for the show's ORIGINAL premiere year. But the year on a
watched item is Jellyfin's ProductionYear, which for an episode/season
reflects when that specific season aired — not the show's premiere.
For any returning show watched via a later season, the two diverge
(Tulsa King premiered 2022, Landman and Avatar in 2024) and TMDb
returns nothing.

search_tv now retries once without the year filter when the
year-filtered search comes back empty, so a real title match isn't
thrown away over a season/premiere year mismatch. This affects every
caller of search_tv, not just the candidate pool.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Production logs caught a local LLM emitting the same candidate index
twice in the "scores" array with two different scores (index 1 at
both 63 and 76, the second appended after the array otherwise closed).
It didn't bite that run since the duplicate's score wasn't high enough
for the top 5, but if a repeated index ever scores well, the same
physical candidate could consume two of the "top N" slots — silently
returning fewer unique recommendations than requested with no
indication anything was wrong.

Track seen indices while walking scores sorted by descending score,
skipping repeats. Since the list is sorted first, the higher-scoring
occurrence of a duplicate is always the one kept.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The candidate pool always listed every "recommended" (similar-to-history)
candidate ahead of every "popular" (broad discover) one, regardless of
genre-affinity score — so a popular item that matched taste well could
still lose its spot in the capped pool to a weaker recommended item
just because of which TMDb endpoint it came from.

Genre affinity is the signal that actually matters; provenance isn't a
reason to tier candidates before the cap is applied. Both buckets are
now merged and sorted together by (genre_affinity, rating), so the
strongest matches survive the cap regardless of source. The
"recommended"/"popular" prompt sections are unaffected — this only
changes which candidates make the cut, not how they're presented.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ions

Good catch from a suspicious-looking prompt: the previous commit merged
recommended/popular candidates into one genre-affinity-ranked list in
_build_candidate_pool, but get_recommendations_from_history was still
partitioning that list back into "RECOMMENDED FOR YOU" (all recommended
items) followed by "CURRENTLY POPULAR" (all popular items) when building
the prompt — silently re-imposing the exact source-based ordering the
pool-building fix removed. A popular item ranked near the top of the
merged list (e.g. Game of Thrones, sharing all three of a seed's genres
with a higher rating than several "recommended" survivors) still got
displayed dead last under a different heading, undermining the fix
before the LLM ever saw it. The section labels also claimed "sorted by
rating", which stopped being true once genre affinity became the
primary key.

candidates now renders as a single list in the order _build_candidate_pool
already ranked it, with no re-grouping by source.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PascalGodin and others added 17 commits August 5, 2026 08:23
Genre tags are coarse — only ~19 broad TMDb buckets — and we'd already
hit their ceiling (Action/Drama sit on half of TMDb, so they barely
discriminate anything). Keywords ("time travel", "found family",
"chosen one") and director are far more specific signals that TMDb
already tracks per title but never surfaced anywhere in this pipeline.

- TMDbClient.get_taste_metadata() fetches both in one call via
  append_to_response=keywords,credits (TV nests keywords under
  "results", movies under "keywords" — handled).
- _build_candidate_pool now enriches every eligible candidate (post
  quality-filter, pre-cap) with keywords/director, concurrency-bounded
  via a semaphore (15) so a large pool doesn't burst past TMDb's rate
  limit. Seeds get the same treatment so their taste profile includes
  keyword/director term frequency, not just genre.
- Genre, keyword, and director tags are namespaced (('genre', id),
  ('keyword', id), ('director', name)) in the same TF-IDF term/doc
  frequency counters so IDs from different TMDb ID spaces can't
  collide.
- The prompt line now shows up to 4 keywords and the director,
  alongside genre names, so the LLM's own reasoning has something more
  specific than genre tags to reference.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Production logs showed the newly-added keyword signal taking over the
candidate pool ranking: a TV job whose pool was previously dominated by
sci-fi/fantasy (tracking Avatar: The Last Airbender's genre profile)
shifted to being dominated by Texas/Western/ranch dramas after keywords
were added, apparently driven by a "texas" keyword shared by two other
seeds.

Root cause: keywords are drawn from a vocabulary of thousands of
possible values vs. genre's ~19, so for the same "rarity" a keyword's
document frequency across the pool is structurally much lower than a
genre's, giving it a much higher IDF under the same TF-IDF formula —
regardless of whether "both shows are set in Texas" is actually a
stronger similarity signal than sharing all of a seed's genre tags.
The result: a single incidental shared keyword could mathematically
outweigh a full genre match.

Added a per-tag-type weight (genre 1.0, keyword 0.5, director 0.4)
applied to each tag's contribution, so genre stays the dominant signal
and keyword/director add supporting weight without being able to
override it. Values are a starting point to tune from observed
results, not a precisely derived optimum.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…idates

The prompt showed candidates with rating/genre/keyword/director/overview
but the "recently watched" list was just bare title/year — the LLM had
far more to reason from about what it's picking than about what the
user actually likes.

- base_handler.py now attaches rating/genre_ids/overview/keyword_names/
  director onto watched-history items during seed resolution in
  _get_similar, reusing data already fetched for the TF-IDF ranking
  (same dict objects flow through to get_recommendations_from_history,
  so this costs zero extra API calls).
- llm_service.py: extracted _fmt_item(), a single formatter shared by
  both the candidate list and the watched-history list, so a watched
  item now renders identically to a candidate — numbered, with the same
  "[rating: X/10; Genre, Genre; keywords: a, b; dir: Name] — overview"
  line — instead of two different formats for what should be
  structurally the same kind of line.

Also replaced the hardcoded TMDb genre ID→name table with
TMDbDiscover.get_genre_names(), cached for the process lifetime (TMDb's
genre list is small and effectively static, so no need to refetch it
per job run, but a manually-maintained table risked silently dropping
any genre TMDb adds that isn't in it). Genre names are now resolved
once per _build_candidate_pool call and attached to both seeds and
candidates, same pattern as keywords/director.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Investigating why "One Piece" wasn't showing up in the TV Shows job's
watched-history list. _jellyfin_item_to_seed/_plex_item_to_seed both
silently return None when the source item has no TMDb provider ID
resolvable — no log line, no trace. For long-running anime this is a
real possibility: some Jellyfin/Plex metadata agents match anime via
TheTVDB or AniDB rather than TMDb, so the item never gets a usable
tmdb_id and disappears from the recommendation pipeline before the
merged-seed stage even runs.

Both handlers now log at INFO when this happens, including which
provider IDs (if any) were actually present, so a missing seed is
diagnosable from the logs instead of a guess.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Traced from a user report: a show watched minutes ago (One Piece,
premiered 1999) wasn't appearing in the seed list at all, while a show
watched slightly later the same night (a 2026 release) was.

_jellyfin_item_to_seed's date-extraction only ever checked a top-level
'DatePlayed' field — but Jellyfin's /Users/{userId}/Items response
reports the actual watch timestamp under UserData.LastPlayedDate; a
top-level 'DatePlayed' key never appears on a real item. The lookup
always failed and silently fell through to DateCreated (library-add
date) or PremiereDate (original air date) instead, for every item ever
processed. This has been invisible for newly-released shows, whose air
date roughly tracks "recent" anyway, but is badly wrong for an older
show watched recently — it sorts as if watched decades ago and gets cut
by the recency-based seed cap ahead of shows that are merely new, not
actually more recently watched.

Now reads UserData.LastPlayedDate first, falling back through the old
DatePlayed/DateCreated/PremiereDate chain (also fixed: the old loop
could break after finding a truthy-but-unparseable field instead of
trying the next fallback). Also added UserData to the Fields param on
both the primary and fallback recent-items queries so this isn't
relying on default inclusion behavior across Jellyfin versions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ates

Production log: a scoring response structurally passed schema validation
(every field the right type) but only 6 of 25 candidates were actually
scored. The local LLM corrupted its own JSON mid-generation — instead of
closing candidate 6's "reason" string and starting a new object for
candidate 7, it kept writing, so candidates 7-25 ended up as literal
escaped-looking text inside that one string field. A string field can
hold anything, so this passed validation silently; nothing checked
whether the response actually covered the candidates it was asked to
score, even though the prompt explicitly says "Score EVERY candidate."

_call_with_validation gains an optional extra_validate callback, run on
the schema-validated model, that can reject an otherwise-valid response
for semantic reasons — handled identically to a schema/JSON failure
(logged, retried with a corrective message, eventually raises
LLMValidationError). Scoring mode uses it to require at least 60% of
sent candidates to come back scored (tolerates an occasional missed
index without over-triggering retries on a minor gap, while catching
wholesale truncation like this one).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ng and generation-mode calls

Both the candidate-scoring and generation-mode fallback paths in
get_recommendations_from_history() had hardcoded temperature=0.7 instead of
spreading the resolved generation_settings (temperature + reasoning_effort),
so a user's LLM_TEMPERATURE/LLM_REASONING_EFFORT config was silently ignored
for actual recommendation calls even though interpret_search_query() and
generate_search_result_rationales() already respected it. This was a merge
oversight from rebasing onto upstream's new generation-settings feature (a
conflict resolution kept the fork's older hardcoded-temperature branch
instead of adapting the incoming **generation_settings usage), caught by
the existing test_applies_generation_settings_to_recommendations test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The scoring-mode intro sentence said "recently watched and enjoyed",
contradicting the per-item preference_signal labels (e.g. "recent/neutral
watch") rendered in the same history list just below it, and the generation-
mode prompt's own explicit caveat that a watch alone isn't evidence of
enjoyment. Drop "and enjoyed" so the framing doesn't undercut the signal
labels it's presenting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Upstream's SearXNG feature (v2.12.0) only ever consumes {web_context} inside
the generation-mode prompt, so during this rebase the fetch call was moved
into that branch specifically rather than the shared preamble it arrived at
upstream (where it would fire an unconditional, silently-discarded SearXNG
round-trip on every scoring-mode call — i.e. every real recommendation,
since base_handler.py always builds a candidate pool). Add a regression
test asserting _get_web_search_context is never called when candidates
are supplied; confirmed it fails without the fix by temporarily
reintroducing the unconditional fetch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… uvicorn/swagger bumps)

Trial merge of origin's v2.13.0 tag into personnal, on a throwaway branch for review.
Only conflict was two independently-added methods at the same insertion point in
tmdb_discover.py (get_genre_names vs search_keywords) — resolved by keeping both.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… limits, Vite migration, observability)

Trial merge of origin's v2.13.1 tag into personnal. Conflicts, all resolved by hand:

- api_service/blueprints/jobs/routes.py: kept personnal's non-blocking background-thread
  /run endpoint (202 immediately) instead of upstream's synchronous execution, but adopted
  upstream's pattern of pre-creating the execution_id so run_id is still returned immediately
  and webhook/history tracking works the same as upstream's flow.
- api_service/jobs/job_manager.py: combined upstream's webhook-queueing/outcome-metrics
  additions with personnal's existing semaphore-gated single-job-at-a-time execution;
  extended run_job_now() to accept a pre-created execution_id.
- api_service/handler/base_handler.py: took upstream's feedback-based re-ranking of
  resolved LLM recommendations as-is — it runs after personnal's existing genre-affinity
  candidate-pool ranking, as a final ordering pass, so the two don't conflict.
- api_service/test/test_observability_webhooks.py: fixed a test that predates personnal's
  job-execution semaphore (object.__new__(JobManager) instance was missing the
  _job_semaphore attribute _execute_job now requires).

Full backend suite: 973 passed, same 3 pre-existing cron test failures as unmerged personnal.
Frontend build/lint unverified — no npm available in this environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
No code changes beyond v2.13.1 — this tag only bumps client/package.json's version string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
docker_hub_build.yml and docker_hub_build_nightly.yml are giuseppe99barchetta's own
release pipeline: they push images to the ciuse99/suggestarr Docker Hub namespace using
his DOCKER_HUB_ACCESS_TOKEN secret, and docker_hub_build.yml also auto-commits/pushes a
version bump straight to main and recreates the nightly branch. None of that applies to
this fork, and it already produced one unwanted auto-commit here (the earlier stray
"bump version to v2.12.1" commit). Gate every job on github.repository so nothing runs
here, while keeping the files identical to upstream otherwise for clean future merges.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…thorization header

Jellyfin 12.0 (formerly 10.11) disabled the legacy X-Emby-Token/X-Emby-Authorization
headers by default (EnableLegacyAuthorization now defaults to false). SuggestArr's
Jellyfin client relied on those headers plus a minimal Authorization: MediaBrowser
Token="..." (missing the required Client/Device/DeviceId/Version fields) for nearly
every request, so on Jellyfin 12 the library scan silently got 401s, existing_content
ended up empty, and SuggestArr re-requested titles already in the library.

- jellyfin_client.py: send a complete MediaBrowser Authorization header (works on
  Jellyfin 12+ and older Jellyfin/Emby), keep X-Emby-Token alongside for Emby/pre-12
  compatibility.
- get_libraries()'s auth fallback chain: try the full header first; also fixed a
  pre-existing bug where the query-param fallback used "api_key" instead of Jellyfin's
  actual "ApiKey" parameter, so that fallback never worked either.
- Applied the same header fix to users/routes.py (user listing) and
  integrations/routes.py (Jellyfin/Emby login).
- Updated test assertions to match; removed a dead, never-invoked test helper that
  still showed the old broken header logic.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
_build_candidate_pool fired one _get_similar() call per watch-history seed
(search + taste metadata + similar-items — 2-3 TMDb requests each) fully
concurrently via asyncio.gather, with no throttle. With the default 50-seed
cap that's 100+ near-simultaneous TMDb requests, well past their rate limit —
seen live as a burst of "Error retrieving movie recommendations: 429" during
a dry run, silently truncating similar-items results for whichever seeds lost
the race.

Bound it with the same asyncio.Semaphore(_TASTE_METADATA_CONCURRENCY) pattern
already used a few dozen lines down for candidate enrichment, for the same
stated reason.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… an implicit page cap

Live testing after the Jellyfin 12 auth fix showed the library scan retrieving
items successfully, but one specific already-owned movie (Captain America: Civil
War) still slipped through the existing-content check and got queued for a
duplicate request — while other already-owned titles in the same run were
correctly recognized and skipped.

_fetch_library_items sent /Items with no Limit/StartIndex, relying on whatever
Jellyfin does by default when neither is specified. Jellyfin 12's own release
notes warn that GetItems changed behavior — "the same query can return a
different result set than it did on 10.11" — so a query that used to return
everything may now silently truncate. Made this explicit instead of implicit:
page through /Items with Limit=500/StartIndex, stopping on a short page (a
self-contained end-of-results signal, not dependent on TotalRecordCount being
present). Also logs fetched vs. TMDb-ID-valid counts per library so a metadata
gap (item present but missing a TMDb ProviderId) is now distinguishable from a
truncated fetch.

Added a regression test for pagination across a full first page. Caught and
fixed a self-inflicted infinite loop in the first version of this fix (gating
solely on TotalRecordCount, which the existing single-page test mocks don't
set) before it shipped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… Type

Confirmed live that Captain America: Civil War has the correct TMDb ID
(271110) in Jellyfin, ruling out a metadata gap. The remaining suspect: the
"Movies" library fetch shows a 58-item gap between what's fetched and what's
accounted for as either valid or missing-a-TMDb-ID — those items are being
silently dropped by the `item_type not in ("Movie", "Series")` filter, even
though we already ask Jellyfin to restrict to IncludeItemTypes=Movie,Series
server-side.

Now logs a per-library breakdown of excluded item types, and specifically
warns (with title/TMDb ID) whenever an excluded item actually carries a TMDb
ID — since a real movie/show having one but landing under an unexpected Type
is exactly the shape of bug that would explain an already-owned title still
getting requested. Diagnostic only; next dry run's logs should show whether
Civil War is one of these.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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