Repository navigation
Fix diversity deadline drift and rejected lookup leases - #19
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4a5f8c189
ℹ️ 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".
| ep.Diversity.Status = awaitingIndex ? "waiting" : providers?.Count > 1 ? "resolved" : "retired"; | ||
| ep.Diversity.Reason = awaitingIndex ? "awaiting_indexing" : providers?.Count > 1 ? "multiple_sources" : "ineligible"; |
There was a problem hiding this comment.
Give resolved entries a new deadline after provider collapse
When an entry previously resolved with multiple sources, its NextAttempt is null; if a routine refresh later replaces those versions with one provider, this branch changes the entry to waiting / awaiting_indexing without assigning a deadline. Re-indexing only changes the reason, while both GetDiversityImportCatalogAsync and the in-memory candidate predicate exclude a null NextAttempt, so the item can never regain diversity. Preserve the old deadline only for an already-waiting entry; a resolved/retired entry that becomes single-source needs a fresh six-hour deadline.
AGENTS.md reference: AGENTS.md:L13-L14
Useful? React with 👍 / 👎.
Routine successful refreshes temporarily move episodes to awaiting indexing. In 0.42.14, re-indexing restarted the six-hour diversity window, allowing hourly refreshes to postpone diversity indefinitely. Preserve the existing due time and counters across that transient state while continuing to forbid dispatch until indexed.
Completed diversity lookups now settle their own leases before returning on final guard rejection. Observe or generation changes defer them without a failure penalty; blocks, ownership and ineligibility retire them immediately. A stale result cannot clear a replacement lease. Ordinary refresh authorization and publication behavior remain guarded.
Addresses both Codex findings on #18. Version metadata advances to 0.42.15. README and the queue contract specify the precise state transitions and legacy-state behavior; existing delayed entries are not reset or backdated.
Validation: the unpatched code failed seven new coordinator regressions. The patched pinned Emby 4.10.0.40 build passes all 271 tests, including six hourly refresh/re-index cycles, SQLite reopen and due additive publication, six in-flight guard transitions, replacement-lease protection and eight policy indexing cycles. Repository hygiene passes. Synthetic source URLs do not establish playback. Production deployment is tracked separately in the stack handoff.