Skip to content

Metadata enrichment fans out to ALL enabled providers when a library/content-level has no enabled chain entry (media-type-blind fallback) #105

Closed

Description

@fluxis

Summary

ResolveChain falls back to every enabled metadata-provider plugin in the system whenever a library + content-level has no enabled library_provider_chains entry. The fallback ignores the library's media type and the provider's declared content-level support, so a provider can be invoked for content it doesn't handle.

Observed in production: the silo.audiobook-metadata plugin was repeatedly called with anime/movie/series titles, hammering external audiobook providers (~120 errors/min). The sustained external-call storm saturated egress and caused unrelated plugin gRPC calls to time out.

Where

internal/metadata/chain.go — ResolveChain (~line 234):

chainEntries := GetChain(folder, contentLevel)          // entries bound to THIS folder+level
enabled      := filter(chainEntries, e.Enabled)         // drop disabled entries
if len(enabled) > 0 {
    return resolveChainEntries(enabled)                 // OK: scoped to the library
}
// fallback when no ENABLED entry exists for this folder+level:
return resolveEnabledProvidersByPriority(contentLevel)  // BUG: every enabled provider, globally

resolveEnabledProvidersByPriority (~line 290) → ListEnabledMetadataCapabilities returns every metadata_provider.v1 capability whose plugin_installations.enabled = true, with no filter on media type or content-level support. LookupDefaultPriority returns 0 for content levels a provider doesn't declare, but the sort (~lines 311-320) only places priority-0 providers last — it keeps them in the list.

Trigger

Scheduled background enrichment, which resolves a chain per content level:

  • metadata.MatchWorker.Run — 30s ticker (cmd/silo/main.go:1049) → MetadataService.Process
  • RefreshMetadataTask / scheduled refresh (ModeScheduledRefresh, registered cmd/silo/main.go:1517)

processInternal resolves multiple levels per item: service.go:835 (item), :1149 season, :1184 episode. A series item whose library only declares a series-level chain (no season/episode entry) hits the global fallback for those levels.

Reproduction (observed config)

  • silo.audiobook-metadata declares default_priority: {"audiobook": 2} only — no movie/series/season/episode.
  • It is listed as a priority-2 entry in three video libraries, but every one of those chain entries is enabled = false.
  • Each video library declares only one content level (Movies→movie, "TV Shows - Anime"→episode, "TV Shows"→series). Resolving the other levels for a series item returns no enabled entry → global fallback → audiobook provider invoked on video titles.

Symptom asymmetry (diagnostic)

  • Disabling the plugin installation stops the storm (ListEnabledMetadataCapabilities filters pi.enabled = true).
  • Disabling the chain entries does not — the fallback path never consults chain entries.

Proposed fix

Primary (root cause): in resolveEnabledProvidersByPriority, exclude providers whose declared default_priority for the requested contentLevel is 0 (unsupported), instead of sorting them last. A provider then only runs for content levels it declares.

Defense-in-depth to consider:

  • Decide whether an all-entries-disabled chain should fall back to the global set at all, vs. meaning "no providers for this level" (disabled vs. unconfigured are currently conflated).
  • Library chains only declare one content level per video library here; season/episode levels were never explicitly configured, which is what lets the fallback fire.

Impact

  • Wrong-media-type providers invoked on every scheduled enrichment pass for any content level lacking an enabled chain entry.
  • External-call storms against provider backends; egress saturation can cascade into unrelated plugin-call timeouts.

Activity

  1. added a commit that references this issue on Jun 9, 2026
    9cba9da
  2. added 6 commits that reference this issue on Jun 9, 2026
    8779338
    3319c84
    9f264c0
    d7ce9ad
    66a4146
    2c714e4
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions