fix: hire-an-agent branch protection fails — race condition after initial push #238
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#238
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Step 4 of hire-an-agent sets up branch protection on the .profile repo immediately after the initial push (Step 3). The Forgejo API returns "Branch main does not exist" even though the push to main succeeded moments earlier.
Observed on all 6 agents:
This is a race condition — Forgejo's branch index hasn't updated by the time the protection API is called.
Proposed solution
Add a short retry loop (3 attempts, 2s sleep) in setup_profile_branch_protection before failing:
Alternatively, use auto_init: true when creating the repo (POST /api/v1/admin/users/{username}/repos) so main exists before the clone step. Then Step 3 pulls instead of pushing a new branch.
Affected files
Acceptance criteria