Skill: `(merged upstream)` is not a safe signal to `but pull`; confirm with `but pull --check` → `[integrated]`
What is the improvement or update you wish to see?
The agent skill tells agents that (merged upstream) in but status means a branch has landed and but pull will remove it (crates/but/skill/SKILL.md:58). I have seen but status show that marker while but pull --check reported the branch as [ok], not [integrated]. Following the skill's instruction in that state rebased the branch instead of removing it, and left its commits applied as (no changes), some of them {conflicted}.
Two lines in the skill combine to send an agent down this path. Line 58 treats (merged upstream) as the signal to pull. Lines 101-103 tell the agent not to run but pull --check as a routine preflight, which is the one command that showed the disagreement.
Suggested changes:
- At line 58, say that
(merged upstream)alone does not meanbut pullwill retire the branch. Tell the agent to confirm withbut pull --checkthat the branch reads[integrated]first. - Treat a just-merged branch as a case where
but pull --checkis expected, alongside the ones lines 101-103 already list. - Mention that the CLI reports a landed branch as
integrated([integrated]from--check, "has been integrated upstream and removed locally" frombut pull). The skill uses only the phrasemerged upstream, so an agent searching the skill for the word the CLI prints finds nothing. - For a branch left applied after its content has landed, recommend
but unapply <branch>beforebut discard. It clears the lane without destroying anything, andbut applyundoes it.
Is there any context that might help us understand?
Observed on but 0.22.3 with GitHub squash merges. Three cases from the same repository:
- In one case,
but pull --checkreported[integrated]andbut pullremoved the branch cleanly. The skill's instruction worked. - In another, run right after the merge,
but statusshowed(merged upstream)andbut pull --checkshowed[ok]. The branch'sforge_reviewsrow inbut.sqlitehad an emptymerged_at, an emptyintegration_commit_shas, and alast_sync_atolder than the merge. Pulling anyway stranded the commits as described above.git diff --quiet origin/mainconfirmed that their content was already on the target. - In a third, the review row was fully synced:
merged_atwas set,integration_commit_shasheld the squash commit, andvirtual_branches.tomlcarried thepr_number.but pull --checkstill reported[ok], andbut pullrebased the branch rather than removing it. I don't know the cause. The one difference I noticed is that the workspace held an uncommitted edit to a file those commits touched. I have not run a controlled repeat to test it.
So (merged upstream) and [integrated] can disagree. I can't tell from outside how but status reaches its answer. [integrated] was the reliable signal in every case, although in the third case neither was sufficient.
Related: #15127 describes the engine side, where merged commits stay applied as (no changes) and can come back {conflicted}. This issue is only about the skill's guidance, which leads agents into that state.
Does the docs page already exist? If so, please link to it.
https://github.com/gitbutlerapp/gitbutler/blob/master/crates/but/skill/SKILL.md