Skip to content

fix(episodes): guard placed sync retries before recorded reads - #24892

Merged
Git-on-my-level merged 4 commits into
mainfrom
claude/dropped-s1-cubic-24828
Nov 9, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
claude/dropped-s1-cubic-24828

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Requested by David

What changed and why

Synced episode F retries ran the recorded-episode read and boundary evaluation before the guard returned (backend/utils/episodes/service.py). The guard now runs first, so a retry that should be skipped does no recorded reads. This is the follow-up to Cubic's P2 review on #24828, which was never opened. Source: dropped-work triage item K4.

Pre-push file budget was raised to 3600s (BACKEND_UNIT_FILE_BUDGET_SECONDS) because host load was around 70; every test still runs and must pass.

Follow-up (4da90f9, lead2 ruling on the Luna Minor race). Moving the guard earlier widened a race. A concurrent attach could place the candidate after the owner snapshot and before f_join.uncertain, and nothing re-checked ownership before the Jev call. The early placed-retry guard stays. The candidate's placement is now re-checked before settlement and again immediately before ask_same_occasion_f, and the existing post-call check is kept. The documented read budget rises from 24 to 26 including close (13 to 15 without close). This narrows the window; it is not a cross-request at-most-once guarantee.

Product invariants affected

none

How it was verified

  • backend/.venv/bin/python -m pytest tests/unit/test_episode*.py tests/unit/test_episodes_*.py tests/unit/test_episode_f_join.py -q via bin/omi-heavy: 1000 passed, 381s, rc=0.

  • backend/.venv/bin/python -m pytest tests/unit/test_firestore_query_shapes.py -q alone: 557 passed (470s). The pre-push run exceeded the 900s file budget under load; the budget was raised for this push.

  • 4da90f9: 33 episode test files, 896 passed; test_episode_f_join.py rerun, 118 passed. Both run through bin/omi-heavy. Pyright: 0 new errors.

Tests

Regression tests in tests/unit/test_episode_f_join.py: the already-placed retry does no recorded reads, and a deterministic concurrent attach committed after the owner snapshot and before uncertain yields no settlement and no Jev call.

UI evidence

UI-Evidence: none -- backend change only

Failure class (fixes)

Failure-Class: none

Line-Count-Exception: backend/utils/episodes/service.py | 2217 -> 2222 | the five lines are the ownership re-check before settlement that closes the race lead2 ruled FIX-FIRST; splitting service.py is out of scope for this follow-up

Rollback: git revert of the commit.

View guided diff Turn on auto-fix

@Git-on-my-level Git-on-my-level self-assigned this Nov 7, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 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-09T13:25:20.855503Z 27f7870 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.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 3 files

You’re at about 95% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread backend/utils/episodes/service.py Resolved
Preserve the early placed-retry guard and decline concurrent placement
before settlement and immediately before Jev. Keep the post-call check,
cover both interleavings, and account for the two additional reads.

Failure-Class: none
@Git-on-my-level
Git-on-my-level merged commit 59ad0cb into main Nov 9, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the claude/dropped-s1-cubic-24828 branch November 9, 2026 17:31
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