fix(staged): stop "Rebase onto Origin" misrouting onto a stale remote tip#751
Conversation
…le remote tip Rename `base_branch` to `rebase_target` in `build_commit_pipeline_steps`, pass both the configured base and the actual rebase target through so the AI handoff prompt can flag suspect targets, persist `rebaseTarget` on queued `PipelineExecution`s so the dequeue path no longer downgrades a queued "Rebase onto Origin" to a base rebase, and add an `upstream.behindBase` signal to `BranchGitState` that the timeline's diverged row uses to disable the rebase-onto-origin action with a clarifying reason when the remote branch is itself behind the configured base. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
…target
When `rebase_target` differs from `base_branch`, render the fetch and
rebase step labels as `Fetch origin/{target}` / `Rebase onto
origin/{target}` instead of the generic "base" wording, so a user
watching a "Rebase onto Origin" pipeline sees labels that agree with the
action they clicked.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Reword the `UpstreamGitState::behind_base` doc comment from "would produce an unmergeable result" to "would skip the latest base commits and almost always be the wrong action" — the rebase itself still succeeds, the result just omits the latest base commits, which matches the timeline's user-facing reason string more precisely. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7b52ea283
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let rebase_ref = queued_rebase_target | ||
| .clone() | ||
| .unwrap_or_else(|| base_branch.clone()); | ||
| let steps = build_commit_pipeline_steps(&kind, &base_branch, &rebase_ref); |
There was a problem hiding this comment.
Revalidate queued origin rebases before honoring target
When a Rebase onto Origin session is queued while origin/{branch} is caught up, but origin/{base} advances before this dequeue path runs, this reconstructs the pipeline from the persisted rebaseTarget without refreshing or recomputing behindBase; the generated steps then fetch only origin/{rebaseTarget} and proceed to rebase onto that now-behind remote tip. That leaves the stale-target misroute this change is trying to prevent for queued sessions, so the dequeue path should refresh/check the base-vs-target relationship before preserving the origin target.
Useful? React with 👍 / 👎.
Summary
Fixes a bug where the "Rebase onto Origin" action could silently rebase onto a stale remote tip when the remote branch was itself behind the configured base.
base_branchtorebase_targetinbuild_commit_pipeline_steps; pass both the configured base and the actual rebase target through so the AI handoff prompt can flag suspect targets, and persistrebaseTargeton queuedPipelineExecutions so dequeues no longer downgrade a queued "Rebase onto Origin" to a base rebase.upstream.behindBasesignal toBranchGitState; the timeline's diverged row uses it to disable the rebase-onto-origin action with a clarifying reason when the remote branch is behind the configured base.Fetch origin/{target}/Rebase onto origin/{target}) instead of generic "base" wording, so labels agree with the clicked action.UpstreamGitState::behind_basedoc comment to match the timeline's user-facing reason string.Test plan
Fetch origin/{target}andRebase onto origin/{target}.