bug(worktrees): rebase silently targets the PRIMARY checkout when dir= is the repo root - and ignores path=/branch= #125
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#125
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
madt_worktrees action=rebaseis documented as "targets a named worktree, never the cwd checkout" (tool schema) and "dir= is REQUIRED (the named worktree); other checkouts are left untouched" (madt_help topic=worktrees). Neither guarantee is enforced. Live repro, 2026-07-15, in sixfold_space/madtea with linked worktree.worktrees/issue-121on branchissue-121-stamp-plugin-version, one commit behind main:action=rebase dir=<repo-root> path=.worktrees/issue-121 onto=mainaction=rebase dir=<repo-root> path=<repo-root>/.worktrees/issue-121 onto=mainaction=rebase dir=<repo-root> branch=issue-121-stamp-plugin-version onto=mainAll three returned
Already up to date - main already on top of mainand left the worktree unrebased. Every call operated on the PRIMARY checkout's branch (main), because dir= named the repo root and rebase treats dir= as the checkout to rebase - whilepath=andbranch=(the params every OTHER worktree action uses for targeting) were silently swallowed.Why this is severe
onto=, this rewrites the primary's checked-out branch - the exact shared-state clobber the foreign-primary guards, madt_pull refusals, and madt_commit refusals exist to prevent. The foreign-repo path even has this guard already (rebase restricted to session-created worktrees); the own-repo path has none.path=andbranch=are accepted-and-ignored on rebase, so a caller following the add/remove targeting convention gets the wrong checkout with no diagnostic. Three differently-shaped calls, one identical wrong result.Asks
action=rebase dir=".worktrees/<name>" onto=<base>.path=/branch=on rebase error out naming the right param (dir=).Acceptance
action=rebase dir=".worktrees/issue-121" onto=main(the documented form) still works.