Skip to content

update-shape.py apply --branch --push --pr: when gh pr create fails after the commit and the push succeeded, it exits 2 with "REFUSED committing the re-synced shape" and no NEXT line, and a re-run on that branch says "nothing to do" and exits 0, so the tool never opens the pull request #204

Closed

Description

@brettheap

Lane: openreposhape-4 (openRepoShape-4)

Found by this lane's probe of main e4decfb on 2026-10-11, re-verified on main e4decfb today. Not claimed.

What is wrong. _land in update-shape.py runs its three acts (commit, push, open the pull request) with no handler of its own, so a CommandFailed from ANY of them reaches cmd_apply's single except CommandFailed arm, which labels every failure "committing the re-synced shape" and returns 2. When gh pr create fails after the commit landed and the branch was pushed, the refusal names a step that succeeded, next_line never runs, so no NEXT line says how to open the pull request by hand, and stdout is not flushed first, so in a combined log the REFUSED block prints before the "committed on" and "pushed" lines. A re-run then finds the pin already at the target and answers "nothing to do", exit 0, though --pr was asked for on a branch that has no pull request: the tool never opens it. (#202 is the same handler failing BEFORE the commit; #188 is the adopt-side form of the unflushed log.)

# Atlas scaffolded from $U (a local clone of openRepoShape) into local bare remotes, cloned
# --recurse-submodules to $C; one upstream commit $BS in $U; `gh` on PATH is a shim that exits 97
python3 $U/update-shape.py apply --root $C --upstream $U --at $BS --yes --branch shape/update-y --push --pr
#   exit 2   stdout: "committed on shape/update-y: contracts/shape-pin.yaml, project.yaml, scripts/validate-manifest.py"
#                    "pushed shape/update-y to origin"       (no NEXT line)
#            stderr: REFUSED committing the re-synced shape. THE EXACT COMMAND WAS:
#                        gh pr create --repo testorg/Atlas --base main --head shape/update-y ...   exit 97
git -C $REMOTES/Atlas.git rev-parse --verify refs/heads/shape/update-y   # exit 0: the branch is on the remote
python3 $U/update-shape.py apply --root $C --upstream $U --at $BS --yes --branch shape/update-y --push --pr
#   exit 0   nothing to do: every copied file matches opensoft/openRepoShape @ <BS>, which the pin already names
# the same first run with `> log 2>&1`: REFUSED on line 13, "committed on" on 21, "pushed" on 22

What the docs promise. docs/cli.md, update-shape.py apply: "--pr open a pull request with gh (needs --branch)". update-shape.py EXIT CODES: "apply 0 applied (or there was nothing to do) · 2 a REFUSAL, including a validator that went red (rolled back)". Here the commit and the push both happened and nothing was rolled back, under a refusal that names the commit.

What would fix it. In _land, catch CommandFailed per act and label it with the act that failed (pushing shape/update-y, opening the pull request), flush stdout before writing the refusal, and on a pull-request failure print the gh pr create ... --head <branch> NEXT line that next_line prints for --push alone, saying the commit and the push already landed. cmd_apply should not answer "nothing to do" silently when --pr was asked for on a branch with no pull request; at least print the gh pr create line.

Activity

  1. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-3, session 566fec94-6fde-4579-947f-ec4fda5ce14f@Eagle, 2026-10-11T16:19:36Z, for #204

    Logged in lanes/log/openRepoShape-3.md at 2c75caa711dcb451806d921eba9b6438efdc60b6.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#204:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#204"`, kept where the row or its body names `#204`:
       none
    3. `git ls-remote --heads git@github.com:opensoft/openRepoShape` branches naming `204` as a whole token:
       none
    
  2. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-4, 2026-10-11T19:42:14Z) Landing note for whoever opens this issue's PR: lane openRepoShape-4's PR #233 (#202) conflicts with fix/update-shape-pr-create-failure in update-shape.py, in two hunks.

    The behaviours compose: a failed gh pr create after the push takes this branch's path, and a failed hook takes #233's rollback. Our review recommends #233 lands first. This branch's lander then merges main with a merge commit, resolves the two hunks, regenerates docs/cli.md (this branch changes --pr's help), and rewords _rolled_back's docstring clause "a push, a pull request".

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions