Duo Developer: slow git operations in shallow clone CI environment
Problem to solve
Duo Developer agent sessions on large repositories (e.g., gitlab-org/gitlab) experience multi-minute hangs on basic git operations. The CI runner creates a depth=1 shallow clone, and the agent is unaware of this constraint, leading to suboptimal command choices.
Reproduced using the runner image (workflow-generic-image:v0.0.6, git 2.43.7) against gitlab.com:
| Command | Time | .git size |
|---|---|---|
git fetch origin <branch> |
6 min 11s | 2.7 GB |
git fetch --depth=1 origin <branch> |
2.5s | 187 MB |
Observed in production (session 3311431, job 13737581585):
git fetch origin <branch>: 3 min 19sgit checkout origin/<branch> -- .(wrong command for branch switch): 29 min 30s- Agent spent ~33 of 40 minutes on git operations instead of actual work
The root cause: git fetch without --depth=1 forces the server to compute and send ~2.5 GB of pack data to connect the branch to the shallow boundary. With --depth=1, only the tip commit is transferred.
Proposal
Add a short environment note to the developer_next system prompt:
You are working in a shallow git clone (depth=1) on a detached HEAD. Git operations that transfer history over the network (fetch, push) can be very slow on large repositories — use --depth=1 on fetch when full history is not needed.This is the same level of context you'd give a developer joining the team — state the environment fact, flag the consequence, give the key tip. The agent can still unshallow intentionally if it needs full history (e.g., complex rebase, blame), but it will default to lightweight operations.
The prompt change goes in both:
duo_workflow_service/agent_platform/experimental/flows/configs/developer_next/1.0.0.ymlduo_workflow_service/agent_platform/experimental/flows/configs/developer_unstable/1.0.0.yml
in the developer_agent_prompt system template.
Further details
Why not other approaches:
git fetch --unshallowin flow setup: equivalent to full clone (~5-10 GB for gitlab-org/gitlab)git fetch --deepen=100: fetched 129k commits / 1.1 GB in testing due to merge commit fan-out- git config tweaks (
http.postBuffer,protocol.version): don't address the bottleneck (server-side pack computation)
Environment:
- Runner image:
registry.gitlab.com/gitlab-org/duo-workflow/default-docker-image/workflow-generic-image:v0.0.6(git 2.43.7) - Clone depth: 1, initial ref:
refs/workloads/<hash>(detached HEAD) - Flow:
developer_next/experimental
Links / references
- Production sessions: 3311431, 3307404
- CI job logs: 13737581585, 13732355601
- Flow config:
duo_workflow_service/agent_platform/experimental/flows/configs/developer_next/1.0.0.yml - Runner git setup MR: gitlab-org/gitlab!226743 (merged)