Skip to content

fix: auto-sync skipped when newer commit arrives during sync with manifest-generate-paths (#27875)#28227

Open
pepe9012 wants to merge 1 commit into
argoproj:masterfrom
pepe9012:fix/autosync-manifest-generate-paths-27875
Open

fix: auto-sync skipped when newer commit arrives during sync with manifest-generate-paths (#27875)#28227
pepe9012 wants to merge 1 commit into
argoproj:masterfrom
pepe9012:fix/autosync-manifest-generate-paths-27875

Conversation

@pepe9012

Copy link
Copy Markdown

Closes #27875

What

Applications with an automated sync policy and the
argocd.argoproj.io/manifest-generate-paths annotation can stop auto-syncing
when a new commit lands while a sync is already in progress. The application
reports OutOfSync but never syncs, and stays stuck until a manual sync or an
application-controller restart.

Why

With the annotation set, the controller uses the manifest-generate-paths
optimization (revisionsMayHaveChanges) to decide whether to compare revisions
before auto-syncing. If a newer commit B arrives while the app is still synced
to A, UpdateRevisionForPaths can report no changes, so revisionsMayHaveChanges
is false. autoSync then skips the revision comparison and treats the sync as
already attempted, even though the app is OutOfSync against B. Without selfHeal
nothing recovers it.

The optimization exists to avoid regenerating manifests when only irrelevant
paths change. It should not gate the sync decision itself.

How

At the autoSync call site, also compare revisions whenever the app is OutOfSync:

shouldCompareRevisions := compareResult.revisionsMayHaveChanges ||
    compareResult.syncStatus.Status == appv1.SyncStatusCodeOutOfSync

The optimization still avoids manifest regeneration, but it can no longer skip a
needed sync. Apps already synced to the target revision are unaffected, and
selfHeal:false apps are still not force-healed for drift at the same revision
(related #26769).

Testing

Added TestAutoSyncManifestGeneratePathsNewCommit covering the new-commit case
(auto-sync triggers) and the same-revision drift case (no auto-sync with selfHeal
disabled).

Also verified on a live cluster: an app with the annotation, automated sync and
no selfHeal auto-synced to a new in-path commit within 20s, while an off-path
commit was correctly skipped.


Checklist:

  • This is a bug fix.
  • The title states what changed and the related issue number.
  • The title conforms to the PR title guidelines.
  • I've included "Closes Auto-sync broken when new commit arrives during ongoing sync (after revert of #25151) #27875" in the description.
  • CLI/UI changes: not applicable.
  • Does this PR require documentation updates? No.
  • I have signed off all my commits (DCO).
  • I have written unit tests for my change.
  • My build is green.
  • I've described why this PR is necessary and what it solves.
  • For bug fixes, this should be cherry-picked into release-3.4 (the regression is present in 3.4.x).

@pepe9012 pepe9012 requested a review from a team as a code owner June 10, 2026 15:09
@bunnyshell

bunnyshell Bot commented Jun 10, 2026

Copy link
Copy Markdown

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@pepe9012 pepe9012 force-pushed the fix/autosync-manifest-generate-paths-27875 branch from f23f173 to 05f8217 Compare June 10, 2026 15:29
…ifest-generate-paths (argoproj#27875)

When an app uses the manifest-generate-paths annotation, the revisionsMayHaveChanges optimization was also used to decide whether to run auto-sync. If a newer commit arrived while the app was still syncing, UpdateRevisionForPaths could report no changes, so auto-sync was skipped and the app stayed OutOfSync until a manual sync or controller restart.

Only use that optimization to skip manifest regeneration, not to gate the sync decision. When the app is OutOfSync, always compare the desired revision against the last synced one. Drift at the same revision with selfHeal disabled is still left untouched.

Signed-off-by: pepe9012 <sotkovsky@gmail.com>
@pepe9012 pepe9012 force-pushed the fix/autosync-manifest-generate-paths-27875 branch from 05f8217 to d8aba1a Compare June 10, 2026 15:46
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 1.41kB (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
argo-cd-ui-array-push 10.67MB 1.41kB (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: argo-cd-ui-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
main.*.js 14 bytes 3.46MB 0.0%
assets/images/resources/nauth.*.svg (New) 1.4kB 1.4kB 100.0% 🚀

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.74%. Comparing base (86936e2) to head (d8aba1a).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #28227      +/-   ##
==========================================
+ Coverage   64.71%   64.74%   +0.02%     
==========================================
  Files         423      424       +1     
  Lines       58437    58668     +231     
==========================================
+ Hits        37817    37983     +166     
- Misses      17102    17152      +50     
- Partials     3518     3533      +15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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.

Auto-sync broken when new commit arrives during ongoing sync (after revert of #25151)

1 participant