Repository navigation
fix(episodes): guard placed sync retries before recorded reads - #24892
Merged
Merged
Conversation
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.
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
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
Failure-Class: none
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.
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 beforeask_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 -qviabin/omi-heavy: 1000 passed, 381s, rc=0.backend/.venv/bin/python -m pytest tests/unit/test_firestore_query_shapes.py -qalone: 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.pyrerun, 118 passed. Both run throughbin/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 beforeuncertainyields 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 revertof the commit.