Skip to content

Fix diversity deadline drift and rejected lookup leases - #19

Merged
OneHotTake merged 2 commits into
mainfrom
fix/diversity-lifecycle-guards
Oct 4, 2026
Merged

OneHotTake merged 2 commits into
mainfrom
fix/diversity-lifecycle-guards

Conversation

@OneHotTake

Copy link
Copy Markdown
Owner

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T14:28:25.471580Z b4a5f8c PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +59 to +60
ep.Diversity.Status = awaitingIndex ? "waiting" : providers?.Count > 1 ? "resolved" : "retired";
ep.Diversity.Reason = awaitingIndex ? "awaiting_indexing" : providers?.Count > 1 ? "multiple_sources" : "ineligible";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@OneHotTake
OneHotTake merged commit 8601f10 into main Oct 4, 2026
2 checks passed
@OneHotTake
OneHotTake deleted the fix/diversity-lifecycle-guards branch October 4, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant