What the agent does
The agent starts by finding where the Application objects come from. In a GitOps repository laid out like argoproj/argocd-example-apps, they are not hand-written: apps/ is a Helm chart (apps/Chart.yaml, version 0.1.0) whose single template, apps/templates/applications.yaml, ranges over .Values.applications and renders one Application per entry, named example.<name>, in the argocd namespace unless the entry sets its own. apps/values.yaml lists 19 entries, from guestbook and helm-guestbook to sock-shop, sync-waves and three app-any-ns entries that land in team-frontend, team-backend and team-platform. Every rendered Application gets the same syncPolicy: syncOptions with CreateNamespace=true and automated with prune: true and selfHeal: true. There is no retry block anywhere in the template, so a sync that fails on a transient error (a webhook admission timeout, an image pull that races a registry, a CRD that is not established yet) stays failed until the next commit or a person clicks Sync.
It then reads the other places the same policy is repeated. The applicationset/ directory holds one ApplicationSet per generator type, and list.yaml, cluster.yaml, git.yaml, matrix.yaml, merge.yaml, pull-request.yaml, progressive-sync.yaml and the four appset-any-ns-*.yaml files each carry their own template.spec.syncPolicy with the same automated block and no retry. The agent lists every file it will touch before it edits any, so the pull request covers the whole repository and not just the chart.
The change itself follows Argo CD's documented shape: under syncPolicy, a retry with limit (the number of attempts, -1 for unlimited) and a backoff of duration (the base wait before the first retry), factor (the multiplier after each failure) and maxDuration (the cap on the wait). The agent does not hard-code the numbers in the template. It adds a retry block to config.spec.syncPolicy in apps/values.yaml, using the values from the Argo CD documentation (limit: 5, duration: 5s, factor: 2, maxDuration: 3m) as the repository default, and renders it in applications.yaml as {{- with (.retry | default $config.spec.syncPolicy.retry) }} so any single entry can set its own retry or turn it off. The ApplicationSets get the same block written out, because they are plain manifests with no shared values file.
Before it opens anything, the agent proves the chart still renders. It runs helm lint apps and helm template example apps, diffs the output against a render from the unchanged chart to show that the only change is the new retry block under every syncPolicy, and checks the rendered documents and the ApplicationSets against the Argo CD CRD schemas with kubeconform, so a misspelled field such as maxduration is caught in the sandbox and not by the API server. It bumps apps/Chart.yaml to 0.2.0, since the chart's behaviour changed.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add sync retries with exponential backoff to every Argo CD Application in this repository. Read apps/Chart.yaml, apps/values.yaml, apps/templates/applications.yaml and every file under applicationset/ first, and list the places a syncPolicy is defined. Add a retry block (limit, backoff.duration, backoff.factor, backoff.maxDuration) to config.spec.syncPolicy in apps/values.yaml using Argo CD's documented defaults, render it in the Application template so that an entry in the applications list can override or omit it, and write the same block into each ApplicationSet template. Run helm lint and helm template on the apps chart, diff the render against the unchanged chart, validate the rendered Applications and the ApplicationSets against the Argo CD CRD schemas with kubeconform, bump the chart version, and open a pull request that quotes the diff of one rendered Application and the validation output.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request changes apps/values.yaml, apps/templates/applications.yaml, apps/Chart.yaml and each ApplicationSet file under applicationset/. Its description quotes the rendered syncPolicy of one Application before and after, the helm lint and kubeconform output from the sandbox, and a table of which files gained a retry block and whether it came from the shared default or was written inline.
A reviewer checks three things: that the default numbers suit the cluster (a maxDuration of three minutes is a long time for a production app to sit in a failed sync, and a limit of 5 may be too few for a slow registry), that the per-entry override in applications.yaml behaves when an entry sets retry: {} or leaves it out, and that the app-any-ns entries, which already carry their own namespace and project, render correctly with the extra block. The reviewer does not need an Argo CD instance to do any of that; the rendered manifests are in the pull request.
Once merged, Argo CD picks the new policy up on the next refresh of the apps Application and applies it to each child on their next sync, so the change rolls out through the same app-of-apps path as every other change in the repository.
Run it on every Application added to apps/values.yaml
An automation on the Project with a github trigger on pull_request.opened and the prompt "if this pull request adds an entry to apps/values.yaml or a new file under applicationset/, check that its rendered syncPolicy carries a retry block, and post a review that quotes the render" runs once per pull request. The trigger adds the pull request after the prompt and fills in nothing else; the run reads the diff to decide whether it applies. Only work by an owner, member or collaborator fires it.
A platform team with several GitOps repositories sends this body once per repository from its own server, each POST /o/{org}/sessions with that repository in resources and a request_id that is a UUID v5 of the repository's full name, so a retried call returns the run already started. Each run reads its own layout: a repository that writes Applications by hand gets the block added to each file, and one with an app-of-apps chart gets the shared default and the override.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
The dangerous part of this change is not the four-line block; it is the number of places it must land and the ease of a typo that Argo CD silently ignores. The agent reads every Application and ApplicationSet, renders the chart with Helm, validates the result against the real CRD schemas, and keeps every command and its output with the pull request, so the reviewer sees the manifests Argo CD will receive rather than a template diff.
A reviewer reads one rendered policy and a validation log instead of re-rendering the chart locally. A team that owns several GitOps repositories starts the same request across all of them at once and reviews ten pull requests the same afternoon.
Frequently asked questions
Does the retry apply to manual syncs too?
The retry block sits under syncPolicy beside automated, and Argo CD reads it for a failed sync operation. The agent leaves automated as it found it (prune: true, selfHeal: true in this repository) and adds retry next to it; a sync started by hand from the UI or CLI uses the same policy.
Can one app opt out?
Yes. In the chart, an entry in apps/values.yaml can set its own retry, and the template renders that instead of the shared default. An ApplicationSet carries its block inline, so opting one out is a one-line deletion in that file.
What about unlimited retries?
Argo CD accepts limit: -1 for unlimited retries. The agent uses the documented finite default and says in the pull request where to change it; an unlimited policy with a short maxDuration can keep a broken app syncing forever and hide the failure.
Will it touch the applications themselves?
No. The guestbook manifests, the Helm charts under helm-guestbook/ and helm-dependency/, the Kustomize and Jsonnet apps and the hook examples are untouched. The change is confined to the Application and ApplicationSet objects that point at them.