Repository navigation
fix(episodes): retry the variant F join marker on a lost compare-and-swap - #24974
Merged
Merged
Conversation
…swap The F marker is written in a second transaction after the recorded attach, using the state version read at attach time. A live episode takes a write on every moment, so that version is usually stale by then, and the marker gave up on the first EpisodeConflict. In prod every F decision since the 100% ramp fell back to the time-only join with reason=other and no log line. Re-read the episode and retry (three attempts in all) while the join still stands: live, the conversation still a member, and not already marked. Merge into the fresh pending_boundary instead of overwriting it from the stale copy. Log the conflict reason when it gives up. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017CeWy1WMfSseNThvZxKRKb
Codex Review Summary: ✅ CompletedThis 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: 7ac655a943
ℹ️ 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".
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017CeWy1WMfSseNThvZxKRKb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Episode join variant F has been at 100% since 2026-11-08 06:29Z and has made zero Jev decisions. Every attempt (78 by 07:45Z today, all in the pusher) fell back to the time-only join with
reason=otherand no log line. Among theothersources inutils/episodes/f_join.py, onlymark_pending'sEpisodeConflictbranch is silent. The logs show onesynced_failed, which accounts for one fallback, and noprevious_failed,gate_failedorrecheck_failed.mark_pendingwrites the F marker in a second transaction after the recorded attach, using thestate_versionfrom attach time. A live episode is written on every moment, so that version is usually stale by the time the marker is written, and the marker gave up on the first conflict. It also rebuiltpending_boundaryfrom the stale copy, which could drop a concurrent writer's marker.Now
mark_pending:pending_boundary;event=episode_f_join outcome=pending_conflict reason=<conflict> attempts=<n>when it gives up, so the next readout shows which conflict it was.Known limit: if the conflict is
current_episode_changedrather than a stale version, retrying won't help. The new log line will show that, and that case needs a follow-up.Related, not changed here: backend-listen still serves
backend:9ad243c, which has no F code, so live joins handled by listen can't use F until it rolls.Product invariants affected
none
How it was verified
pytest tests/unit/test_episode_f_join.py tests/unit/test_episode_f_join_guards.py: 190 passed (Python 3.11 venv in a cloud sandbox).scripts/backend-python-format --writeon both files: no changes.scripts/pr-preflight --pr-body-file: 36 checks passed.pending_conflictlog line, plus F fallbacks per hour compared with today's 1 to 4.Tests
test_a_marker_that_loses_the_cas_rereads_and_merges_into_the_fresh_live_episode: fails before this change (one commit, then a fallback). It now retries at the fresh version and keeps a concurrentc0marker.test_a_marker_stops_retrying_once_the_join_no_longer_stands: episode missing, closed, member gone, or already marked → one attempt, then a fallback.test_a_marker_gives_up_after_bounded_retries: exactlyMARK_PENDING_ATTEMPTScommits, then one fallback.UI evidence
UI-Evidence: none -- backend only
Failure class (fixes)
Failure-Class: none
Generated by Claude Code