fix(reset): retry reset push on non-fast-forward, re-applying the baseline - #361
Merged
Merged
Conversation
…eline cascade reset --state --push did a plain git push with no retry, so a concurrent write to main rejected it non-fast-forward (observed as the keystone failure in the 4env validation-fleet lifecycle, which seeds state via reset --push). Every other state writer already self-heals via fetch/reset/reapply; reset was the gap. On rejection the push now resolves the branch, fetches and hard-resets onto origin, re-parses the freshly fetched manifest so trunk-owned config survives, re-applies the state baseline, recommits, and retries (bounded 3 attempts, 2s backoff). Reset still wins on the state and latest-release sections. DryRun, no-push, and no-change paths are unchanged. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
joshua-temple
force-pushed
the
fix/reset-push-nonff-retry
branch
from
June 25, 2026 19:16
29ac23f to
3d9bfe1
Compare
joshua-temple
enabled auto-merge (squash)
June 25, 2026 19:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
cascade reset --state --pushdid a plaingit pushwith no retry, so a concurrent write tomainrejected itnon-fast-forward. This surfaced as the keystone failure in the 4env validation-fleet lifecycle, whose first step seeds dev state viareset --push; rollback and merge_queue then failed downstream because state never seeded. Every other state writer (orchestrate, promote, finalize) already self-heals via a fetch/reset/reapply retry loop; reset was the one path missing it.Fix
On a rejected push,
commitAndPush()now resolves the current branch, fetches and hard-resets onto origin, re-parses the freshly fetched manifest so trunk-owned config survives, re-applies the state baseline (reset still wins on the state and latest-release sections), recommits, and retries. Bounded at 3 attempts with a 2s backoff, all git scoped to the repo path. DryRun, no-push, and no-change paths are unchanged.Test
TestCommitAndPush_RecoversFromNonFastForward: a second clone pushes a concurrent promote that advancesorigin/main, so the reset's plain push is rejected non-fast-forward; asserts reset self-heals and origin HEAD carries neither the seed nor the concurrent writer's state while trunk config survives. Red before, green after, passes under -race.Verification
go build ./...; full
go test ./...(1776 pass);golangci-lint run ./internal/reset/...clean.