Skip to content

[bug] Admins see a stale smart collection count after a scan adds or removes titles #3697

Closed

Description

@zZebrahz

What happened

After a library scan adds or removes titles, a server smart collection's card keeps showing the old title count to admins and other accounts with no library or rating limits, for up to an hour. The collection's members are already right: opening it lists the new titles. Only the number on the card, in the Collections page, the library Collections tab and the admin list, is stale. Profiles with a limit see the correct count straight away, because theirs is computed fresh.

Steps to reproduce

  1. As an admin, create a server smart collection whose rule matches titles that a scan will add, for example "Added in the last 7 days".
  2. Add a new title to one of its libraries and let the scan finish.
  3. As the admin, open Collections: the card shows the old count. Open the collection: the new title is there.
  4. Sign in as a profile with a rating limit or restricted libraries: its card shows the new count.

On a local sandbox of build 2072 · 4018816da, after adding two titles to a library, the smart collection's card read 1 title for the admin account and for an unrestricted regular account, while both listed 3 titles inside it; a regular account with restricted libraries saw 3 on the card and a PG profile saw 2 (agent runtime testing, confirmed by the maintainer by hand as the admin).

Expected behavior

A smart collection's count matches its members for every viewer soon after a scan changes the libraries it draws from, not only on the periodic refresh.

Silo version / commit

Build 2072 · 4018816da (latest main on 2026-11-09).

Deployment

Not recorded.

Area

Libraries, scanning, and metadata

Clients affected

  • Web UI
  • Android
  • iOS/tvOS/macOS
  • Jellyfin-compat client (Infuse, Findroid, ...)
  • Other/not client-specific

Client app and device

Web UI in a desktop browser. The apps read the same item_count from the API, so they show the same stale number to unrestricted viewers.

Relevant logs

None.

Technical notes

Unrestricted viewers get the stored library_collections.item_count_cached. PR #2835 made restricted viewers count live and left unrestricted ones on the stored value ("a smart collection's cached count can be an hour old"). SmartCountRefresher (internal/catalog/smart_count_refresher.go) updates that value shortly after startup, then hourly (internal/api/router.go), and for one collection when an admin creates or edits it (refreshSmartCountAsync in internal/api/handlers/admin_collections_service.go). Nothing refreshes it when a scan adds or removes titles.

Possible fixes: refresh the stored counts of smart collections that draw from a library when a scan of that library changes its titles (debounced, so a large scan doesn't refresh repeatedly), or count unrestricted viewers live too, as restricted viewers already are. Open PR #2728 also edits smart_count_refresher.go and how counts are read, so the two should be coordinated.

Validation: Collections Server #193 S4 (smart rules reflect changes to library contents), Web admin #194 A2, Web #195 W4, and the client tasks' C4, parent #192, AC3. Blocking, by maintainer decision on 2026-11-09.

AI harness

Claude Code

AI tool(s)

GitHub CLI, Git

AI model(s)

Claude Opus 5.5 (claude-opus-5-5)

AI involvement

AI-assisted

Independent or adversarial review

n/a. Found during human validation on a local sandbox of build 2072 and reproduced by the maintainer as the admin; the counts per account come from agent runtime testing on that sandbox, and the cause from source review of 4018816da.

Confirmations

  • I searched open and recently closed issues and pull requests, and this is not already reported
  • I reproduced this myself on a real deployment
  • Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above

Activity

  1. added theissue type on Nov 9, 2026
  2. moved this to Todo in Silo v1.0.0on Nov 9, 2026
  3. added
    bug
    impact: polish
    priority: P2
    triaged
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimpact: polishpriority: P2triaged

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions