feat(poll): rebase build branch onto origin/<default> before publish - #90
Merged
Conversation
A build can run for a long time (gate repair retries, human review pauses between plan/stages/build), so origin/<default_branch> may have advanced by the time publish() pushes — most commonly because another candidate's PR touching the same shared registration files (docker-compose.yml, ocis.apps.yaml) already merged. Pushing without rebasing risked opening a PR with conflicts against the current base. gateRepairPublish now fetches and rebases onto origin/<default> after the gate passes and before push. A conflict triggers a scoped Claude invocation (new rebase-repair.md prompt) that can only edit conflicted files, stage them, and continue the rebase — never abort it, so the orchestrator always decides whether an attempt succeeded or needs to be aborted and retried. After a successful resolution the gate is re-run once against the rebased tree before push. Exhausting claude.max_rebase_attempts (default 2), or a gate failure after rebasing, falls back to the existing blocked-draft-PR path. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Lukas Hirt <info@hirt.cz>
3 tasks
lint: rebaseOntoDefault's loop set conflict = false right before an unconditional break, so the assignment was never read (ineffassign) — the break alone already exits the loop. test: TestRebaseOntoOrigin_Clean/_ConflictThenAbort clone into a fresh directory (otherClone) and then commit into it, but a plain `git clone` carries no local git config and CI runners have no global one configured either — commit failed with "Please tell me who you are". Set a local identity on the clone the same way initRepo already does for its repos. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Lukas Hirt <info@hirt.cz>
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.
Summary
gateRepairPublishnow fetches origin and rebases the branch ontoorigin/<default_branch>, since a long-running build (repair retries, human review pauses) can leave the branch based on a now-stale commit — most commonly hit when another candidate's PR merged a change to the same shared registration files (docker-compose.yml,*ocis.apps.yaml) in the meantime.prompts/rebase-repair.md) resolves it — restricted to editing conflicted files, staging, andgit rebase --continue; it cannot rungit rebase --abort, so the orchestrator always owns the decision to abort/retry an attempt.claude.max_rebase_attempts(default2), or a gate failure post-rebase, falls back to the existing blocked-draft-PR path used for gate-repair exhaustion.PhaseRebasingbuild phase +RebaseAttemptscounter inbuild.State; newgit.RebaseOntoOrigin/RebaseAbort/InRebasehelpers; newclaude.max_rebase_attempts/prompts.rebase_repairconfig fields (with defaults, so existingextctl.yamlfiles keep working unchanged).Test plan
go build ./...,go vet ./...cleango test ./...passes, including newTestRebaseOntoOrigin_Clean/TestRebaseOntoOrigin_ConflictThenAbortininternal/gitweb-extensionscheckout during the next livepollcycle where a rebase conflict actually occurs🤖 Generated with Claude Code