Repository navigation
fix(recommendations): make the recommendation pipeline correct, isolated and observable - #1966
Conversation
|
Important Review skippedToo 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
📒 Files selected for processing: 272
You can disable this status message by setting the
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
The Suggested fix (no diff; update the PR description): Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
There was a problem hiding this comment.
💡 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".
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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".
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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".
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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".
| if lock != nil { | ||
| model = lock.Model | ||
| } | ||
| return embeddingsForModel(records, model), nil |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
| res, err := w.engine.repo.ResetEmbeddings(ctx) | ||
| if err != nil { | ||
| return EmbeddingsReset{}, err | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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".
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
left a comment
There was a problem hiding this comment.
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 anddocs/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).
| globalRowsJobTimeout = 10 * time.Minute | ||
|
|
||
| staleSweepInterval = 5 * time.Minute | ||
| staleSweepBatch = 50 |
There was a problem hiding this comment.
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_contentchange, 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:
- Mark only when a scope-relevant policy domain changed, not on every generation.
- Let the sweep keep taking batches while a backlog remains, under its lock and a time cap, rather than one batch per tick.
- 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.
| // 5xx), say nothing about the provider. | ||
| if ctx.Err() == nil && !embeddings.InputRefused(err) { | ||
| p.vecMu.Lock() | ||
| p.vectorFailedUntil = p.vectorNow().Add(meilisearchQueryVectorFailureCooldown) |
There was a problem hiding this comment.
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.
| return fmt.Errorf("check access policy generation: %w", err) | ||
| } | ||
| if !current { | ||
| return errPolicyNotLoaded |
There was a problem hiding this comment.
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.
…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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
The PR has visible changes but no
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 |
|
The PR changes user-visible behavior, but its description has no
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 |
Review summaryReviewed 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
Fixed on this branch
Other feedbackAll 26 open bot threads have replies. Eight are fixed. Four are refuted at this head: the two Validated featuresI couldn't read the validation board (the token lacks ValidationThe fixes were verified with tests against a migrated pgvector database, not on a running server. The full Go gate, User manual and apps
Scores
Reviewed with Claude Code (claude-opus-5-5) and claude-sonnet-5-5 subagents, with a Codex (gpt-6.1-sol) cross-check. |
There was a problem hiding this comment.
💡 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".
…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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
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]>
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]>
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:
transport error quoting the request URL was copied into
search_diagnostics.fallback_reason. The admin embedding connection checksent the saved embedding token to whatever base URL a draft named.
qwen3-embedding:latest, the 8Bmodel, 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.
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.
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.
For You, and favorites and taste-seed picks were recommended straight back.
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
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.one server at a time, and every run is recorded in
task_executionswithits counts; admin status shows the last run, lock conflicts and cache age.
One
NotifySignalsChangedentry point is called by handlers, historyimport, 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.Resolver(or the policyresolver) 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/Recommendationsnow reads the cached rows; the duplicatelive pipeline it used is deleted.
profile with no positive signal keeps its row with a
NULLtaste 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.
the v2 per-section endpoints return
500when a section fails instead of anempty
200(v1 keeps the empty section).Watch Tonight dialog and six hooks) are removed, along with settings that
did nothing.
The durable rules are in
docs/architecture/recommendations.md.Validation
make test-go, web lint/format/build/budget,make test-web, and everycontract, fixture, migration and path check).
make test-db-pinsagainst a fresh migrated pgvector database: all 106query-budget pins and all 114 database contracts pass. The new
recommendation DB tests are in
scripts/ci/db-contracts.txt, so CI runsthem.
qwen3-embedding:0.6b: Server C2, C4 and C5pass, the embeddings reset and library row fill pass, and the connection
check rejects
qwen3-embedding:latest(4096 dimensions). Server C3 failedbefore feat(recommendations): make recommendations more accurate and relevant #1967 merged into this branch (a new profile on an idle server got
no rows); feat(recommendations): make recommendations more accurate and relevant #1967 fixes it.
server, running this branch with feat(recommendations): make recommendations more accurate and relevant #1967; the results are in
feat(recommendations): make recommendations more accurate and relevant #1967.
gate,
make test-go,make test-db-pins(all 426 pins and contracts,including five new DB tests), the web lint, format, build and budget
checks, and every generated-contract and path check pass.
make test-webpasses except a
pgs.test.tstimeout on the local machine, in code this PRdoesn't touch. The review fixes were verified with tests, not on a running
server.
packages against a migrated pgvector database,
make test-db-pinsandmake lint-changedpass.Risks
user_taste_profiles.embeddingbecomes nullable, and orphanedrecommendation rows for deleted Postgres-backed profiles are deleted.
/api/v1changes, all as bridge fixes or shared-code effects: the four v1list endpoints drop inaccessible titles; v1 job triggers answer
409whenanother 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 LikeYou 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.
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_countsnow count titles, so clients' "N signals" numbers shrink.Cluster rows reshuffle once on upgrade because seeding no longer uses decayed
weights.
reset briefly holds four.
first and the catch-up pass rebuilds them.
access.unrated_contentchange or a SQLite-storeembedding 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
AI Disclosure
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.
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.
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
Worker.ResetEmbeddingsoperation with conflict errors (ErrStaleSweepRunning,ErrCatalogImportRunning,ErrEmbeddingSettingsPendingRestart)rowBuilderreplacesEngine.ForYouinternals with anchored main-row construction, quality priors, recency boosts, bounded genre caps, profile-relative cluster labels, and deterministic daily row rotationRecommenderinterface methods now take acatalog.AccessFilter, SQL queries enforce library and maturity limits, and v1 handlers drop inaccessible items and inaccessible anchorsNotifySignalsChangedfrom ratings, progress, watch/webhook sync, settings, and access-scope changesEngine.EmbedItem/EmbedAllmoved out ofsimilar.go,RecommenderandrecommendationReaderinterfaces changed signatures,user_taste_profiles.embeddingis now nullable (migration20261003232951), v1 endpoints convert item-fetch failures to empty responses while v2 returns errors, and public row reads are capped atMaxRowReadLimit(50)Macroscope summarized 65b1a70.