diff --git a/harnesses/contexts/agent-repo/v1/init.sh b/harnesses/contexts/agent-repo/v1/init.sh index 61ee9f9..d5f58c6 100644 --- a/harnesses/contexts/agent-repo/v1/init.sh +++ b/harnesses/contexts/agent-repo/v1/init.sh @@ -22,8 +22,12 @@ for ref in refs: branch = ref.get('branch', 'main') dest = f'/workspace/reference/{name}' print(f'Cloning {repo_url} ({branch}) -> {dest}') + # Full clone (no --depth) so AR-14a-seeded agent branches have visible + # ancestry when pushed back to the agent-repo. Gitea rejects shallow + # pushes with "shallow update not allowed". Real incident: 2026-05-08 + # probe 7. The cost is a few extra MB on a tmpfs/PVC; acceptable. result = subprocess.run( - ['git', 'clone', '--depth', '1', '--branch', branch, + ['git', 'clone', '--branch', branch, '-c', 'core.symlinks=false', repo_url, dest], capture_output=True, text=True ) @@ -63,7 +67,13 @@ if [ -n "${AGENT_REPO_URL:-}" ] && [ -n "${AGENT_BRANCH:-}" ]; then # # Use a temporary remote name so we don't collide with 'origin'. git remote add upstream-ref "$REF_REPO" - git fetch upstream-ref --depth 1 2>&1 | head -3 || { + # Full fetch (no --depth) — the agent's branch will be pushed + # back to the agent-repo, and gitea rejects shallow pushes + # with "shallow update not allowed". Even though the + # reference clone itself may be shallow, fetch as much as + # the source has so the agent's HEAD has visible ancestry. + # Real incident: 2026-05-08 probe 7 (shallow update reject). + git fetch upstream-ref 2>&1 | head -3 || { echo "WARNING: failed to fetch from upstream reference; falling back to fork main" >&2 git remote remove upstream-ref 2>/dev/null git checkout -b "$AGENT_BRANCH"