Skip to content

Commit 0897e34

Browse files
committed
fix: retry loop for concurrent push conflicts on repos.json
All workflows now retry push up to 5 times with conflict resolution. When repos.json has merge conflicts, the fix re-applies the jq update on the remote version rather than failing. Also backfilled registry with 4 audit results that completed but failed to push (claude-mem 44/BLOCKED, agent-skills 82/CLEAR, codex-plugin-cc 75/CLEAR, Product-Manager-Skills 92/CLEAR).
1 parent b4f9117 commit 0897e34

4 files changed

Lines changed: 89 additions & 4 deletions

File tree

.github/workflows/auditor-audit.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,47 @@ jobs:
636636
bash auditor/scripts/guard-protected-paths.sh || exit 1
637637
git diff --cached --quiet || {
638638
git commit -m "audit: $TARGET_REPO ($SCORE/100, security:$SECURITY, $STRATEGY, $TOTAL artifacts)"
639-
git pull --no-rebase origin main --no-edit || true
640-
git push
639+
640+
# Retry push up to 5 times, resolving repos.json conflicts each time
641+
for ATTEMPT in 1 2 3 4 5; do
642+
echo "Push attempt $ATTEMPT..."
643+
if git push 2>/dev/null; then
644+
echo "Push succeeded on attempt $ATTEMPT"
645+
break
646+
fi
647+
648+
echo "Push failed, pulling and resolving conflicts..."
649+
git pull --no-rebase origin main --no-edit 2>/dev/null || true
650+
651+
# If repos.json has merge conflicts, resolve by re-applying our update on remote version
652+
if git diff --name-only --diff-filter=U 2>/dev/null | grep -q "repos.json"; then
653+
echo "Resolving repos.json merge conflict..."
654+
# Accept theirs as base, then re-apply our jq update
655+
git checkout --theirs auditor/registry/repos.json
656+
jq --arg name "$TARGET_REPO" \
657+
--arg score "$SCORE" \
658+
--arg strategy "$STRATEGY" \
659+
--arg security "$SECURITY" \
660+
'.repos[$name].status = "audited" | .repos[$name].score = ($score | tonumber) | .repos[$name].strategy = $strategy | .repos[$name].security = $security' \
661+
auditor/registry/repos.json > /tmp/reg-resolved.json && mv /tmp/reg-resolved.json auditor/registry/repos.json
662+
git add auditor/registry/repos.json
663+
fi
664+
665+
# Resolve any other conflicts by accepting theirs (audit reports don't conflict)
666+
git diff --name-only --diff-filter=U 2>/dev/null | while read -r conflicted; do
667+
echo "Auto-resolving conflict in: $conflicted"
668+
git checkout --theirs "$conflicted" 2>/dev/null || true
669+
git add "$conflicted" 2>/dev/null || true
670+
done
671+
672+
# Complete the merge if needed
673+
git diff --cached --quiet 2>/dev/null || git commit --no-edit 2>/dev/null || true
674+
675+
if [ "$ATTEMPT" -eq 5 ]; then
676+
echo "ERROR: Failed to push after 5 attempts"
677+
exit 1
678+
fi
679+
done
641680
}
642681
643682
gh issue edit "$ISSUE_NUM" --add-label "audit-complete" --remove-label "audit-ready" 2>/dev/null || true

.github/workflows/auditor-contribute.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,21 @@ jobs:
186186
bash auditor/scripts/guard-protected-paths.sh || exit 1
187187
git diff --cached --quiet || {
188188
git commit -m "contribute: $TARGET_REPO ($PR_COUNT PRs)"
189-
git push
189+
190+
for ATTEMPT in 1 2 3 4 5; do
191+
if git push 2>/dev/null; then break; fi
192+
echo "Push attempt $ATTEMPT failed, resolving..."
193+
git pull --no-rebase origin main --no-edit 2>/dev/null || true
194+
if git diff --name-only --diff-filter=U 2>/dev/null | grep -q "repos.json"; then
195+
git checkout --theirs auditor/registry/repos.json
196+
jq --arg name "$TARGET_REPO" '.repos[$name].status = "contributed"' \
197+
auditor/registry/repos.json > /tmp/reg-resolved.json && mv /tmp/reg-resolved.json auditor/registry/repos.json
198+
git add auditor/registry/repos.json
199+
fi
200+
git diff --name-only --diff-filter=U 2>/dev/null | while read -r f; do git checkout --theirs "$f" && git add "$f"; done 2>/dev/null || true
201+
git diff --cached --quiet 2>/dev/null || git commit --no-edit 2>/dev/null || true
202+
[ "$ATTEMPT" -eq 5 ] && { echo "ERROR: push failed after 5 attempts"; exit 1; }
203+
done
190204
}
191205
192206
gh issue edit "$ISSUE_NUM" --add-label "prs-submitted" --remove-label "contribute-approved" 2>/dev/null || true

.github/workflows/auditor-daily-report.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,13 @@ jobs:
233233
bash auditor/scripts/guard-protected-paths.sh || exit 1
234234
git diff --cached --quiet || {
235235
git commit -m "report: daily $(date +%Y-%m-%d)"
236-
git push
236+
237+
for ATTEMPT in 1 2 3 4 5; do
238+
if git push 2>/dev/null; then break; fi
239+
echo "Push attempt $ATTEMPT failed, pulling..."
240+
git pull --no-rebase origin main --no-edit 2>/dev/null || true
241+
git diff --name-only --diff-filter=U 2>/dev/null | while read -r f; do git checkout --theirs "$f" && git add "$f"; done 2>/dev/null || true
242+
git diff --cached --quiet 2>/dev/null || git commit --no-edit 2>/dev/null || true
243+
[ "$ATTEMPT" -eq 5 ] && { echo "ERROR: push failed after 5 attempts"; exit 1; }
244+
done
237245
}

auditor/registry/repos.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,30 @@
3939
"score": 97,
4040
"strategy": "single",
4141
"security": "CLEAR"
42+
},
43+
"thedotmack/claude-mem": {
44+
"status": "audited",
45+
"score": 44,
46+
"strategy": "batched",
47+
"security": "BLOCKED"
48+
},
49+
"tech-leads-club/agent-skills": {
50+
"status": "audited",
51+
"score": 82,
52+
"strategy": "progressive",
53+
"security": "CLEAR"
54+
},
55+
"openai/codex-plugin-cc": {
56+
"status": "audited",
57+
"score": 75,
58+
"strategy": "single",
59+
"security": "CLEAR"
60+
},
61+
"deanpeters/Product-Manager-Skills": {
62+
"status": "audited",
63+
"score": 92,
64+
"strategy": "batched",
65+
"security": "CLEAR"
4266
}
4367
},
4468
"metadata": {

0 commit comments

Comments
 (0)