Skip to content

fix(recommendations): make the recommendation pipeline correct, isolated and observable - #1966

Merged
Quick104 merged 91 commits into
mainfrom
fix/recs-quality
Oct 14, 2026
Merged

Quick104 merged 91 commits into
mainfrom
fix/recs-quality

Conversation

@Quick104

@Quick104 Quick104 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Title: fix(recommendations): make the recommendation pipeline correct, isolated and observable

Problem

Related issue: #1139
Validation tasks: unblocks #1145 C1, C2, C3, C4, C5 and #1146 C1, C3, C5 (all Not run)

Recommendations had defects across the whole pipeline, from embedding through
to the rows clients read. Several would fail the 1.0 validation cases or leak
data:

  • Semantic search could send the Gemini API key to any signed-in user: a
    transport error quoting the request URL was copied into
    search_diagnostics.fallback_reason. The admin embedding connection check
    sent the saved embedding token to whatever base URL a draft named.
  • The shipped "Ollama · Local" preset selects qwen3-embedding:latest, the 8B
    model, whose 4096-dimension vectors Silo cannot store. The first such vector
    still wrote the embedding lock, pinning the server to a model it could never
    use, with no way back short of SQL.
  • Every API node ran every recommendation job, job failures were logged as
    success, and history imports, watch-provider syncs, media-server webhooks and
    catalog merges never queued a refresh, so background refresh (C2) silently
    missed whole classes of changes.
  • Rows were built under a narrower access scope than reads use, four v1 list
    endpoints returned titles the viewer cannot access, deleted profiles kept
    feeding other accounts' rows, and "Users Like You" could show one other
    household's ratings on their own.
  • A profile whose only signals were dislikes was served an "anti-taste" row as
    For You, and favorites and taste-seed picks were recommended straight back.
  • Library "Recommended for You" rows were trimmed to 20 before being scoped to
    the library, so TV and secondary libraries came back nearly empty.

This PR fixes those defects. It also carries the ranking and relevance
changes from #1967, which merged into this branch.

Approach

  • Embeddings: provider responses must carry one non-empty vector per
    input, and a vector wider than 3072 dimensions ends the run before the lock
    is read or written. Credential, model and host errors stop a run at once.
    An input the provider rejects is retried shortened and then skipped; each
    server remembers skipped inputs by their text, so the 15-minute catch-up
    pass, which embeds newly matched titles between nightly runs, does not
    resend them. A new v2 admin operation,
    POST /api/v2/admin/recommendations/embeddings/reset, clears the lock,
    embeddings, taste vectors and personal rows in one transaction, so changing
    models no longer needs SQL. Taste rows stay, so storing embeddings again
    marks them stale and the stale sweep rebuilds them. It refuses while a catalog import with
    embeddings runs or saved embedding settings wait for a restart. The connection check rejects unusable models and
    lock conflicts, sends the saved token only to the base URL it was saved
    for (as the AI checks already do), and the Ollama preset now uses
    qwen3-embedding:0.6b.
  • Jobs and refresh: each job takes a Postgres advisory lock, so it runs on
    one server at a time, and every run is recorded in task_executions with
    its counts; admin status shows the last run, lock conflicts and cache age.
    One NotifySignalsChanged entry point is called by handlers, history
    import, watch sync and webhooks (every recorded stop). A refresh records its
    start time and only clears marks set before it, so a change made
    mid-refresh is no longer lost. A row whose rebuild fails keeps its last good
    version; a global, main or Because You Watched row that rebuilds empty is
    deleted.
  • Access: rows are built under the scope access.Resolver (or the policy
    resolver) gives the API, failing closed, and access and policy changes
    trigger a rebuild. One server at a time refreshes a profile, under a
    per-profile advisory lock. Because You Watched and Similar Users filter in the candidate query.
    Jellyfin /Movies/Recommendations now reads the cached rows; the duplicate
    live pipeline it used is deleted.
  • Signals: personal rows exclude favorites as well as watched titles. A
    profile with no positive signal keeps its row with a NULL taste vector
    (new migration) and gets cold-start rows; a refresh that runs after its
    profile was deleted writes no row. Series decay by their latest
    signal, signal counts are per title, and progress under 15% counts as
    abandonment only after 14 days.
  • Reads: library sections read the whole cached pool and then scope it;
    the v2 per-section endpoints return 500 when a section fails instead of an
    empty 200 (v1 keeps the empty section).
  • Cleanup: about 1,500 lines of dead code and unused UI (the unmounted
    Watch Tonight dialog and six hooks) are removed, along with settings that
    did nothing.

The durable rules are in docs/architecture/recommendations.md.

Validation

