Skip to content

adopt-project.py: a source whose default branch is not main is adopted with both legs pushed, then its pull request is refused (--base main), and the printed way out repeats --base main #479

Closed

Description

@brettheap

Lane: openreposhape-3 (openRepoShape-3)

(lane openRepoShape-3, 2026-10-12T22:00Z) Found by lane 3's v1.0.0 acceptance pass: an assistant following AGENTS.md's "Adopting an existing repository" literally, on Linux, standard at 36538fd. GitHub was emulated: a stub gh and local bare repositories behind a url.insteadOf, the route tests/test_adopt_github_exits.py uses. Lane 3 claims it.

What is wrong. A source whose default branch is not main (an ordinary master or trunk repository) is adopted all the way, with both legs created and pushed, the split pushed and verified. Then the pull request is refused. The way out the tool prints repeats the same refused command.

Reproduction.

  1. A source whose default branch is trunk, with a second branch develop.
  2. Run plan --source testorg/Beacon --project Beacon. The plan records default_branch: trunk but tracking_branch: main.
  3. Answer the questions; check says plan ok, exit 0.
  4. Run execute --yes. It exits 2 after everything is pushed:
    REFUSED opening the pull request ... gh pr create --repo testorg/Beacon --base main ...
    pull request create failed: GraphQL: Base ref must be a branch
    The branch IS pushed. Open the pull request by hand: gh pr create ... --base main ...
    
    The printed by-hand command fails the same way.

AGENTS.md step 7 tells the assistant to finish with exactly that printed command, so following the documentation leads nowhere. The plan's own follow-up says the split goes "against the source's default branch", but execute uses --base <tracking_branch>, and that defaults to main whatever the source's default branch is (adopt-project.py:5960, :1450, :4478, :4744-4745 at 36538fd). AGENTS.md never mentions --tracking-branch. plan … --tracking-branch trunk works around it: --base trunk, exit 0.

Proposed fix (for review on the PR).

  • plan defaults tracking_branch to the source's own default branch, which it already reads into default_branch:. Then the root and both legs track the branch the source already uses, and the pull request's base is a branch that exists.
  • An explicit --tracking-branch still wins.
  • check names it as a finding when the plan's base is not a branch of the repository the pull request goes to. Then a hand-edited plan fails before anything is created, not after.
  • Tests: adopt a master source and a trunk source end to end in GitHub mode, so the pull request opens against that branch; an explicit --tracking-branch still wins; a plan whose base does not exist is a check finding.

Why v1.0.0. Adopting a repository whose default branch is master is about as ordinary as adoption gets, and it fails after pushing two new repositories. Proposed P1.

Parent: #457 (adopt).

Activity

  1. added this to the v1.0.0 milestone on Oct 12, 2026
  2. brettheap commented on Oct 12, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-3, session 20b4ae33-927d-4b5d-a856-e7e467ea11b2@Eagle, 2026-10-12T22:04:46Z, for #479

    Logged in lanes/log/openRepoShape-3.md at 8d191cec29d4ab233b4241f0b1e0d766dd3dbe12.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#479:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#479"`, kept where the row or its body names `#479`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `479` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions