Skip to content

Fix auto-sync remaining enabled after PR merge - #162

Open
0101 wants to merge 2 commits into
mainfrom
auto-sync-not-deactivated-after-merge
Open

Fix auto-sync remaining enabled after PR merge#162
0101 wants to merge 2 commits into
mainfrom
auto-sync-not-deactivated-after-merge

Conversation

@0101

@0101 0101 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Problem

When PR reconciliation detected that a pull request had merged, auto-sync correctly stopped acting on the branch but left its persisted autoSyncBranches preference enabled. The dashboard therefore continued showing an active auto-sync toggle on a merged card.

Fix

  • Remove enabled local branches from autoSyncBranches when their reconciled provider PR is merged.
  • Clear the corresponding accepted-revision records so stale sync bookkeeping is not retained.
  • Keep the existing pre-action merged-PR eligibility checks because Git and PR refreshes run independently and still require race protection.
  • Update the Branch Sync specification to describe automatic deactivation.

Tests

  • Added a regression test covering local/provider branch mapping, preference removal, accepted-record cleanup, and preservation of open-PR auto-sync.
  • dotnet test src\Tests\Tests.fsproj --filter "Category=Fast" --no-restore

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c7fa2749-60bc-40e0-822a-6853b5cca357
Copilot AI balanced review requested due to automatic review settings August 3, 2026 07:23

Copilot AI 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.

Pull request overview

Fixes stale auto-sync state after PR reconciliation detects a merge.

Changes:

  • Removes merged branches from auto-sync preferences.
  • Clears associated accepted-revision records.
  • Adds regression coverage and updates the Branch Sync specification.
Show a summary per file
File Description
src/Server/RefreshScheduler.fs Deactivates auto-sync during merged-PR reconciliation.
src/Tests/SchedulerTests.fs Tests merged-branch cleanup and open-branch preservation.
docs/spec/worktree-monitor.md Documents automatic deactivation behavior.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

if newPersisted <> persisted then
MergedPrStore.setForRepo services.MergedPrStore repoId newPersisted

deactivateMergedAutoSync services.AutoSyncStore root effectiveMap branchScope.GitData
Comment on lines +285 to +287
mergedAutoSync
|> List.map fst
|> List.iter (AutoSyncStore.clear store)
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