Repository navigation
Description
Problem Description
The implement job opens pull requests whose branch is behind main. Pull request #4378 (draft, branch feat/4004-allow-list-builder-for-planner-read) has one commit, wip: 1 of 2 tasks of group 1, on merge-base 52d5eb0. The job cloned at 14:05Z. It pushed the branch and opened the pull request at 14:26Z. In those 20 minutes main gained 3 commits (#4374, #4353, #4376). The branch was 3 commits behind when the pull request opened.
The job syncs only at two points in src/devops_cli/roadmap/implement/implement_run.py: at the start of the run (_start, which calls _sync) and at the final push (_push, which calls _sync). Every other push skips the sync:
- the push of a
wip:commit (_keepcalls_push_passed); - the checkpoint push between groups (
_checkpointcalls_push_passed); - the push at a stop (
stopcalls_push_passed); - the first push of a Planned item (
_push_passedcalls_publish, which runsgit push -u origin <branch>).
The stage job has the same gap. _commit_and_push in src/devops_cli/roadmap/stage/stage.py pushes the plan branch from the staged commit with no rebase, after a run of 20 to 45 minutes. _moved_for fetches origin/<default> before the publish, but nothing rebases the branch onto it.
The repository does not require a branch that is up to date (this is on purpose), so GitHub does not enforce it. The job must do it.
Reproduction Steps
- Start an implement run on a Planned item with two or more tasks in group 1.
- While the first step runs, merge a commit into
main. - The step commits the first task as a
wip:commit. The job pushes it and opens the draft. - Run
git merge-base origin/<branch> origin/main. It is not the tip oforigin/main.
Expected vs Actual Behavior
Expected: before the first push of a branch, and before each later push, the job fetches the default branch and rebases onto it. A conflict follows the existing conflict path (abort, stop with the rebase reason, give the files to the next step).
Actual: the first push, the wip: pushes, the checkpoint pushes and the stop push send a branch that is behind main. The stage job also sends a plan branch that is behind.
Environment Diagnostics
Service runner, devops-cli 0.107.1 (main at 7d86a2b when the run started).
Logs, Traces, or Terminal Output
git log --format='%h %aI %s' origin/feat/4004-allow-list-builder-for-planner-read: one commit, 42d7879, wip: 1 of 2 tasks of group 1, authored 14:26:03Z. Merge-base 52d5eb0 from 14:05Z.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate. Issue feat(roadmap): rebase staged branch onto main before implement #4076 asks for a
--no-rebaseoption on the existing rebases; it does not cover the pushes that skip the sync.
Proposed design
Problem statement
Both roadmap jobs push branches that are behind the default branch. Only the start of the implement run and its final push rebase. The wip: push, the checkpoint push, the stop push, the first push of a Planned item and the stage push send a branch that is behind. The change fetches and rebases before each of those pushes, and a conflict takes the existing conflict path.
Acceptance criteria
Requirement: Every implement push rebases first
The implement job SHALL fetch the default branch and rebase the item branch onto it before each push of that branch.
Scenario: A checkpoint push after the default branch moved
- WHEN The default branch gains a commit after the run started and the job makes a checkpoint push
- THEN The pushed branch tip has the new tip of the default branch as an ancestor
Requirement: The first push of a Planned item is rebased
The implement job MUST rebase the new branch before _publish sends it and opens the draft pull request.
Scenario: A wip: push of a Planned item
- WHEN A Planned item commits the first of two tasks and the default branch gained a commit
- THEN The branch of the draft pull request has the new tip of the default branch as its merge-base
Requirement: A rebase conflict at a push stops the item
The implement job MUST stop the item when the rebase before a push conflicts, and it MUST record the unmerged files.
Scenario: A conflict at a checkpoint push
- WHEN The default branch and the item branch change the same lines and the job rebases before a checkpoint push
- THEN The job aborts the rebase, sets Status Blocked, and the comment and
implement.conflictname the masked unmerged files
Requirement: The stop push keeps its work when the rebase conflicts
The implement job MUST push the branch at its aborted tip when the rebase before the stop push conflicts.
Scenario: A conflict at the stop push
- WHEN The stop push rebases onto a default branch that conflicts with the branch
- THEN The job pushes the branch at its tip with the lease, and the note of the stop names the rebase reason
Requirement: The push after a rebase carries the lease
The implement job MUST push a rebased branch with --force-with-lease on the remote tip that it read.
Scenario: A rebase rewrites a branch that is on origin
- WHEN The job rebases a branch that
originalready holds and then pushes it - THEN The push names the remote tip that the job read in
--force-with-lease, and the branch onoriginis the rebased head
Requirement: The final push checks the head that it sends
The implement job MUST run the scoped checks on the head that the final push sends.
Scenario: The default branch moves before the final push
- WHEN The job reaches the final push and the default branch gained a commit
- THEN
implement.checked_shaandimplement.published_shaequal the pushed head
Requirement: The stage job rebases the plan branch before the push
The stage job SHALL fetch the default branch and rebase the plan commit onto it before it pushes the plan branch.
Scenario: The default branch moves during the plan run
- WHEN The default branch gains a commit while the job plans the item and the job commits the change
- THEN The plan branch on
originhas the new tip of the default branch as an ancestor
Requirement: A stage rebase conflict fails the item
The stage job MUST abort the rebase and fail the item with the reason and the unmerged files when the plan commit conflicts with the default branch.
Scenario: A conflict at the stage push
- WHEN The plan commit and the default branch change the same lines
- THEN The job aborts the rebase, pushes no branch, and the failure record and the run report name the masked unmerged files
Existing Tool Considered
No alternatives check has run. Git (https://git-scm.com) covers the need: git fetch and git rebase are the operation, and _sync already uses them. Git lacks nothing for the rebase. The change adds call sites, so it builds no merge code that it must keep.
Key questions
- Which pushes of the implement job skip the fetch and the rebase today?:
_startand_pushare the only_synccallers._keep,_checkpointandstopcall_push_passed, which calls_push_with_leaseor_publishwith no fetch or rebase. [sources: src/devops_cli/roadmap/implement/implement_run.py] - Does the repository require a branch that is up to date before a merge?: No. The
mainruleset requiresStatic Analysis,Tests & CoverageandSemantic PR title, and it sets no strict up-to-date policy. GitHub does not enforce it, so the job must rebase. [sources: docs/adr/0004-ci-is-the-authoritative-gate.md] - Where does the implement job rebase before a push?: In
_push_passed, the one funnel of every push that is not the final push: thewip:push, the checkpoint, the stop and the first publish of a Planned item._pushkeeps its own_syncbefore the scoped checks, so the checks run on the head that it pushes. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py]- Chosen:
_push_passed. One place covers the four pushes, and a new push site calls the same funnel. - Rejected: each call site. Four sites drift apart, and a new push site forgets the rebase.
- Rejected:
_publishonly. The checkpoint and stop pushes stay behind the default branch.
- Chosen:
- What does a rebase conflict at a
wip:or checkpoint push do?: It stops the item with the existing conflict path._syncaborts the rebase and raises_StopErrorwith the reason and the masked unmerged files. The job records them inimplement.conflictfor the next step. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py]- Chosen: stop the item. The branch is not left behind, and the unmerged files reach the next step.
- Rejected: log the note and continue. The branch stays behind, and the conflict returns at the final push with more work at risk.
- How does the stop push keep the last ticked task when its own rebase conflicts?:
stopcalls_push_passed(). On a_StopErrorfrom the rebase, it adds the reason to the note. It then calls_push_passed(rebase=False), which pushes the aborted tip with the lease. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py]- Chosen: push the aborted tip. The commit of the last ticked task still reaches
origin. - Rejected: skip the push. The worktree goes, so the commit is lost.
- Rejected: let the stop raise. A second
_StopErrorescapesend_stoppedand fails the whole run.
- Chosen: push the aborted tip. The commit of the last ticked task still reaches
- Does the push after a rebase need a lease?: Yes. A rebase rewrites the branch, so a plain push is refused.
_push_with_leasesends--force-with-lease=<branch>:<remote tip>with the tip that the job read, so a push of another person is never overwritten. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py]- Chosen: the lease. Git accepts the rewritten branch and keeps a push of another person.
- Rejected: a plain push. Git refuses a non-fast-forward.
- Rejected:
--force. It overwrites a push of another person.
- Where does the stage job rebase the plan branch?: The rebase goes in
_commit_and_push, after the one commit and beforegit push -u, on the worktree. Its fetch reads the sameorigin/<default>ref that_moved_forfetched before the publish. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py]- Chosen: after the commit, in
_commit_and_push. The one plan commit is replayed onto the fetched default before the push. - Rejected: before the commit, by moving the worktree base. The worktree starts at the staged commit that
_moved_forcompares, so the moved-path report would change. - Rejected: in
_stage_oneafter the push. The push is inside_commit_and_push, so the rebase would come after it.
- Chosen: after the commit, in
- What does a stage rebase conflict do to the item?: It aborts the rebase, pushes no branch, and fails the item with the reason and the masked unmerged files. The failure record and the run report name them, and a later round re-plans the item after the wait of its class. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py]
- Chosen: fail the item with the reason. The plan no longer applies to the moved tree, and a later round re-plans it.
- Rejected: return the item to New. The plan is not at fault, and a return loses the review of the plan.
- Rejected: push the branch without the rebase. That is the defect.
- Do both jobs share the conflict listing?: Yes. A new helper
src/devops_cli/roadmap/rebase.pyholdsfetch_and_rebase(path, default). It fetches, rebases, aborts on a conflict and returns the raw output with the masked unmerged files. Each job builds its own message from it. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/stage/stage.py]- Chosen: a shared helper. One fetch, rebase and abort path, and one masked file list.
- Rejected: a copy in each job. Two listings of unmerged files drift apart.
- Rejected: stage imports the private helpers of
implement_run. A job module must not import another job's private functions.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.Every implement run produces a PR behind main, degrading review but not blocking delivery.Larger diffs and missed conflicts slow review and increase merge risk for every task.Multiple push paths in implement_run.py and stage.py need a rebase call plus conflict handling.Both add a rebase before push, but #4076 covers the gap between stage and implement start while the candidate covers wip, checkpoint, stop, and first pushes inside the run.devops-cli-service commentedon Nov 10, 2026
Status set to Ready at 04db2fc (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Released in v0.108.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.108.0
devops-cli-service commentedon Nov 10, 2026
Live since 2026-11-10 16:07 UTC