Repository navigation
Description
Problem or Motivation
When devops roadmap stage creates a plan pull request, it creates a topic branch from origin/main.
Implementation steps for that pull request can run much later. During the delay, other changes merge into main. The topic branch stays at the commit where it branched.
In pull request #4035 (issue #3253), the topic branch stayed 8 commits behind origin/main. Those 8 commits included a major test restructuring (pull request #4050). The GitHub pull request diff showed 216 files changed instead of the 3 files modified by the task.
When an implementation runner starts on a stale branch:
- The model inspects or modifies outdated files and paths.
- The pull request accumulates large diffs that hide the true changes.
- Merge conflicts occur late during step exit or PR merge rather than being detected early.
Proposed Solution & Architectural Design
- In
src/devops_cli/roadmap/implement/implement_runner.py(orimplement_step.py), fetchorigin/mainbefore running an implementation step on a staged branch. - Check if the topic branch is behind
origin/main. If the branch is behind and has no uncommitted changes, rebase the branch ontoorigin/main:- If the rebase succeeds cleanly, push with
--force-with-leaseor keep the rebased commit for the step. - If the rebase encounters conflicts, abort the rebase and fail early with a clear error: "Staged branch has conflicts with main; resolve conflicts before implementing".
- If the rebase succeeds cleanly, push with
- Add a CLI flag
--no-rebasetodevops roadmap implementto disable the automatic rebase when necessary.
Target Subsystem
AI & Agentic Review Pipeline
Existing Tool Considered
Git rebase command in git_support.py. Implementing this rebase check before step execution requires approximately 5,000 tokens to implement and test.
Standards Compliance
- I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 5, zero bare exceptions, tests that cover the changed lines).
- I am willing to submit a pull request implementing this feature with accompanying tests.
Source: #3253
Proposed design
Problem statement
An implementation step can run on a staged branch that is many commits behind origin/main: the model then reads and changes outdated files, and the pull request diff grows to include other work. The job already does what the issue asks before the first step and before the push: it fetches the default branch and rebases the branch onto it, aborts and stops the item when the rebase conflicts, and pushes the result with a lease (src/devops_cli/roadmap/implement/implement_run.py:14, :641, :675, :1066). The remaining part of the issue is the escape hatch: a --no-rebase option that skips that fetch and rebase when a person runs the job.
Acceptance criteria
Requirement: The option skips the fetch and the rebase
devops roadmap implement SHALL accept a --no-rebase option that skips the fetch of the default branch and the rebase of the branch before the first step and before the push.
Scenario: The option skips both syncs
- WHEN a runner Job runs
roadmap implement --repo <owner/name> --item 7 --confirm --no-rebasein a real repository whoseorigin/mainholds a commit that the branch lacks - THEN the worktree gets no
git fetch -q origin mainand nogit rebaseat the start or before the push, the branch keeps its commits, and the job pushes them with the lease
Requirement: The default run rebases before the first step
Without --no-rebase, the job SHALL fetch origin/<default> and rebase the branch onto it before the first step of an item.
Scenario: A branch behind the default branch
- WHEN a staged branch is 8 commits behind
origin/mainand the job starts the item without--no-rebase - THEN before the first model request
git merge-base --is-ancestor origin/main HEADexits 0 in the worktree, and the branch's commits sit on top of the commit oforigin/main
Requirement: A conflicting rebase stops the item
Without --no-rebase, the job SHALL abort a rebase that conflicts, leave the branch at its tip, and stop the item with the failure class conflict and the unmerged files in implement.conflict.
Scenario: A conflict with the default branch
- WHEN
git rebase origin/mainstops with a conflict and the job runs without--no-rebase - THEN the job runs
git rebase --abort, the branch head is the commit it was before the sync, and the stop comment and the record name the conflicted files
Requirement: The option is refused outside a runner
devops roadmap implement --item <n> --confirm SHALL refuse --no-rebase outside a runner, name the option and the devops k8s run-job command, and send no request.
Scenario: A workstation passes the option
- WHEN a person runs
devops roadmap implement --item 7 --confirm --no-rebaseoutside a runner - THEN the command exits 1, the message names
--no-rebaseanddevops k8s run-job --template runner, and no cluster request is sent
Requirement: The dry run lists no rebase
devops roadmap implement --dry-run --no-rebase SHALL print the requests of the run without the rebase request.
Scenario: A dry run with the option
- WHEN a person runs
devops roadmap implement --repo owner/name --item 7 --dry-run --no-rebase - THEN the plan holds no
git rebase origin/mainrequest, and it still holds the push of the branch with its lease
Existing Tool Considered
Git, the open and maintained tool (https://git-scm.com/docs/git-push, fetched 2026-11-08; the page is current to git 2.56.0), covers the need: git fetch, git rebase, git rebase --abort and git push --force-with-lease do the work, and the job already wraps them in _ItemRun._git (src/devops_cli/roadmap/implement/implement_run.py:518) and _sync (src/devops_cli/roadmap/implement/implement_run.py:675). The body's git_support.py does not exist in this repository; the wrapper is _ItemRun._git, which calls git() of src/devops_cli/git/operations.py. Git lacks only the decision of when to skip the rebase, which is the --no-rebase option and its plumbing: about 1,000 tokens to build and test, about 500 tokens to keep and fix, over about 1 hour. The body's 5,000-token figure covered the whole rebase wiring, which already exists.
Key questions
- Does the job already fetch
origin/mainand rebase the staged branch before the first step, and where does it run?: Yes._ItemRun._startsets the steprebaseand calls_sync, which runsgit fetch -q origin <default>andgit rebase origin/<default>before the first step;_ItemRun._pushcalls_syncagain before the scoped checks and the push. Both calls are insrc/devops_cli/roadmap/implement/implement_run.py, outside the agent step: the step runs one task group in one checkout, and the job writes the branch and the pull request, so the force push stays out of the step. [sources: src/devops_cli/roadmap/implement/implement_run.py:14, src/devops_cli/roadmap/implement/implement_run.py:641, src/devops_cli/roadmap/implement/implement_run.py:679, src/devops_cli/roadmap/implement/implement_run.py:1066, openspec/specs/roadmap-implement-job/spec.md:134, openspec/specs/roadmap-implement-step/spec.md:9, openspec/changes/archive/2026-11-05-3054-a-stopped-step-keeps-its-work/proposal.md:50] - Which branch does the job rebase?: The branch of the worktree that
_worktreeadds: the staged branch atorigin/<branch>for a Staged item, or the new branch at the fetched default branch for a Planned item. One_synccovers both cases. [sources: src/devops_cli/roadmap/implement/implement_run.py:396, src/devops_cli/roadmap/implement/implement_run.py:675] - How does the job tell that the branch is behind
origin/main?: It does not tell: aftergit fetch -q origin <default>,git rebase origin/<default>rebases a branch that is behind and is a no-op when HEAD already contains the default branch. One git call covers both cases, so the change adds no ancestor check. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:679, openspec/specs/roadmap-implement-job/spec.md:134, openspec/changes/archive/2026-10-28-2415-review-session-head-commit/proposal.md:32]- Chosen: Rebase unconditionally after the fetch. The existing code, one git call, no output to parse;
git rebasechanges nothing when HEAD already contains the default branch. - Rejected:
git merge-base --is-ancestor origin/main HEADand its exit code. It adds a second git call and a branch for no change in behavior; its exit codes are 0 for an ancestor, 1 for not, and 128 for a commit the repository lacks. - Rejected: Parse
git rev-list --count HEAD..origin/main. It parses a number from output and adds an error path.
- Chosen: Rebase unconditionally after the fetch. The existing code, one git call, no output to parse;
- Which push mode sends the rebased branch?:
git push --force-with-lease=<branch>:<remote tip>, where the tip is the commit that the job read fromorigin/<branch>. A plain push is refused after a rebase rewrote the history, and--forcewould drop a commit that another actor pushed after the job's fetch. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:1131, openspec/changes/archive/2026-10-29-2665-implement-job/design.md:9, https://git-scm.com/docs/git-push/2.33.0]- Chosen:
--force-with-lease=<branch>:<remote tip>. The job sends the tip it read, so a push over work that arrived after the fetch is refused and no commit of another actor is lost. - Rejected:
--force. It drops a commit that another actor pushed. - Rejected: A plain push. It is refused after a rebase rewrites the history.
- Chosen:
- What does the job do when the rebase conflicts?: It reads the unmerged files with
git diff --name-only --diff-filter=U, runsgit rebase --abort, which puts the branch back on its tip, and stops the item with the failure classconflict. The stop comment names the branch and each conflicted file, the record holds them inimplement.conflict, and a trusted person resolves the conflict and commentsimplement: retry. The reason is the existing text, which names the files, not the body's fixed sentence. [sources: src/devops_cli/roadmap/implement/implement_run.py:682, src/devops_cli/roadmap/implement/implement_run.py:698, openspec/specs/roadmap-implement-job/spec.md:1487, CONTEXT.md:138] - Is a CLI option or a setting the switch for the rebase, and does the option exist today?: A CLI option
--no-rebaseondevops roadmap implement, and it does not exist today: the option table holds--repo,--source,--item,--group,--filter,--limit,--format,--json,--dry-run,--plan,--confirm,--why,--contextand--wait/--no-wait, and no--no-rebase. The option skips both_synccalls and nothing else: the job still commits, runs the scoped checks and pushes. The Service runs the job with no arguments, so the unattended path always rebases; a setting would let a stale branch run with no person noticing. (best practice) [sources: src/devops_cli/commands/roadmap.py:711, docs/CLI_REFERENCE.md:6836, docs/CLI_REFERENCE.md:6853, src/devops_cli/roadmap/implement/implement_run.py:641]- Chosen: CLI option
--no-rebaseonly. It serves the person who debugs a branch, and it keeps the unattended path always current. - Rejected: A setting only. A person changes it away from the point of the run, and a wrong value stays for the Service.
- Rejected: Both. It doubles the surface and the tests for one escape hatch.
- Chosen: CLI option
- How does a person pass
--no-rebaseto a job that runs in a runner?: Withdevops k8s run-job --template runner --repo <owner/name> -- roadmap implement --repo <owner/name> --item 7 --confirm --no-rebase. Outside a runner,devops roadmap implement --item 7 --confirm --no-rebaserefuses the option and names that command, as--source,--filterand--limitalready do throughrunner_only_options. (best practice) [sources: src/devops_cli/roadmap/implement/implement_outside.py:51, src/devops_cli/roadmap/implement/implement_outside.py:65, src/devops_cli/commands/roadmap.py:761]- Chosen: Refuse outside a runner and name the run-job command. It follows the existing runner-only options, and the person adds the option to the command that makes the Job.
- Rejected: Forward the option into the Job args.
job_argsbuilds the args for the Service too, and a flag of a person would reach the unattended path.
- Does the job rebase a checkout that has uncommitted changes?: No.
_worktreeadds the worktree fromorigin/<branch>or from the fetched default branch, so it is clean at the start, and a step refuses a checkout in whichgit status --porcelainlists a change. The person's--grouppath runs no sync at all. So the change adds no dirty-checkout guard and no stash. [sources: src/devops_cli/roadmap/implement/implement_run.py:396, src/devops_cli/roadmap/implement/implement_run.py:641, openspec/specs/roadmap-implement-step/spec.md:107] - Does a dry run fetch, rebase or push?: No.
--dry-runis a request plan: it starts no process and prints the requests, which include the rebase and the push of the branch with its lease. With--no-rebasethe plan omits the rebase request, which is built inimplement_requests. [sources: src/devops_cli/roadmap/request_plan.py:844, src/devops_cli/roadmap/request_plan.py:855, src/devops_cli/roadmap/implement/implement.py:552, docs/CLI_REFERENCE.md:6848]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-10: partly.
Tool: git/git (https://github.com/git/git), NOASSERTION, last activity 2026-11-09, maintained.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It prevents large misleading diffs and late merge conflicts, but the pipeline still completes without it.It reduces noise in pull request diffs and surfaces conflicts early, improving review quality for all implement runs.It needs a fetch, a behind-check, a rebase with conflict handling, a CLI flag, and tests, roughly 5000 tokens per the body.Both target the roadmap implement runner, but #2665 defines the group-run and archive flow while the candidate adds a rebase-onto-main step before that flow starts.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at c8990be (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Alternatives check: partly
Reason: Git covers the rebase work (fetch, rebase, rebase --abort, push --force-with-lease), and the issue's own refine section says the job already wraps these in its own code. What is left is the
--no-rebaseoption and its plumbing, which is project-specific CLI code and not something an outside tool provides. My one web search returned nothing relevant, so the Git facts come from the repository read and the issue text.Tool: git/git (https://github.com/git/git)
Covers:
Lacks:
--no-rebaseCLI option ondevops roadmap implementTools considered:
Searches run:
Sources:
Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 11, 2026
Close as not planned (hooks review, 2026-11-11)
The behavior that this issue asks for exists on
main:_startcalls_sync(push_on_conflict=False)before the first step (src/devops_cli/roadmap/implement/implement_run.py, near line 748)._syncfetchesorigin/<default>and rebases the branch onto it._pushcalls_syncagain before the push. fix(roadmap): rebase the branch before its first push #4380 (closed) delivered the rebase before the first push.conflict.The remaining part of the refined design is the
--no-rebaseoption. The owner requirement of 2026-11-11 makes a rebase onto the currentorigin/mainright before each push mandatory, and #4670 does it inpush_branch. The option would thus be an escape that the push gate defeats.Thus this issue should close as not planned (AGENTS.md rule 2). The agent run that wrote this comment could not close it, so a person closes it. It is child 4 of the hooks plan #4771.
devops-cli-service commentedon Nov 16, 2026
Released in v0.160.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.160.0
devops-cli-service commentedon Nov 16, 2026
Live since 2026-11-16 03:02 UTC