Skip to content

fix(episodes): retry the variant F join marker on a lost compare-and-swap - #24974

Merged
Git-on-my-level merged 2 commits into
mainfrom
claude/project-thread-4roadc
Nov 9, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
claude/project-thread-4roadc

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

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=other and no log line. Among the other sources in utils/episodes/f_join.py, only mark_pending's EpisodeConflict branch is silent. The logs show one synced_failed, which accounts for one fallback, and no previous_failed, gate_failed or recheck_failed.

mark_pending writes the F marker in a second transaction after the recorded attach, using the state_version from 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 rebuilt pending_boundary from the stale copy, which could drop a concurrent writer's marker.

Now mark_pending:

  • re-reads the episode and retries, three attempts in all, while the join still stands: live, the conversation still a member, and not already marked;
  • merges into the fresh pending_boundary;
  • logs 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_changed rather 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 --write on both files: no changes.
  • scripts/pr-preflight --pr-body-file: 36 checks passed.
  • Not verified in prod. The pusher isn't scraped until fix(metrics): supply GMP scrape token and collector RBAC #24961 lands, so the check after deploy is the new pending_conflict log 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 concurrent c0 marker.
  • 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: exactly MARK_PENDING_ATTEMPTS commits, then one fallback.

UI evidence

UI-Evidence: none -- backend only

Failure class (fixes)

Failure-Class: none


Generated by Claude Code

View guided diff Turn on auto-fix

…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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T08:28:14.778867Z 1d3a789 New commits
ℹ️ 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: 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".

Comment thread backend/utils/episodes/f_join.py Resolved
@Git-on-my-level
Git-on-my-level merged commit c59aee8 into main Nov 9, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the claude/project-thread-4roadc branch November 9, 2026 08:44
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.

2 participants