Skip to content

ApplicationSet RollingSync cannot set operation.sync.prune from true to false #27261

@achang209

Description

@achang209

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When an ApplicationSet with a RollingSync strategy changes syncPolicy.automated.prune from true to false, the imperative sync operations triggered by the applicationset controller continue to prune resources. The prune: true value from a previous operation appears to persists on the Application CR and cannot be overwritten.

To Reproduce

  1. Create an ApplicationSet with strategy.type: RollingSync and syncPolicy.automated.prune: true
  2. Trigger a rolling sync — resources are pruned as expected; examining the application spec shows status.operationState.operation.sync.prune is true
  3. Change syncPolicy.automated.prune to false
  4. Trigger another rolling sync that requires pruning.
    Observe that status.operationState.operation.sync.prune is still true and resources are pruned despite the configuration change.

Expected behavior

After changing syncPolicy.automated.prune back to false and triggering a subsequent rolling sync requiring pruning, the following is expected:

  • application spec should have status.operationState.operation.sync.prune omitted or set to false
  • resources are not pruned; the sync triggered by rolling Sync remains in a progressing state

Screenshots

Attempted to add screen shots, but imaged failed to upload. Here are copy and paste snippets instead.

This is the state of my application spec after step 4 from "To Reproduce"

...
spec:
  ...
  syncPolicy:  <-------------- syncPolicy with prune omitted
    automated:
      enabled: false
      selfHeal: true
...
status
  ...
    operationState:
    finishedAt: "2026-04-09T17:10:57Z"
    message: successfully synced (all tasks run)
    operation:
      info:
      - name: Reason
        value: ApplicationSet RollingSync triggered a sync of this Application resource
      initiatedBy:
        automated: true
        username: applicationset-controller
      retry:
        limit: 5
      sync:
        prune: true        <--------------- but it's still set to true during the sync
        syncOptions:
        - PruneLast=true
        - CreateNamespace=true
        - ServerSideApply=false
    phase: Succeeded

Workaround

Delete the affected Application CR and let the ApplicationSet recreate it. The fresh Application has no lingering operation state, and syncPolicy.automated.prune: false takes effect correctly.

Potential Fix

The AI thinks the issue is here...

Line 1389 in types.go — current code:

Prune bool `json:"prune,omitempty" protobuf:"bytes,2,opt,name=prune"`

Should become:

Prune *bool `json:"prune,omitempty" protobuf:"bytes,2,opt,name=prune"`

Version

~ % argocd version
argocd: v3.2.0+66b2f30
  BuildDate: 2025-11-04T19:51:54Z
  GitCommit: 66b2f302d91a42cc151808da0eec0846bbe1062c
  GitTreeState: clean
  GoVersion: go1.25.3
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v3.3.6

Logs

Paste any relevant application logs here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage/pendingThis issue needs further triage to be correctly classified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions