fix(mountsync): prioritize writeback during full pulls#352
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Warning Review limit reached
Next review available in: 22 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe mount loop now starts its local watcher before initial reconciliation. Full pulls release locks around remote I/O, track concurrent local changes, and avoid replaying stale snapshot data or tombstones over those changes. Regression tests cover blocked bootstrap and full-pull concurrency. ChangesMount bootstrap concurrency
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant runMountLoop
participant FileWatcher
participant Syncer
participant RemoteClient
runMountLoop->>FileWatcher: Start before initial reconciliation
FileWatcher->>Syncer: HandleLocalChange for local draft
Syncer->>RemoteClient: WriteFilesBulk
Syncer->>RemoteClient: GetOperation
runMountLoop->>Syncer: runCycle(true)
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Relayfile Eval ReviewRun: Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0 Human Review CasesNo reviewable human-review cases captured Relayfile output. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d046d44ad
ℹ️ 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".
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Root cause
syncReservedheld the singleSyncer.muacross the complete full-pull wall clock.HandleLocalChange,/fs/bulkadmission, and durable receipt polling all need that mutex, so a multi-minute down-mirror serialized local writeback behind it. The daemon also started its watcher only after initial bootstrap returned.The lock split is deliberately narrow: full-pull transport/body reads release
mu; export/tree/tar apply and all state changes remain under it. Large apply loops yield between files. Paths whose write was accepted by/fs/bulk, successfully deleted, or observed already absent are skipped by stale content and snapshot-delete application. No-op watcher events and per-path write errors leave the snapshot authoritative.Starting the watcher earlier also made its callback concurrent with initial
runCycle, exposing a status tuple race that already existed during periodic cycles. A mount-loop-local mutex now protects only tuple copies/transitions (degraded, stall/recovery timing, attempts, andlastSuccess) and is never held across auth, sync, watcher writeback, logging, network, or file I/O. Credential refresh is independently serialized.Covered down-path variants:
ExportFilesListTreeplus parallelReadFileRed-first evidence
TestFullPullDoesNotStarveLocalDraftAdmissionOrReceiptSettlementcaptures an export snapshot, blocks its return, writes a Slack draft, and requires/fs/bulk,GetOperation, and the acked receipt to complete before releasing the export.On baseline it deterministically failed at the 750ms bound:
Both calls completed only after the export was released.
The TAR and TREE variants fail at the same 750ms starvation bound with the baseline lock behavior. Their green versions explicitly prove GitHub tar dispatch and paginated tree/parallel-read dispatch, receipt settlement, and non-clobber.
Two no-op regressions fail on the first PR head: Chmod on unchanged content incorrectly claims the up-path and suppresses an authoritative remote update or confirmed remote delete. Paired green tests prove only genuine accepted upload/delete ownership defeats a stale snapshot.
TestMountLoopSerializesStatusWhenWatcherAndInitialBootstrapFailTogetherreleases simultaneous credential failures from a blocked initial export and watcher writeback. Before the status fix,go test -racedeterministically reports races ondegradedandlastDegradedNotice; it is green after serialization.Validation
go test ./... -count=1— green across every packagego test -race ./internal/mountsync ./cmd/relayfile-cli -count=1— green (122.566s,92.257s)-race— greengo vet ./...— greenmake build— green for CLI, server, and mount binariesgit diff --check— greenSafety