Objective

Encode non-default Prowlarr indexer priorities into scripts/setup-prowlarr.sh (and the orchestrator path) so the values survive fresh installs, volume resets, and any future fix that makes the script truly declarative.

Context

On 2026-05-16, six Industry S01 episodes plus AoT S04E01 were stuck in qBittorrent (forcedDL, 0 peers, 0 KB/s) after Sonarr/Prowlarr picked the only available source: 1337x re-uploads of dead-swarm public-tracker releases. The healthy anime grabs all came from Nyaa.si. To bias future grabs toward live swarms, indexer priorities were changed at runtime via the Prowlarr API:

IndexerPriority
Nyaa.si15
EZTV20
TokyoTosho25 (default)
YTS25 (default)
1337x40

Lower number = preferred. Sonarr and Radarr were synced via POST /api/v1/command {"name":"ApplicationIndexerSync","forceSync":true}.

The API change persists across docker compose up/down because the values live in ~/docker/media-stack/config/prowlarr/prowlarr.db, and setup-prowlarr.sh:67-69 currently short-circuits when an indexer already exists. But this is fragile:

  1. AGENTS.md explicitly states setup scripts must be declarative — “define the desired state and always apply it: GET existing, PUT to update if present, POST to create if missing. Never skip configuration just because the resource already exists.” A future fix to honor that contract will overwrite the priority back to 25.
  2. The hardcoded .priority = 25 lines at scripts/setup-prowlarr.sh:92 and :112 are the de-facto source of truth; they should reflect the real desired state.
  3. Any fresh install (docker compose down -v + re-init) re-runs the orchestrator and resets priorities to 25.

Approach

Do this in a fresh worktree off main, not in feature-opus-4-7-issue-32 (which is the terraform-eval Sonarr branch — unrelated concerns).

  1. Drive priority from a per-indexer argument in add_indexer() rather than the hardcoded 25. Default stays 25; callers pass overrides where needed.
  2. Pass overrides in the add_indexer invocations at lines ~248-267: Nyaa.si=15, EZTV=20, 1337x=40. TokyoTosho and YTS stay at default.
  3. While here, fix the setup-prowlarr.sh:67-69 early-return so the script is actually idempotent the way AGENTS.md says it should be — issue a PUT to update existing indexers’ priority (and any other fields that drift). This is the underlying drift bug that lets manual API edits stick.
  4. Manual test: docker compose up -d orchestrator → confirm priorities match desired state in Prowlarr + that Sonarr/Radarr received the sync.

Next Actions

  • Create new worktree from main: wt switch-create persist-indexer-priorities ~/docker/media-stack
  • Add a priority argument to add_indexer() in scripts/setup-prowlarr.sh (default 25)
  • Set Nyaa.si=15, EZTV=20, 1337x=40 at the call sites
  • Fix the INDEXER_EXISTS early-return at scripts/setup-prowlarr.sh:67-69 so the script PUTs updates instead of skipping (per AGENTS.md idempotency rule)
  • Test by re-running orchestrator: docker compose up -d orchestrator and docker compose logs orchestrator
  • Verify priorities in Prowlarr API + that ApplicationIndexerSync propagated to Sonarr/Radarr
  • Open PR against main with the fix

Resources

  • Repo: ~/docker/media-stack
  • Script: scripts/setup-prowlarr.sh (lines 67-69, 92, 112, 248-267)
  • Convention: AGENTS.md § “Idempotency” — defines the GET/PUT/POST contract
  • Live API used for the runtime change (for reference):
    • GET /api/v1/indexer/{id} then mutate .priority then PUT /api/v1/indexer/{id}
    • POST /api/v1/command {"name":"ApplicationIndexerSync","forceSync":true} to push to Sonarr/Radarr
  • Prowlarr default priority is 25; valid range 1-50 (lower = preferred).

Notes

Underlying root cause that prompted the priority change: dead public-tracker swarms for older non-anime content. Industry S01 (2020) is only on 1337x among the configured indexers, and the reported seed counts there are stale entries the trackers haven’t culled. Lowering 1337x’s priority helps for any title that ALSO exists on EZTV/Nyaa.si; it does nothing when 1337x is the only source. A more durable fix for old non-anime is adding Usenet (Newshosting + NZBGeek/NZBFinder) or a private tracker (BTN/BHD) — that’s out of scope for this project but worth tracking separately.

Related session work the same day:

  • Bulk-deleted + blocklisted 6 stuck Sonarr queue items (persisted in Sonarr DB, no code change needed)
  • Manually imported My Hero Academia S00E23 More [VARYG] after Sonarr’s parser rejected the misnamed filename S08E147 (file is now in the library; one-off, no code change needed)

Decisions

2026-05-16 — Apply runtime change first, encode in source-of-truth second

Status: decided

Context: Stuck downloads needed unblocking immediately. Editing setup-prowlarr.sh requires a separate branch + PR + orchestrator re-run; the user wanted the queue cleared today.

Decision: Apply Prowlarr API changes live now; track the source-of-truth fix as this project.

Alternatives considered: (a) Skip the API change and only do the script fix — leaves stuck downloads in place. (b) Only do the API change — fragile, reverts on fresh install per AGENTS.md contract.

Rationale: Two-phase split matches the urgency of each concern. API change is reversible and the data layer (Prowlarr DB) is durable enough for the interim.

DIY NAS