[codex] Fix atomic sync gates#1020
Open
jnunemaker wants to merge 2 commits into
Open
Conversation
jnunemaker
marked this pull request as ready for review
July 8, 2026 18:42
The bare rescue in synced_adapter only cleared @syncing for StandardError, so a non-StandardError from the Synchronizer (Interrupt, SignalException, etc.) would leave @syncing true permanently, deadlocking all subsequent reads waiting on @sync_condition. Use an ensure with a synced flag so state is always cleared, bumping @last_synced_at only on success. Mirrors the ensure-based cleanup already in IntervalSynchronizer#call. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes thundering-herd syncs caused by unsynchronized check-then-act gates in the poll and interval synchronizers. The poll adapter now coordinates in-flight local updates, retries after failed synchronization, and resets sync state after forks; the interval synchronizer now claims each elapsed interval atomically. This keeps concurrent request threads from issuing duplicate remote reads and overlapping local writes for the same sync window. Validated with
bundle exec rspec spec/flipper/adapters/poll_spec.rb spec/flipper/adapters/sync/interval_synchronizer_spec.rbandbundle exec rspec spec/flipper/adapters, which passed with the existing 2 sqlite pending examples.