Skip to content

Post-fix/post-code push scripts should fetch before force-with-lease retry #409

Description

@fullsend-ai-retro

What happened

Fix run 29581025125 on agents#190 failed at the push step. The plain git push was rejected (non-fast-forward) because another process had pushed to the branch during the ~9-minute fix run. The script retried with --force-with-lease, but that also failed with 'stale info' because the local remote-tracking ref had not been updated since the initial clone. The entire fix run was wasted, causing a ~2 hour delay before a manual retry (29587936601) succeeded from a clean state.

What could go better

The push logic in scripts/post-fix.src.sh (lines 318-349) and the identical logic in scripts/post-code.src.sh retries with --force-with-lease on non-fast-forward rejection but does not run git fetch first. Without a fetch, --force-with-lease compares against the stale tracking ref from clone time. This makes the retry fail even for legitimate rebases where the agent's changes don't conflict with the concurrent push. The inline comment claims 'force-with-lease is safe: it still rejects if someone else pushed in the meantime' — which is true, but the rejection here is overly conservative because the stale ref doesn't reflect the current remote state. A git fetch before the retry would make the lease check accurate. Confidence: high — the failure mode is clearly reproduced in the run log, and the fix follows standard git best practices.

Proposed change

In scripts/post-fix.src.sh and scripts/post-code.src.sh, add git fetch origin "${BRANCH}" between the failed plain push detection and the --force-with-lease retry. The current flow is: plain push fails → detect non-fast-forward → git push --force-with-lease. Change to: plain push fails → detect non-fast-forward → git fetch origin "${BRANCH}"git push --force-with-lease. This ensures the tracking ref is current so --force-with-lease correctly distinguishes 'my rebase diverged from what was already there' (safe to push) from 'someone else pushed new work I haven't seen' (reject). Both files contain identical push logic and should be updated together.

Validation criteria

The next fix or code agent run that encounters a non-fast-forward push rejection should succeed on the force-with-lease retry instead of failing with 'stale info'. Verify across the next 10 fix/code agent runs that no push failures occur due to stale tracking refs. The force-with-lease retry should still correctly reject when genuinely conflicting concurrent pushes occur.


Generated by retro agent from #190

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions