Skip to content

Auto-dismiss the continue-rebase prompt when it becomes stale#5758

Merged
stefanhaller merged 2 commits into
masterfrom
auto-dismiss-prompt-to-continue-rebase
Jul 3, 2026
Merged

Auto-dismiss the continue-rebase prompt when it becomes stale#5758
stefanhaller merged 2 commits into
masterfrom
auto-dismiss-prompt-to-continue-rebase

Conversation

@stefanhaller

Copy link
Copy Markdown
Collaborator

When conflicts of an in-progress rebase/merge/cherry-pick/revert are resolved, lazygit pops up a prompt offering to continue it. This is helpful when you started the operation in lazygit and resolved the conflicts in your editor. However, the operation can change out from under it: a coding agent (or the user in another terminal) might continue or abort it, or advance it to a commit with new conflicts. The prompt then becomes stale — pressing continue fails with "no rebase in progress" or acts on the wrong state.

Track whether the prompt is showing, and on each refresh dismiss it if the operation is no longer in the "resolved, ready to continue" state that the prompt is offering to act on.

Also, don't even open the prompt in the first place if the rebase or merge wasn't started from within lazygit. This covers the case where a coding agent makes a rebase, stops at conflicts, resolves them, and then takes some more time to fix the build or run tests, in which case lazygit would show the "continue rebase?" prompt, which is confusing and undesired.

The only legitimate case that I personally encounter where I start a rebase myself outside of lazygit is something like git rebase -x "make test" <base-of-my-branch>, in which case there can never be conflicts if it's done in-place.

Closes #5197.

stefanhaller and others added 2 commits July 3, 2026 18:28
When conflicts of an in-progress rebase/merge/cherry-pick/revert are
resolved, lazygit pops up a prompt offering to continue it. This is
helpful when you started the operation in lazygit and resolved the
conflicts in your editor. But it's confusing when the operation was
started outside lazygit — e.g. by a coding agent in another terminal
that resolves the conflicts but hasn't continued yet because it's still
running tests or fixing the build. lazygit would then prompt unbidden.

Track whether the in-progress operation was started from within lazygit,
and only show the prompt in that case. We record this right after running
a merge/rebase step (in CheckMergeOrRebaseWithRefreshOptions, the
subprocess branch of genericMergeCommand, and the custom-command
conflict path), and clear it whenever a refresh observes that no
operation is in progress — which also handles an operation that was
finished or aborted externally.

The conflict-resolution tests start their operation by running git
directly (not through lazygit's UI), so they call the new test helper
Common.PretendMergeOrRebaseStartedInLazygit to have lazygit treat the
operation as its own and still get the prompt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The prompt offering to continue a rebase/merge is opened from a refresh
and then left to sit until the user acts on it. But the operation can
change out from under it: a coding agent (or the user in another
terminal) might continue or abort it, or advance it to a commit with new
conflicts. The prompt then becomes stale — pressing continue fails with
"no rebase in progress" or acts on the wrong state.

Track whether the prompt is showing, and on each refresh dismiss it if
the operation is no longer in the "resolved, ready to continue" state
that the prompt is offering to act on. This runs on the same refreshes
that would open it (including the background poll and the refresh on
window focus), so the prompt disappears on its own shortly after the
operation moves on.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stefanhaller stefanhaller added the enhancement New feature or request label Jul 3, 2026
@stefanhaller stefanhaller enabled auto-merge July 3, 2026 16:45
@stefanhaller stefanhaller merged commit 2be6ba9 into master Jul 3, 2026
14 checks passed
@stefanhaller stefanhaller deleted the auto-dismiss-prompt-to-continue-rebase branch July 3, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Continue rebase" confirmation popup not dismissed when rebase is completed externally

1 participant