Risks

  • Two migrations: user_taste_profiles.embedding becomes nullable, and orphaned
    recommendation rows for deleted Postgres-backed profiles are deleted.
  • /api/v1 changes, all as bridge fixes or shared-code effects: the four v1
    list endpoints drop inaccessible titles; v1 job triggers answer 409 when
    another server runs the job; the v1 connection check is stricter; v1 catalog
    import gains
    embeddings_skipped; the v1 Similar Users row title changes from "Fans Like
    You Also Enjoyed" to "Profiles Like You Enjoyed", and v1 Discover genre rows
    from "Popular in X" to "Top X" (display strings; no client keys rows by
    title). v1 Watch Tonight keeps answering 200 with no items when a lookup
    fails; v2 answers 500.
  • Audiobooks and ebooks no longer appear in recommendation rows or the
    taste-seed picker (from feat(recommendations): make recommendations more accurate and relevant #1967). AGENTS.md says beta books must not be gated
    or removed for 1.0, so this needs a maintainer decision: record the
    exception in AGENTS.md and docs/architecture/v1-scope.md, or restore them.
  • signal_counts now count titles, so clients' "N signals" numbers shrink.
    Cluster rows reshuffle once on upgrade because seeding no longer uses decayed
    weights.
  • Each running job holds one database connection for its advisory lock; the
    reset briefly holds four.
  • The reset deletes all embeddings and personal rows; the admin UI confirms
    first and the catch-up pass rebuilds them.
  • A policy save, an access.unrated_content change or a SQLite-store
    embedding run marks every profile stale, and the stale sweep drains about
    600 profiles an hour; the nightly jobs rebuild without clearing marks.
    Reads still filter under the current scope.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-1966/

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents and workflows
  • Model(s): claude-opus-5-5, claude-sonnet-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: each audit finding was confirmed by two independent
    verifiers (Opus and Sonnet) before it was fixed, and the architecture doc
    was fact-checked against the code. A high-effort Claude Code review of the
    finished branch reported 10 candidate findings: 7 are fixed here (deleted
    profiles getting a taste row back, empty personal rows serving old titles,
    refused embedding inputs stalling runs and failing the catch-up pass,
    webhook stops not refreshing, a signal query ahead of the refresh throttle,
    a wrong comment). The stale-mark write on every change is kept, since it is
    what keeps a mid-refresh change, and so are the per-package notifier
    interfaces. Kody's
    review of the PR raised 13: 9 are fixed (provider error bodies quoted
    unmasked, refused embeddings using the text-refresh quota, a failed history
    import missing writes it made, merges not marking ebook readers stale, a
    policy change not rebuilding rows after a failed local reload or on peers
    that reload later, overlapping policy reloads applying an older
    generation, a change during a profile's first build left unmarked, SQLite
    profiles not marked stale after embedding)
    and
    4 are answered in their threads as already covered or accepted races,
    which Kody accepted. Codex raised 35: 32 are fixed (unbounded Jellyfin
    limits sizing allocations, Jellyfin serving
    cached rows while disabled, notifications and an access-group member
    lookup canceled with their request, a failed global-row delete not
    counted, similar items and their co-watch neighbors ranked before the
    viewer's access filter, live popular and recently added lists limited
    before it, shortened embedding retries after failures unrelated to
    length, a refused search query cooling down semantic search for
    everyone, a stored-width lock conflict hidden without a provider probe,
    policy changes leaving rows under the old scope, a reset allowed while
    saved embedding settings wait for a restart, two servers refreshing one
    profile and the older refresh finishing last, a profile deleted between a
    refresh's existence check and its writes keeping its taste row, Jellyfin
    rows trimmed before audiobooks and podcasts were excluded, a reset
    committing in the middle of a catalog import, overlapping access-group or
    profile saves restoring a scope unnoticed, imported embeddings never
    getting a lock, one household filling the Similar Users peers, item stale
    marks missing a profile's first build, jobs skipping a busy profile
    without a retry, scheduled jobs overwriting a newer
    refresh, new embeddings not marking profiles stale, a reset leaving no
    taste rows to rebuild, a local model's context-length error ending a run
    or cooling down semantic search, v1 section reads changed to answer 500;
    two repeat
    Kody's policy-reload and SQLite stale-mark findings).
    Three are left open for a maintainer decision: a reset racing a refresh
    on another node, other nodes' semantic-search coverage answers lasting up
    to two minutes after a reset, and seed bundles that record only a model
    name, so a bundle from another installation with the same model passes.
  • Review round on 3cfae06 (Claude Code, claude-opus-5-5 with
    claude-sonnet-5-5 subagents, and a Codex gpt-6.1-sol cross-check): 13
    fixes pushed (the Gemini key following redirects, a first unembeddable
    item ending every embedding run, jobs running on after losing their lock
    session, v1 Watch Tonight answering 500, SQLite-store profiles re-marked
    every 500 embeddings, a list removal not counted when its bookkeeping
    failed, a rated episode not hiding its series in cached rows, a dropped
    read refresh blocking the next one, a test that could not catch replay, the
    reset docs, the probe script's output directory and history filter, three
    stale comments) plus two merges with main. Left open for a maintainer
    decision: the beta book scope, the stale-sweep throughput, a cold local
    model tripping the semantic-search cooldown, a node that cannot load the
    stored policy generation, and several low-severity races answered in their
    threads.
  • A Codex review of 900b327 found that the embedding and co-watch jobs
    still ran on after their lock session closed, since only the taste and
    cache jobs noticed it. Fixed in 015e0d6, and Kody's follow-up, which
    bounds that session check so a connection that stops answering cannot hold
    the job until its deadline, in 65b1a70.

🤖 Generated with Claude Code

Note

Make recommendation pipeline correct, isolated, and observable across servers

  • Reworks the recommendations worker: named jobs now serialize across servers with PostgreSQL advisory locks, record execution history, and support a new Worker.ResetEmbeddings operation with conflict errors (ErrStaleSweepRunning, ErrCatalogImportRunning, ErrEmbeddingSettingsPendingRestart)
  • Rewrites personalization: rowBuilder replaces Engine.ForYou internals with anchored main-row construction, quality priors, recency boosts, bounded genre caps, profile-relative cluster labels, and deterministic daily row rotation
  • Adds access filtering end to end: Recommender interface methods now take a catalog.AccessFilter, SQL queries enforce library and maturity limits, and v1 handlers drop inaccessible items and inaccessible anchors
  • Signals now deduplicate by canonical title, skip deleted or non-recommendable anchors, treat low-progress watches as abandoned only after an age threshold, and trigger refreshes via NotifySignalsChanged from ratings, progress, watch/webhook sync, settings, and access-scope changes
  • Admin API exposes persisted job runs, partial runs, lock conflicts, stale-sweep status, cache refresh time, and a POST embeddings-reset endpoint wired to the web UI
  • Risk: behavioral changes are large — Engine.EmbedItem/EmbedAll moved out of similar.go, Recommender and recommendationReader interfaces changed signatures, user_taste_profiles.embedding is now nullable (migration 20261003232951), v1 endpoints convert item-fetch failures to empty responses while v2 returns errors, and public row reads are capped at MaxRowReadLimit (50)

Macroscope summarized 65b1a70.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 272 files, which is 122 over the limit of 150.

To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d8dc108b-0abb-4e1f-81dc-02e030b0d84f
📥 Commits

Reviewing files that changed from the base of the PR and between 99d5623 and 65b1a70.

📒 Files selected for processing: 272
  • cmd/silo/main.go
  • contracts/api/v2/fixtures/admin_account_delete_break_glass_required.json
  • contracts/api/v2/fixtures/admin_account_profile_sections_not_found.json
  • contracts/api/v2/fixtures/admin_catalog_import_committed.json
  • contracts/api/v2/fixtures/admin_download_revoke_mixed.json
  • contracts/api/v2/fixtures/admin_download_storage_delete_invalid_id.json
  • contracts/api/v2/fixtures/admin_item_markers_redetect_unknown_kind.json
  • contracts/api/v2/fixtures/admin_login_session_forbidden.json
  • contracts/api/v2/fixtures/admin_network_access_status_not_found.json
  • contracts/api/v2/fixtures/admin_network_access_unknown_host.json
  • contracts/api/v2/fixtures/admin_recommendations_embeddings_reset.json
  • contracts/api/v2/fixtures/admin_recommendations_status.json
  • contracts/api/v2/fixtures/admin_subtitle_metadata_precondition_required.json
  • contracts/api/v2/fixtures/approve_device_login_api_key_forbidden.json
  • contracts/api/v2/fixtures/cancel_admin_download_preparations_invalid_id.json
  • contracts/api/v2/fixtures/cancel_device_login_not_found.json
  • contracts/api/v2/fixtures/collection_order_foreign_id.json
  • contracts/api/v2/fixtures/complete_account_identity_link_invalid_grant.json
  • contracts/api/v2/fixtures/complete_oauth_login_invalid_grant.json
  • contracts/api/v2/fixtures/create_account_identity_link_ticket_wrong_password.json
  • contracts/api/v2/fixtures/create_admin_user_identity_linked_elsewhere.json
  • contracts/api/v2/fixtures/delete_account_identity_last_sign_in_method.json
  • contracts/api/v2/fixtures/ebook_annotation_delete_missing_guard.json
  • contracts/api/v2/fixtures/ebook_annotation_patch_missing_guard.json
  • contracts/api/v2/fixtures/ebook_config_missing_guard.json
  • contracts/api/v2/fixtures/ebook_progress_missing_event_time.json
  • contracts/api/v2/fixtures/get_home_layout_include_items_out_of_range.json
  • contracts/api/v2/fixtures/get_ratings_capability_authentication_required.json
  • contracts/api/v2/fixtures/get_watch_trickplay_not_found.json
  • contracts/api/v2/fixtures/index.json
  • contracts/api/v2/fixtures/link_account_identity_with_credentials_directory_refused.json
  • contracts/api/v2/fixtures/list_series_seasons_invalid_artwork.json
  • contracts/api/v2/fixtures/login_account_required.json
  • contracts/api/v2/fixtures/login_provider_null.json
  • contracts/api/v2/fixtures/playback_installation_changed.json
  • contracts/api/v2/fixtures/playback_invalid_protocol.json
  • contracts/api/v2/fixtures/playback_progress_conflict.json
  • contracts/api/v2/fixtures/refresh_session_provider_unavailable.json
  • contracts/api/v2/fixtures/regenerate_admin_item_trickplay_disabled.json
  • contracts/api/v2/fixtures/sign_in_with_network_identity_off_overlay.json
  • contracts/api/v2/fixtures/start_account_identity_link_unknown_ticket.json
  • contracts/api/v2/fixtures/start_device_login_temporary_null.json
  • contracts/api/v2/fixtures/theme_songs_playback_not_acceptable.json
  • contracts/api/v2/fixtures/theme_songs_playback_unauthorized.json
  • contracts/api/v2/fixtures/token_refresh_required.json
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • docs/admin-recommendations-api.md
  • docs/admin-settings-api.md
  • docs/architecture/external-watchlist.md
  • docs/architecture/recommendations-evaluation.md
  • docs/architecture/recommendations.md
  • docs/jellycompat-api.md
  • internal/access/group_store.go
  • internal/api/handlers/access_groups.go
  • internal/api/handlers/admin.go
  • internal/api/handlers/admin_access_group_service.go
  • internal/api/handlers/admin_settings_checks.go
  • internal/api/handlers/admin_settings_embedding_check_test.go
  • internal/api/handlers/admin_split.go
  • internal/api/handlers/admin_split_service_test.go
  • internal/api/handlers/admin_users_service.go
  • internal/api/handlers/favorites.go
  • internal/api/handlers/favorites_dispatch_test.go
  • internal/api/handlers/home_missing_collection_test.go
  • internal/api/handlers/home_views_service.go
  • internal/api/handlers/items.go
  • internal/api/handlers/library_views_service.go
  • internal/api/handlers/playback.go
  • internal/api/handlers/playback_finish_history_test.go
  • internal/api/handlers/playback_profile_refresh_test.go
  • internal/api/handlers/profile_refresh.go
  • internal/api/handlers/profiles.go
  • internal/api/handlers/progress.go
  • internal/api/handlers/ratings.go
  • internal/api/handlers/recommendation_scope.go
  • internal/api/handlers/recommendation_scope_test.go
  • internal/api/handlers/recommendations.go
  • internal/api/handlers/recommendations_access_test.go
  • internal/api/handlers/recommendations_defaults_test.go
  • internal/api/handlers/recommendations_limit_test.go
  • internal/api/handlers/recommendations_section_test.go
  • internal/api/handlers/recommendations_service.go
  • internal/api/handlers/recommendations_upcoming_test.go
  • internal/api/handlers/section_items_error_db_test.go
  • internal/api/handlers/sections.go
  • internal/api/handlers/settings.go
  • internal/api/handlers/settings_values.go
  • internal/api/handlers/settings_values_seam.go
  • internal/api/handlers/taste_seed.go
  • internal/api/handlers/taste_seed_test.go
  • internal/api/handlers/watch_state_service.go
  • internal/api/handlers/watch_tonight.go
  • internal/api/handlers/watch_tonight_cards.go
  • internal/api/handlers/watch_tonight_cards_access_test.go
  • internal/api/handlers/watchlist_titles.go
  • internal/api/router.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_recommendations.go
  • internal/apiv2/admin_recommendations_fixtures_test.go
  • internal/apiv2/admin_recommendations_test.go
  • internal/apiv2/recommendations.go
  • internal/apiv2/recommendations_test.go
  • internal/apiv2/router.go
  • internal/audiobooks/recommender.go
  • internal/catalog/reattribute/reattribute.go
  • internal/catalog/search_indexer.go
  • internal/catalog/search_indexer_test.go
  • internal/catalog/search_meilisearch_provider.go
  • internal/catalog/search_provider.go
  • internal/catalog/search_provider_test.go
  • internal/catalog/search_query_vector_test.go
  • internal/catalog/search_service.go
  • internal/catalog/semantic_coverage.go
  • internal/catalog/semantic_coverage_test.go
  • internal/catalogseed/service.go
  • internal/catalogseed/service_db_test.go
  • internal/catalogseed/service_test.go
  • internal/catalogseed/types.go
  • internal/config/admin_settings.go
  • internal/config/admin_settings_test.go
  • internal/config/admin_settings_unrated_test.go
  • internal/config/cached_setting_test.go
  • internal/config/unrated_content.go
  • internal/contractledger/ledger_test.go
  • internal/database/pglock/pglock.go
  • internal/database/pglock/pglock_test.go
  • internal/historyimport/service.go
  • internal/historyimport/signals_notify_test.go
  • internal/jellycompat/handlers_items.go
  • internal/jellycompat/handlers_playback.go
  • internal/jellycompat/handlers_recommendations.go
  • internal/jellycompat/handlers_recommendations_test.go
  • internal/jellycompat/playback_profile_refresh_test.go
  • internal/jellycompat/profile_refresh.go
  • internal/jellycompat/recommendations_backdrops_db_test.go
  • internal/jellycompat/router.go
  • internal/jellycompat/server.go
  • internal/jellycompat/streams.go
  • internal/jellycompat/userdata_direct.go
  • internal/metadata/anchored_identity_repair.go
  • internal/metadata/identify_sticky_db_test.go
  • internal/metadata/merge_embeddings_test.go
  • internal/metadata/merge_items.go
  • internal/metadata/merge_recommendations_test.go
  • internal/metadata/provider_id_integrity.go
  • internal/metadata/service.go
  • internal/policy/document_mutations_test.go
  • internal/policy/system.go
  • internal/policy/system_test.go
  • internal/recommendations/access_postgres_test.go
  • internal/recommendations/access_scope_test.go
  • internal/recommendations/accuracy_test.go
  • internal/recommendations/anchors.go
  • internal/recommendations/anchors_test.go
  • internal/recommendations/cluster.go
  • internal/recommendations/cluster_test.go
  • internal/recommendations/coldstart.go
  • internal/recommendations/coldstart_test.go
  • internal/recommendations/collaborative.go
  • internal/recommendations/collaborative_test.go
  • internal/recommendations/cowatch.go
  • internal/recommendations/cowatch_test.go
  • internal/recommendations/defaultrows_postgres_test.go
  • internal/recommendations/diversity.go
  • internal/recommendations/diversity_test.go
  • internal/recommendations/embed_all_test.go
  • internal/recommendations/embed_backfill.go
  • internal/recommendations/embed_backfill_test.go
  • internal/recommendations/embed_text_postgres_test.go
  • internal/recommendations/embedding_reset.go
  • internal/recommendations/embedding_reset_test.go
  • internal/recommendations/embeddings/client.go
  • internal/recommendations/embeddings/client_test.go
  • internal/recommendations/embeddings/text.go
  • internal/recommendations/engine.go
  • internal/recommendations/jobs.go
  • internal/recommendations/personal.go
  • internal/recommendations/quality.go
  • internal/recommendations/quality_test.go
  • internal/recommendations/ranking_postgres_test.go
  • internal/recommendations/reader.go
  • internal/recommendations/reader_access_test.go
  • internal/recommendations/reader_baseline_test.go
  • internal/recommendations/reader_defaults_test.go
  • internal/recommendations/reader_scope_test.go
  • internal/recommendations/reader_test.go
  • internal/recommendations/readpath_postgres_test.go
  • internal/recommendations/refresh_now_test.go
  • internal/recommendations/relevance_postgres_test.go
  • internal/recommendations/relevance_test.go
  • internal/recommendations/repo.go
  • internal/recommendations/repo_stale_test.go
  • internal/recommendations/repo_test.go
  • internal/recommendations/rotation.go
  • internal/recommendations/rotation_test.go
  • internal/recommendations/signals.go
  • internal/recommendations/signals_paging_test.go
  • internal/recommendations/signals_test.go
  • internal/recommendations/similar.go
  • internal/recommendations/similar_quota_test.go
  • internal/recommendations/taste.go
  • internal/recommendations/taste_signals.go
  • internal/recommendations/taste_signals_test.go
  • internal/recommendations/taste_test.go
  • internal/recommendations/title_counts.go
  • internal/recommendations/title_counts_test.go
  • internal/recommendations/titles.go
  • internal/recommendations/top_genre.go
  • internal/recommendations/top_genre_test.go
  • internal/recommendations/types.go
  • internal/recommendations/watch_tonight.go
  • internal/recommendations/worker.go
  • internal/recommendations/worker_postgres_test.go
  • internal/recommendations/worker_test.go
  • internal/sections/because_watched_title.go
  • internal/sections/fetcher.go
  • internal/sections/recipes/types.go
  • internal/sections/recommendation_section_test.go
  • internal/sections/recommendation_title.go
  • internal/userstore/pgstore/profiles.go
  • internal/watchsync/lists.go
  • internal/watchsync/ratings.go
  • internal/watchsync/ratings_test.go
  • internal/watchsync/service.go
  • internal/watchsync/service_test.go
  • internal/webhooksync/service.go
  • internal/webhooksync/signals_notify_test.go
  • migrations/purge_orphaned_recommendation_rows_test.go
  • migrations/sql/20261003232951_allow_cleared_taste_vectors.sql
  • migrations/sql/20261004003240_purge_orphaned_recommendation_rows.sql
  • migrations/sql/20261011170130_index_default_recommendation_rows.sql
  • scripts/ci/db-contracts.txt
  • scripts/ci/db-pins.txt
  • scripts/recs-probe/capture.sh
  • web/src/api/v2/operations.ts
  • web/src/api/v2/recommendations.ts
  • web/src/api/v2/schema.ts
  • web/src/components/WatchTonightCard.test.tsx
  • web/src/components/WatchTonightCard.tsx
  • web/src/components/WatchTonightDialog.test.tsx
  • web/src/components/WatchTonightDialog.tsx
  • web/src/components/watchtonight/CardStack.limit.test.tsx
  • web/src/components/watchtonight/CardStack.test.ts
  • web/src/components/watchtonight/CardStack.tsx
  • web/src/components/watchtonight/GenrePicker.tsx
  • web/src/components/watchtonight/SwipeCard.test.tsx
  • web/src/components/watchtonight/SwipeCard.tsx
  • web/src/hooks/queries/admin/recommendations.ts
  • web/src/hooks/queries/admin/recommendations.v2.test.ts
  • web/src/hooks/queries/keys.ts
  • web/src/hooks/queries/recommendations.test.ts
  • web/src/hooks/queries/recommendations.ts
  • web/src/hooks/queries/tasteSeed.ts
  • web/src/lib/recommendation-provider-presets.test.ts
  • web/src/lib/recommendation-provider-presets.ts
  • web/src/pages/AdminRecommendations.test.tsx
  • web/src/pages/AdminRecommendations.tsx
  • web/src/pages/Home.test.tsx
  • web/src/pages/Home.tsx
  • web/src/pages/LibraryLoadError.test.tsx
  • web/src/pages/LibraryRecommended.test.tsx
  • web/src/pages/LibraryRecommended.tsx
  • web/src/pages/Recommendations.test.tsx
  • web/src/pages/Recommendations.tsx
  • web/src/pages/RecommendationsSection.tsx
  • web/src/pages/TasteSeed.test.tsx
  • web/src/pages/TasteSeed.tsx
  • web/src/pages/admin-settings/recommendationsSettings.test.ts
  • web/src/pages/admin-settings/recommendationsSettings.ts
  • web/src/pages/sectionDedupe.test.ts
  • web/src/pages/sectionDedupe.ts

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

  • 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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 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-14T22:53:59.264915Z 015e0d6 New commits
🔒 Security Review ✅ Completed 2026-10-14T22:53:03.826722Z 015e0d6 New commits
ℹ️ 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.

@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@macroscopeapp

macroscopeapp Bot commented Oct 5, 2026

Copy link
Copy Markdown

The Validation tasks: line is incomplete. It omits Recommendations tasks Silo-Server/silo-apple#309/#310 and Silo-Server/silo-android#319/#320, whose C1–C5 exercise the changed server recommendation rows, refreshes, and access-scoped output. It also omits Web C2 and C4, which exercise the changed profile-row and empty/default-row paths. These task results are all Not run, so no previous client result is being invalidated; listing them will make post-merge validation coverage explicit.

Suggested fix (no diff; update the PR description):
Validation tasks: changes #1145 C1, C2, C3, C4, C5; changes #1146 C1, C2, C3, C4, C5; changes Silo-Server/silo-apple#309 C1, C2, C3, C4, C5; changes Silo-Server/silo-apple#310 C1, C2, C3, C4, C5; changes Silo-Server/silo-android#319 C1, C2, C3, C4, C5; changes Silo-Server/silo-android#320 C1, C2, C3, C4, C5 (all Not run)

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@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: 521d797163

ℹ️ 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 thread cmd/silo/main.go Resolved
Comment thread internal/webhooksync/service.go Resolved
Comment thread internal/catalogseed/service.go Resolved
Comment thread internal/historyimport/service.go Resolved
Comment thread internal/recommendations/repo.go Resolved
Comment thread internal/recommendations/taste.go Resolved
Comment thread internal/recommendations/worker.go Resolved
@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: 08eb340f8b

ℹ️ 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 thread internal/recommendations/worker.go Resolved
@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: 7b8d219985

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

// Every item that lost its embedding gets a search index upsert, so its
// search document drops the old vector on the next index sync.
func (w *Worker) ResetEmbeddings(ctx context.Context) (EmbeddingsReset, error) {
release, err := w.claimJobs(JobEmbeddings, JobTasteProfiles, JobRecommendations)

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 Block embedding resets during profile refreshes

In a multi-node deployment, these job claims and the stale-sweep lock do not cover refreshes already running through profileRefreshLoop. If such a refresh reads the old embeddings, the reset commits, and then the refresh stores its result, it recreates a taste vector from the old embedding space and can clear its stale marker; running the instructed embedding job does not rebuild that profile, so subsequent recommendation builds can compare the old taste vector with new-model item vectors until the nightly taste job. Coordinate the reset with all request-driven profile refreshes, or reject/wait while any are active.

AGENTS.md reference: AGENTS.md:L13-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Real but narrow. A profile refresh must be running on another node at the moment an admin resets embeddings. The reset has already deleted every embedding, so the profile's rows stay empty until the catch-up re-embeds titles. The stray vector from the old model then lasts until the profile's next signal change or the nightly taste job. Closing it fully needs coordination between nodes, such as a reset generation that refreshes check before writing. Leaving this open for a maintainer decision rather than adding that machinery here.

Comment thread internal/recommendations/similar.go Resolved
@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: c4af6aad20

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

@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: 3b9b43c958

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

@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: 34eb2a91cc

ℹ️ 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 thread internal/recommendations/similar.go Resolved
Comment thread internal/api/handlers/access_groups.go Resolved
@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: 50af709a4b

ℹ️ 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 +1239 to +1242
if lock != nil {
model = lock.Model
}
return embeddingsForModel(records, model), nil

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 Reject imported vectors without matching lock provenance

When a catalog bundle comes from another installation that uses the same model name but a different base URL, implementation, or source dimensions, this accepts its vectors solely because rec.Model == lock.Model. EmbeddingRecord carries none of the other embedding-lock provenance, and its exported vector is already padded, so the incompatible vectors are stored permanently and neither embedding pass repairs them because both the model and canonical text appear current. Skip vectors whose embedding space cannot be verified, or add the lock provenance to the bundle and validate it before import.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed that a bundle with the same model name from another installation passes this check. The bundle records only the model name today, so telling two installations apart needs a provenance field in the bundle format (for example the provider endpoint fingerprint or the lock's source dimensions). That is a format change outside this fix; I will raise it as a follow-up and leave this thread open for the maintainer.

Comment on lines +72 to +75
res, err := w.engine.repo.ResetEmbeddings(ctx)
if err != nil {
return EmbeddingsReset{}, err
}

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 Invalidate semantic search when resetting embeddings

When semantic coverage was ready before this reset, deleting the lock and embeddings does not invalidate the in-memory coverage trackers used by native and Jellyfin search; they remain ready until their two-minute refresh tick. Because search-index removals are also queued asynchronously, a model switch can temporarily send query vectors from the new configuration against old-model vectors still in Meilisearch, producing invalid rankings instead of the documented keyword fallback. The reset needs to collapse semantic readiness immediately across nodes before returning.

Useful? React with 👍 / 👎.

@Quick104 Quick104 Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct: another node's semantic-search coverage tracker keeps its last answer until its next refresh, up to about two minutes after a reset. During that window that node still sends hybrid queries while the vectors are being rebuilt. Clearing the answer on every node needs a cross-node signal (for example a Redis key the trackers check), the same coordination gap as the reset racing a refresh on another node in the earlier thread. Leaving this open with that race for a maintainer decision on whether it belongs in this PR.

@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: 267a1231da

ℹ️ 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 thread web/src/pages/AdminRecommendations.tsx Resolved
Comment thread cmd/silo/main.go Resolved
@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Quick104 and others added 5 commits October 14, 2026 19:45
The reset keeps taste profile rows and their signal counts and clears only
their vectors, so the stale sweep can rebuild them. The API doc, the
operation summary and the comments said it deleted them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d history

The capture holds a profile's history, favorites and ratings, and its
default directory sat in the working directory with nothing ignoring it;
it now defaults under .local/, which git ignores. The genre baseline
counts only completed history plus favorites, as the evaluation defines
it and the leakage check already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RequestReadRefresh's comment sat above ReadRefreshDue, SimilarItems still
said the engine does not filter for the viewer, and the reader said
rotation follows the server's time zone when it follows UTC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An error taking or releasing a profile's lock closes the session that
holds the job's cluster lock, which releases it. The taste, cache and
stale sweep loops counted every remaining profile as failed and kept
going without the lock while another server could start the same job,
and the run was recorded as completed. The lock now reports a closed
session as errJobLockLost, and the job stops with that error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review of 3cfae06: my findings, ahead of the fix commits.

I've put the new findings on their lines. Defects that earlier threads already raised get replies in those threads once the fixes are pushed, rather than new comments here. Two things apply to the branch as a whole:

  • It conflicts with main in seven files: favorites, pglock, the Jellyfin recommendations handler, the provider-ID merge, metadata service, the DB contract list, and Home. I'm pushing a merge that resolves them. It keeps main's change-only favorites and watchlist notifications through NotifySignalsChanged, and the extra backdrops on /Movies/Recommendations.
  • The beta book question (thread on repo.go:108) needs your call. #1967 made movies and series the only recommendable types by maintainer decision, but AGENTS.md says beta audiobooks and ebooks must not be gated or removed for 1.0. Either the scope rule gets an exception recorded in AGENTS.md and docs/architecture/v1-scope.md, or books come back to the rows where they were.

A summary with scores follows once the fixes are pushed and verified.

Reviewed with Claude Code (claude-opus-5-5), with a cross-check by Codex (gpt-6.1-sol).

Comment thread internal/recommendations/worker.go Resolved
globalRowsJobTimeout = 10 * time.Minute

staleSweepInterval = 5 * time.Minute
staleSweepBatch = 50

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Medium (scale), needs your call: mass stale marks drain at about 600 profiles an hour, and the nightly jobs rebuild without clearing them.

One sweep runs cluster-wide: 50 profiles every 5 minutes. Several events mark every profile at once:

  • any policy save, including permission-only or action-only edits (NotifyPolicyChanged → MarkAllProfilesStaleForPolicy, once per generation);
  • an access.unrated_content change, which marks twice;
  • an embedding backfill on the SQLite user store.

On a server with 10k profiles, that backlog takes about 17 hours. The 04:00 taste job and the 05:00 cache job rebuild every profile in that window, but only refreshProfile calls ClearStaleAt, so the sweep rebuilds the same profiles again afterwards. An embeddings reset is also refused with 409 for most of each 5-minute window while the sweep holds its lock.

Reads still filter under the current scope, so nothing leaks. The cost is rebuild work and stale rows for most of a day.

Options, any of which would help:

  1. Mark only when a scope-relevant policy domain changed, not on every generation.
  2. Let the sweep keep taking batches while a backlog remains, under its lock and a time cap, rather than one batch per tick.
  3. Have the nightly cache job clear a profile's mark when it fully rebuilt that profile after the taste job read its signals. This needs care, because the cache job does not reread signals.

I'm leaving this one to you, since each option changes how much background work a small server does.

Comment thread docs/admin-recommendations-api.md Resolved
// 5xx), say nothing about the provider.
if ctx.Err() == nil && !embeddings.InputRefused(err) {
p.vecMu.Lock()
p.vectorFailedUntil = p.vectorNow().Add(meilisearchQueryVectorFailureCooldown)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Medium-low, needs your call: a cold local embedding model turns semantic search off for a minute after each idle period.

The query-embedding call now has a 2-second budget, and any timeout while the caller is still waiting starts the 60-second cooldown. Ollama unloads an idle model by default, and the client sends no keep_alive. On a CPU-only box, loading the model for the first search after idle can take longer than 2 seconds. That search, and every search in the following minute, falls back to keyword results while the provider is healthy. The 2 seconds also covers the two embedding-lock reads in search_query_vector.go.

The base had no timeout, so a down provider stalled every search. That was worse, and the cooldown is right for a real outage.

A possible repair: on a deadline timeout, fall back for this search but start one detached, single-flight embed of the query with a longer budget, and clear vectorFailedUntil when it succeeds. That would also cover the burst fan-out raised in the earlier thread on line 735. I haven't changed this, because the right budget depends on what local models people run.

Comment thread scripts/recs-probe/capture.sh Resolved
return fmt.Errorf("check access policy generation: %w", err)
}
if !current {
return errPolicyNotLoaded

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Low, needs your call: a node that can't load the stored policy generation never rebuilds a profile.

refreshProfile returns errPolicyNotLoaded while policy.System.Current() is false, and Current compares the engine's revision with the stored generation. A strict Engine.Reload that fails compilation keeps the old revision, so Current stays false until the policy changes again. Every queued refresh, RefreshProfileNow (taste seed), and sweep refresh on that node defers. The nightly taste and cache jobs skip the check, so they rebuild under the old policy anyway.

The trigger is narrow, since boot skips a failing custom source and saves are compile-checked. The realistic case is a mixed-version cluster during an upgrade, where a newer node saves a source older nodes can't compile. If you want to cover it, Current could treat "this node attempted the stored generation and the compile failed" as current: reads on that node serve the same old policy, so rows built under it match. I haven't changed it.

Comment thread internal/recommendations/worker.go Resolved
Quick104 and others added 6 commits October 14, 2026 19:57
…ding run

With signals in a user store outside Postgres, the backfill marked every
profile stale after each 500 stored items, so on a large catalog every
profile stayed marked for the whole run and the stale sweep kept
rebuilding it against a half-built embedding space. That mark now runs
once, when the run ends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A remote removal deleted the local favorite or watchlist entry, then wrote
the shadow state, and counted the removal only after that write. When it
failed, the sync reported no list change and recommendations were not
refreshed for a removal that had happened.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without a refresh token the client cannot refresh, so the test passed
with authentication replay turned back on. It now seeds both tokens, as
the trigger tests do, and fails if the reset replays after a 401.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…de is rated

Reads dropped rated titles from cached rows by exact ID, but cached rows
hold series and a rating can be on an episode, so the series stayed until
the refresh the rating asked for finished. Reads now leave out the series
of every rated episode, as the live default rows and the worker already do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…once queued

A read that found a profile's rows missing recorded the profile as
refreshed for the next 15 minutes before queuing the refresh. When the
queue stayed full the request was dropped, and with no stale mark behind
it, the profile's rows stayed missing for another interval. A dropped
request now leaves the profile free to ask again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the conflicts with main's list sync change (#2467), which now
removes every copy of a title that shares a provider key: a removal is
still counted once the local list changes, before the bookkeeping write.
TasteSeed returns to the renamed Personalize settings page (#2398).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@macroscopeapp

macroscopeapp Bot commented Oct 14, 2026

Copy link
Copy Markdown

The PR has visible changes but no ## Evidence section or Evidence: line; the earlier request for evidence also remains unaddressed. Please add:

  • Admin Recommendations UI (web/src/pages/AdminRecommendations.tsx, web/src/pages/admin-settings/recommendationsSettings.ts): before-and-after desktop and phone-width captures of the reset action/confirmation, lock-conflict warning, and job status.
  • For You and recommendation sections (web/src/pages/Recommendations.tsx, web/src/pages/RecommendationsSection.tsx, internal/recommendations/reader.go): before-and-after captures using the same profile and catalog to show changed rows, ordering, labels, and empty-state/profile copy; include desktop and phone-width web.
  • Home and library recommendations (web/src/pages/Home.tsx, web/src/pages/LibraryRecommended.tsx, web/src/pages/sectionDedupe.ts, internal/recommendations/reader.go): before-and-after captures of the same home layout and library showing scoped row fill and cross-section duplicate removal.
  • Client-rendered recommendation API results (internal/api/handlers/recommendations_service.go, internal/recommendations/reader.go, internal/jellycompat/handlers_recommendations.go): before-and-after response excerpts for the same requests, profile, and access scope, showing the ordered titles affected by access filtering and cached recommendations.
  • Taste-seed flow (web/src/pages/TasteSeed.tsx, web/src/hooks/queries/tasteSeed.ts): a short recording of the first-run picker submission and redirect to Recommendations, including the relevant screen transition.

Name the surface and build or commit for each capture. Use the same data for each before-and-after pair.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@macroscopeapp

macroscopeapp Bot commented Oct 14, 2026

Copy link
Copy Markdown

The PR changes user-visible behavior, but its description has no ## Evidence section or Evidence: line. Please add:

  • internal/recommendations/reader.go, internal/api/handlers/recommendations_service.go, and internal/jellycompat/handlers_recommendations.go: recommendation, library, and Jellyfin rows now return different filtered items and ordering; provide before-and-after excerpts for the same API requests and screenshots of the same affected sections with the same data.
  • internal/catalog/search_meilisearch_provider.go and internal/catalog/search_indexer.go: semantic search can return different results or fall back to keyword results; provide before-and-after results for the same search query.
  • internal/recommendations/taste.go: taste-summary genres and signal counts change; provide before-and-after excerpts for the same taste-profile response.
  • web/src/pages/Home.tsx and web/src/pages/sectionDedupe.ts: earlier home rows now suppress duplicates in later recommendation rows; provide before-and-after desktop and mobile captures of the same home data.
  • web/src/pages/AdminRecommendations.tsx and web/src/lib/recommendation-provider-presets.ts: the admin page adds job status and embedding-reset UI and changes the Ollama preset; provide before-and-after desktop and mobile captures, plus a short recording of the reset confirmation flow.
  • web/src/pages/TasteSeed.tsx: empty filtered pages keep loading, and submitting picks now opens Recommendations; provide a before-and-after recording of the same picker flow, including its destination.

Name the surface and build or commit for each capture. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@Quick104

Copy link
Copy Markdown
Contributor Author

Review summary

Reviewed head: 3cfae06. Fixes pushed through 900b327.

Fit: 7/10 · Readiness: 7/10 — not ready (one policy decision open; assuming CI is green)

Needs your call

  • Beta books (thread). feat(recommendations): make recommendations more accurate and relevant #1967 made movies and series the only recommendable types, so audiobooks and ebooks left the personal rows, the global rows, the anchors, Similar Users, Watch Tonight and the taste-seed picker. AGENTS.md says beta books stay in their current state and must not be gated or removed for 1.0. Either record the exception in AGENTS.md and docs/architecture/v1-scope.md, or restore books where they were. Until one of those happens, this conflicts with a repository rule, and that holds the verdict at not ready.
  • Stale-sweep throughput (worker.go line 39). Every policy save, unrated-content change or SQLite-store backfill marks every profile, and the sweep drains about 600 an hour. The nightly jobs rebuild without clearing marks, so profiles are rebuilt twice. The comment lists three options.
  • Cold local model and the 60-second cooldown (search provider line 747), and a node that can't load the stored policy generation (worker.go line 1355). Both are narrow, with suggested repairs on their lines.

Fixed on this branch

  • Two merges with main resolved nine conflicted files. Main's change-only favorites and watchlist notifications, the extra backdrops on /Movies/Recommendations, the provider-key list removals and the renamed Personalize settings page all go through this branch's code.
  • 13 fixes, each with a regression test that fails without it:
    • the Gemini key following redirects to another host;
    • one unembeddable item ending every embedding run;
    • jobs running on after losing their lock session;
    • v1 Watch Tonight answering 500 where it answered an empty 200;
    • SQLite-store profiles re-marked every 500 embeddings;
    • list removals not counted when their bookkeeping failed;
    • a rated episode not hiding its series in cached rows;
    • a dropped read refresh blocking the next one for 15 minutes;
    • a reset test that couldn't catch replay;
    • the reset docs;
    • the probe script's output directory and history filter;
    • three stale comments.
  • The PR body now says feat(recommendations): make recommendations more accurate and relevant #1967 is part of this branch, lists the v1 label changes and the book scope under Risks, and links the evidence page.

Other feedback

All 26 open bot threads have replies. Eight are fixed. Four are refuted at this head: the two stale_at > updated_at threads, the access-helper scope, and peers keeping refusal records. The rest are confirmed or plausible low-severity races, each answered with its recovery path and a suggested repair. These four are still open with the author: the webhook notify after a failed history write, episode dislikes and series anchors (a product question), abandoned titles in the live default rows (fixing it needs one shared progress walk), and the access-group delete race.

Validated features

I couldn't read the validation board (the token lacks read:project). The task bodies show every recommendation case as Not run, so the Validation tasks: line now says "unblocks". #1180 and #1181 (restricted profiles) are Not run too.

Validation

The fixes were verified with tests against a migrated pgvector database, not on a running server. The full Go gate, make test-go, make test-db-pins (426 pins and contracts), the web build checks and every generated-contract check pass. make test-web passes except a local pgs.test.ts timeout in code this PR doesn't touch.

Evidence: https://evidence.siloserver.org/r/silo-server/pr-1966/

User manual and apps

  • Manual. The siloserver.org recommendations page needs an update, and no docs issue exists yet. The page should cover the Reset Embeddings card as the way to change models (it currently says not to switch models once the lock appears), the Ollama preset's qwen3-embedding:0.6b, the connection check refusing models wider than 3072 dimensions, and the job cards' last-run, catch-up and stale-sweep lines.
  • Apps. Neither app needs a change. Android reads signal_counts, whose numbers only get smaller, and no client keys rows by title.
  • Overlap. fix(recommendations): keep recommendation lists inside a profile's access #2255 changes the same v1 list and Jellyfin Similar access paths. Whichever merges second needs a rebase.

Scores

  • Fit 7. This fixes real 1.0 defects in a 1.0 feature: a credential leak, access scope and cross-server correctness. It stretches in three named ways: a new v2 admin operation (justified, since it replaces SQL), a large stale-mark and advisory-lock state machine whose races took several review rounds, and one PR carrying two (the one-concern box is unchecked). The book scope is the open decision.
  • Readiness 7. The approach holds. What remains is the throughput design question, a handful of low-severity races with nightly recovery, and validators' runs of Recommendations — Server #1145 and Recommendations — Web #1146.

Reviewed with Claude Code (claude-opus-5-5) and claude-sonnet-5-5 subagents, with a Codex (gpt-6.1-sol) cross-check.

@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: 900b32750f

ℹ️ 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 thread internal/recommendations/jobs.go Resolved
…r lock

A job only noticed its cluster lock session had closed when it next took a
profile lock, and the embedding and co-watch jobs take none. Once the
session closed, another server's run or an embeddings reset could take the
lock while the old run kept storing vectors or pruning co-watch pairs.

The embedding run now checks the session before storing each provider
response, and the co-watch run before each write, and both stop with
errJobLockLost when it has closed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@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: 015e0d6d92

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

func (h *RecommendationsHandler) filterRecommendations(ctx context.Context, userID int, profileID string, items []recommendations.ScoredItem) []recommendations.ScoredItem {
items = h.excludeWatchedRecommendations(ctx, userID, profileID, items)
return h.excludeLowRatedRecommendations(ctx, userID, profileID, items)
return h.excludeRatedRecommendations(ctx, userID, profileID, items)

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 Exclude rated titles before limiting Because You Watched

When a profile has rated highly ranked candidates, Engine.BecauseYouWatched returns exactly the requested limit and this newly broadened filter then removes every rated title without backfilling from deeper candidates. Both v1 and v2 can therefore return a short or empty Because You Watched list even when enough unrated candidates exist; include rated IDs in the engine's pre-ranking exclusion set or fetch additional candidates before applying the limit.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refuted. The engine leaves rated titles out before it applies the limit. Engine.BecauseYouWatched builds its exclusion set with BuildExclusionSet, which includes every title the profile rated, resolved to canonical IDs so a rated episode stands for its series (personal.go:400, signals.go). becauseYouWatched passes that set to FindSimilar as query exclusions and removes it from the blended co-watch candidates before MMR picks limit (personal.go:428-455). The server always builds the engine with the ratings repo (cmd/silo/main.go:2703).

So the handler's rated filter only catches a rating stored between the engine's read and the handler's, and can't shorten the row in practice. TestBuildExclusionSetLeavesOutRatedAndAbandonedTitles covers the set. No change.

Comment thread internal/recommendations/jobs.go Resolved
A lock session check ran under the job's own deadline, so a connection
that stopped answering held an embedding run, and its claim, for up to a
day. The check now gives up after jobLockTimeout and stops the job as
having lost its lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 1 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers

@Quick104
Quick104 merged commit 7b680d9 into main Oct 14, 2026
23 checks passed
@Quick104
Quick104 deleted the fix/recs-quality branch October 14, 2026 23:16
Quick104 added a commit to blurbery/silo-server that referenced this pull request Oct 15, 2026
Conflicts:
- internal/api/handlers/items.go: keep the lookup and expansion split and
  carry Silo-Server#2465's played parameter, so series and season unwatch still skip
  the episode listing.
- internal/contractledger/ledger_test.go: keep the clearResumePosition row
  and Silo-Server#2425's watchlist-title wording.
- internal/recommendations/taste_signals_test.go: Silo-Server#1966's stale-abandonment
  rule gives a recent low-progress row no weight, so the cleared-position
  case moves into its table test.
- web/src/components/MediaItemMenu.tsx: keep Reset Progress ahead of
  Silo-Server#2433's personal-list entries.

Main also changed two things the reset used without a textual conflict:
- Silo-Server#1966 replaced triggerProfileRefresh with notifySignalsChanged, so
  ClearResumePosition now calls the new notifier.
- Silo-Server#2425 made viewerNoContentMutation naturally idempotent for favorites
  and watchlist writes. clearResumePosition registers its operation
  directly so it stays non_retryable, as unmarkWatched does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rangoDJ added a commit to rangoDJ/silo-server that referenced this pull request Oct 15, 2026
Main (Silo-Server#1966) replaced the progress and watched handlers' profile refresh
with notifySignalsChanged. Keep that; the progress handler keeps its
EpisodeLookup and both events keep their series_id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104 Quick104 mentioned this pull request Nov 23, 2026
2 tasks done
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