Practical technical guides

Argo CD 3.6.4 Lets Git Fetches Outlive the Request That Started Them

Released December 2, 2026: git commands on the shared clone no longer die with the request deadline. What changed, what is still open, and the pattern.

By Sandeep Belgavi · Published 2026-12-06

Flow from Request deadline expires, to Shared fetch keeps running, to Own timeout still bounds it.
Original conceptual diagram by Sandeep Belgavi.

What was released

Argo CD 3.6.4 was published on December 2, 2026. Its bug fix list includes "fix(git): don't cancel git commands with the request context", cherry-picked to the 3.6 branch as pull request 31310 from pull request 30959, which was merged on November 26, 2026. Both reference issue 30953, opened on November 12, 2026, which reports that after upgrading from 3.5.7 to 3.6.1, a repo-server replica's shallow clone was permanently corrupted until the pod was restarted.

This article is a source analysis of the 3.5.10, 3.6.3 and 3.6.4 code and the pull request text, not a measurement; I did not run Argo CD. The fix in 3.6.4 addresses one cause described in the issue: git commands being killed by the request's cancellation. The pull request states that the clone-corruption half of the issue will be handled separately, and the issue stays open, so this release should not be read as fixing corruption.

How a request deadline reached git

Argo CD's repo-server keeps a clone of each repository on local disk and runs git commands against it to fetch revisions and render manifests. Many requests from the application controller and other components can need the same repository, so they share that clone and take a lock on it.

In 3.6, pull request 28353, "propagate contexts", passed the gRPC request context into the git client so that traces reach git. In Go, exec.CommandContext kills the child process when its context is cancelled or its deadline passes. Before that change, the 3.5 code path did not take a request context: in 3.5.10, Fetch has the signature Fetch(revision string, depth int64). After it, in 3.6.3, Fetch takes ctx and runs git under it.

The pull request description explains the consequence. The request's deadline includes the time the request spent queued for the repository lock. Under load a request can wait most of its deadline for the lock, start a fetch, and have the fetch killed seconds later when the deadline expires. The next request repeats the fetch from the start. The issue adds an amplifier from 3.6: more calls that fetch into the shared clone, which made deadline-exceeded requests more common during refresh storms.

The fix

In 3.6.4, each git client method that writes to the clone begins with ctx = context.WithoutCancel(ctx): Fetch, Checkout, CheckoutOrOrphan, CheckoutOrNew, SetAuthor, GetCommitNote and AddAndPushNote. context.WithoutCancel, available since Go 1.21, returns a context that keeps the parent's values but is never cancelled and has no deadline. Trace spans still flow into git; cancellation does not. The interface comment added with the fix says these methods "ignore context cancellation and deadlines, running until they finish or hit ARGOCD_EXEC_TIMEOUT", that killing them part way throws away work later requests would reuse and can leave lock files behind, and that read-only methods honour cancellation.

The commands are still bounded. ARGOCD_EXEC_TIMEOUT, 90 seconds by default in the source, stops a git command that runs too long, as it did before 3.6. The pull request's tests cover a method succeeding with an already-cancelled context, a fetch completing after mid-fetch cancellation, a fetch still being stopped by the exec timeout, and an exec-timeout kill not leaving index.lock behind.

The general pattern: whose work is this

The bug is a mismatch between who asked for the work and who owns it. A fetch into a shared clone is started by one request, but its result belongs to every later request for that repository. Tying its lifetime to the first request's deadline means one impatient caller can destroy shared work and, in the worst case, leave the shared resource in a broken state.

The same question appears whenever work is shared or has side effects:

WorkOwnerLifetime should follow
Reading a file to answer one requestThe requestThe request
Filling a shared cache entryAll future readersIts own timeout
Fetching into a shared clone or indexAll future requestsIts own timeout, plus safe cleanup
Writing to an external systemThe business operationCompletion or explicit compensation

The rule is: cancel what only the caller needs; detach and bound what others need. Detaching without a bound is the opposite bug, because a stuck fetch would then hold the lock forever. That is why the exec timeout matters as much as WithoutCancel.

import asyncio

async def fetch_shared(repo, run_git, inflight, timeout_s=90):
    """Start or join a fetch whose lifetime is its own, not the caller's."""
    task = inflight.get(repo)
    if task is None:
        task = asyncio.ensure_future(asyncio.wait_for(run_git(repo), timeout_s))
        inflight[repo] = task
        task.add_done_callback(lambda _t: inflight.pop(repo, None))
    return await asyncio.shield(task)    # the caller may give up; the fetch continues

In Python, asyncio.shield plays the role of WithoutCancel for the awaited task: cancelling the caller raises CancelledError in the caller but does not cancel the shielded task, and wait_for supplies the independent bound. The companion example tests both properties with a fake git command.

What to do

If you run Argo CD 3.6.0 to 3.6.3 and see fetches failing with signal: terminated or repeated fetches of the same revision during refresh storms, upgrade to 3.6.4. Releases 3.5.10 and 3.4.16, published the same week, do not contain this change, and according to their source they do not need it, because in both Fetch does not take a context at all.

If a replica already has a corrupted clone, the upgrade does not repair it. The issue describes recovery by restarting the pod, which recreates the clone; the corruption cause is still being worked on upstream, so watch issue 30953 for the separate fix.

Review your own timeouts too. The issue cites controller.repo.server.timeout.seconds as the deadline that expired. With 3.6.4 a fetch outlives that deadline and the controller's request still fails, but the next request finds a fetched clone instead of starting over.

Reading the context rules in Go code

Three patterns are worth recognising when reviewing Go services for the same problem. exec.CommandContext(ctx, ...) with a request context kills the child process when the request ends. context.WithTimeout(ctx, d) inherits the parent's cancellation, so a long timeout on a short-lived parent is still a short timeout. context.WithoutCancel(ctx) followed by context.WithTimeout gives work its own bound while keeping trace values, which is the combination shared work needs. A review question that catches most cases: for each context passed into a function that writes to something shared, who created it, and is that caller the only one who cares about the result?

Failure modes in your own code

  • A request-scoped cancellation kills shared work, and every caller retries the same expensive operation. Look for shared caches, clones and indexes filled under a request context.
  • Detached work with no bound holds a lock indefinitely. Always pair detachment with an independent timeout.
  • Killed writers leave locks or partial files. Make cleanup part of the timeout path and test it, as the Argo CD tests do for index.lock.
  • The queue time counts against the work's deadline. Measure lock wait separately from execution time; a deadline that includes the queue punishes the work for congestion it did not cause.

Verification

For your own services, write the two tests the pull request describes in a language-neutral form: start shared work, cancel the caller, assert the work finishes and a second caller reuses it; then make the work hang, assert the independent timeout stops it and leaves no lock behind. For Argo CD itself, check the repo-server logs after upgrading: fetches terminated by signal should disappear, and the count of fetches per revision during a refresh storm should drop.

Primary references and authorship

Sources read December 6, 2026. Original explanations, measurements and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/shared_work_cancellation. Views are my own and do not represent any employer, past or present.