mcp: re-pointing origin after a repo transfer breaks the local-remote link with no recovery #726
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#726
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?
I transferred a repo to a new org on the forge, then could not re-point the local clone's origin through the MCP tools without breaking the local-to-remote link. There is no sanctioned recovery, which is the real problem: a caller on the MCP surface should never be able to strand a clone.
What happens
madt_remote_addis the only remote-wiring tool, and it REFUSES to re-point an existing origin: "remote 'origin' already exists - use 'git remote set-url'". So there is no MCP way to re-point in place.git remote remove origin, thenmadt_remote_add). The re-added origin reports "per-repo credentials configured", but the clone can no longer fetch:madt_fetchreports "already up to date" and never populatesrefs/remotes/origin/*;madt_pullfails with "no upstream branch configured"; after setting the upstream by hand,origin/mainstill does not resolve. The local fetch refspec is correct (+refs/heads/*:refs/remotes/origin/*), so this is not a refspec problem.madt_remote_addrefuses the existing origin,madt_fetch/madt_pullno-op, and rawgit fetchor a credentialedgit remote set-urlare blocked by the credential-safety hooks. The clone is stranded behind the remote.Why this matters
A routine transfer-then-re-point must never leave a clone unable to sync, and a caller working only through the sanctioned surface must never be able to break the local-to-remote link with no recovery. Today it can, and the only exit is a raw-git command that the guards themselves block.
Ask
madt_remote_add(or a newmadt_remote_set) re-point an existing origin, preserving a working fetch refspec and remote-tracking, so no remove-and-re-add is needed.madt_fetchpopulatesrefs/remotes/origin/*for a freshly re-pointed origin; today it reports "already up to date" and populates nothing.Update: the clone recovered with a plain
madtea pull(CLI), which fast-forwarded the 4 missing commits. The MCP path did not: on the same clone,madt_fetchreported "already up to date" and populated no tracking refs, andmadt_pullfailed with "no upstream". So the broken part is the MCP fetch/pull path for a re-pointed origin, not the clone or its refspec - the CLI fetch/pull works on it. That narrows the fix: makemadt_fetch/madt_pullmatch the CLI for a freshly re-pointed origin.Full reproduction trail, so the detail is not lost:
madt_finishmerged the branch on the forge both times (the "this merge landed UNGUARDED" warning fired), but then printed "failed to return to main: exit status 1" and left the local checkout on the old main with the branch's committed changes reverted in the working tree. So amadt_finishwhose clone cannot sync merges remotely yet half-fails locally, silently, twice in a row.madt_remote_addrefused ("remote 'origin' already exists - use 'git remote set-url'"), so origin was removed and re-added; the re-add reported "Per-repo credentials configured".madt_fetchthen reported "Already up to date - origin" repeatedly and created no refs/remotes/origin/*.madt_pullfailed with "no upstream branch configured". Setting the upstream by hand (git branch --set-upstream-to=origin/main main) succeeded, but origin/main still did not resolve ("fatal: Needed a single revision").madtea pullfast-forwarded the 4 missing commits cleanly; the MCPmadt_fetch/madt_pullnever did on that same clone.So two distinct defects: (a)
madt_remote_addcannot re-point an existing origin; (b) after a remove-and-re-add, the MCPmadt_fetch/madt_pullpath neither populates tracking refs nor fast-forwards, though the CLI path does and the refspec is correct. Separately,madt_finishshould not report a landed merge while failing to leave the local checkout on an updated main.