Let the runner do the full blobless clone for Duo Agent Platform flows
What does this MR do and why?
The dap_full_clone path currently sets GIT_STRATEGY=none and runs its own git clone in the job. That forced a few workarounds — git must be in the job image (breaks slim images like AI Gateway, since setup_script runs after the clone), a credential.helper, manual proactiveAuth, and a .dap-tmp cache-move dance.
This MR lets the runner do the clone instead — a full (GIT_DEPTH=0) blobless (--filter=blob:none) clone with the runner's own git — and then re-attaches HEAD to a named branch once setup_script has run. This keeps the full-clone benefits (full history, base ref, no git fetch --unshallow) and the blobless latency win, while removing the git-in-image requirement and the credential-helper / cache-move workarounds.
The flag applies to all flows (not just developer/v1), and everything stays gated behind dap_full_clone.
Idea originated here: #602558 (comment 3556680669)
How it works
git_clone_variables(full-clone):GIT_DEPTH=0+GIT_FETCH_EXTRA_FLAGS=--filter=blob:none(+GIT_LFS_SKIP_SMUDGE) — the runner clones with its helper git. NoGIT_STRATEGY=none.- After
setup_script,workspace_fixup_commandsrunsgit checkout -B <source-or-default branch>(the runner leaves a detached HEAD) and a blob-free fetch to populate the base ref. - Auth uses the runner's clone + the existing
oauth_remote_commands(now used for full-clone too); thecredential.helperis gone.proactiveAuthstill applies to the agent's git ops. - Commands are regrouped into
coding_environment_commands(repo setup) andexecutor_commands(always-on). This is behavior-preserving when the flag is off; when the flag is on, theworkspace_fixup_commands(HEAD re-attach + base-ref fetch) are inserted between the oauth remote setup and the workflow commands.
No behavior change unless dap_full_clone is enabled.
How to test locally (GDK)
-
Use a project backed by a repo with real history (a shallow/partial import won't exercise blobless). A slim image (no git) is a good choice — it proves the git-in-image requirement is gone (AI Gateway is a good testing candidate since its agent config uses a slim image).
-
Enable the flag:
Feature.enable(:dap_full_clone) -
Trigger any Duo Agent Platform flow (mention the service account on an issue or an MR).
-
Open the
duo_workflowCI job log and confirm:Fetching changes...(runner clone, nogit depth set to 1),- no
Skipping Git repository setup, no$ git cloneinstep_script, git checkout -B "…"→Switched to a new branch '…'(attached; MR run → MR source branch, issue run → default branch),- the
git_unshallowstep is a no-op (is-shallow-repositoryis false).
-
(Optional) Confirm the workspace from the agent's view — mention the flow with:
Do NOT change code. Report:
git rev-parse --abbrev-ref HEAD,git rev-parse --is-shallow-repository,git config --get remote.origin.promisor,git rev-list --objects --all --missing=print | grep -c '^?', and whethergit log origin/main..HEADand a push of a scratch branch succeed.Expect: a named branch,
false,true, a non-zero deferred-blob count, and working base-branch ops + push. -
Disable when done:
Feature.disable(:dap_full_clone).
Follow-up (out of scope)
Once this has run behind the flag on .com for a few days, make the blobless clone the default and remove the shallow-clone path and the dap_full_clone flag — the small-repo comparison showed shallow has no startup advantage, so there's no reason to keep it. Doing this separately keeps the change reversible while we watch prod (incl. the one-time lazy-fetch cost of deep-history ops like blame/rebase, which we still want to measure at monolith scale).