Skip to content

wip init pushes an adopted checkout's local HEAD verbatim, unreviewed, even when this run wrote nothing #64

Closed

Description

@brettheap

wip init step 6a's safety gate (closing #40 finding 1) inspects the WORKTREE and INDEX of an adopted checkout — git status --porcelain --untracked-files=all -- . ':(exclude)<template path>'... — and refuses if anything unrelated is dirty there. It says nothing about the checkout's COMMITTED history relative to origin/main.

An adopted checkout can be perfectly clean by that gate's own measure while its local HEAD already sits ahead of origin/main with one or more commits nobody has reviewed — carrying, potentially, exactly the kind of unfinished workspace data this command exists to protect (a lane's in-progress register edit, an object log entry, anything). Step 8's push is unconditional on content: git push origin HEAD:main publishes whatever HEAD is, whether or not this run itself wrote, staged, seeded or owed a single byte (seeded + owed can be 0 and the push still happens, because the push is gated only on local_head != remote_head, not on this run having done anything). So a wip init re-run on an adopted checkout that happens to have unpushed local commits publishes them — commits this command never made, never inspected, and whose content it has no contract about at all.

Why this is being filed rather than judged here

This is not a narrow implementation gap in one branch of step 7 (the class of finding round 3 has otherwise been closing in this function) — it is a question about what "adopting" an existing checkout is allowed to assume about that checkout's own history, going back to the push mechanism wip init has had since the command was first written for Amendment 9(c) and unchanged by every review round on PR #44 (round 1, round 2 and round 3 all left git push origin HEAD:main itself untouched). Two shapes an eventual fix might take, both changing what this command promises well beyond a mode stamp or a byte comparison:

  • Refuse an adopted checkout whose local HEAD is already ahead of origin/main's (as last known — this command does not fetch), naming the commits and leaving the person to push or discard them themselves before this command will touch the checkout.
  • Constrain what this command pushes to a commit it can prove is its own seed (walking the commit it makes and asserting HEAD after it equals what step 8 just committed, or similar), rather than pushing HEAD verbatim.

Either has real trade-offs for the tool's other stated behaviour (idempotence, "a workstation that already has a workspace does nothing at all" — decided by a file test, and the intent that an adopted checkout with real work in progress on main is exactly the case Amendment 9(c) wants this command to pick up rather than refuse) that are Brett Heap's to weigh, not a subagent's to decide unilaterally on a PR already five commits into one review round.

Reported via review thread #44 (comment) (now resolved on the PR, naming this issue).

Activity

  1. brettheap commented on Sep 14, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-14T22:09:20Z, for #64

    Logged in lanes/log/openRepoTools-3.md at a29b2251779102648e959a0106f21f30a72f7b22.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoTools#64:
       none
    2. `gh pr list --repo opensoft/openRepoTools --state all --search "#64"`, kept where the row or its body names `#64`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoTools` branches naming `64` as a whole token:
       none
    
  2. brettheap commented on Sep 16, 2026

    @brettheap
    ContributorAuthor

    RELEASED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-16T00:36:15Z, for #64

  3. brettheap commented on Sep 16, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoTools-1, session df82f553-7803-49c4-8ddf-3f9acdcb8ee0@Eagle, 2026-09-16T01:07:00Z, for #64

    Logged in lanes/log/openRepoTools-1.md at aeab975537df91ad572408728c0867f164f152ed.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoTools#64:
    6:CLAIMED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-14T22:09:20Z, for opensoft/openRepoTools#64
    13:1. existing `CLAIMED —` comments on opensoft/openRepoTools#64:
    26:RELEASED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-16T00:36:15Z, for opensoft/openRepoTools#64
    2. `gh pr list --repo opensoft/openRepoTools --state all --search "#64"`, kept where the row or its body names `#64`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoTools` branches naming `64` as a whole token:
       none
    
  4. brettheap commented on Sep 16, 2026

    @brettheap
    ContributorAuthor

    Lane openRepoTools-1 (claimed 2026-09-16, from openRepoTools-3's brief). This is the DESIGN question the brief says to write up and put to Brett Heap before any code, so here are the options as read from wip_init at main f9e63f4. Nothing is changed until he chooses.

    What the code does today. Step 6a refuses an adopted checkout whose WORKTREE or INDEX carries anything unrelated (git status --porcelain --untracked-files=all -- . ':(exclude)<template path>'…). It never looks at committed history. Step 8 stages and commits only the paths this run wrote, then asks ls-remote origin main and pushes HEAD:main whenever local_head != remote_head — so a clean adopted checkout with unreviewed local commits ahead of origin/main has them published by a command that wrote nothing. The one case the verbatim push EXISTS for is the re-run after a ruleset-rejected first push: a clean worktree, one unpushed SEED commit, and the promise "a re-run after that has only to push".

    Option 1 — refuse at step 6a when HEAD is ahead of origin/main by anything that is not this command's own seed. Extend the 6a gate from worktree+index to history: ask ls-remote origin main there (step 8 already asks it; move the ask earlier and keep its "could not ask → fall through" arm), then git rev-list <remote_head>..HEAD; every commit ahead must be a seed this command made — subject Seed this workspace repository from …, trailer Written by \openRepoTools wip init`, and a tree that differs from its parent only at template paths. Anything else is a refusal (exit 2) NAMING the commits (git log --oneline <remote_head>..HEAD`), leaving the person to push or discard them, with nothing written into the checkout. Pros: the finding is closed where the other #40 finding was closed, before a byte is written; the re-run promise survives because the seed commit is recognised. Cons: a person whose adopted clone legitimately sits ahead of main (they parked a register edit on this workstation and never pushed) must push it themselves first — which is arguably exactly right for a repository that holds unfinished work, and is one command they can read off the refusal.

    Option 2 — push only what this run can prove is its own. Keep step 6a as it is; in step 8 push <seed>:main only where the seed's parent IS remote_head (fast-forward by exactly the commit this run, or the ruleset-rejected earlier run, made). Any other gap is a refusal at step 8 naming the commits. Pros: smallest diff; the person's own history is never published by this command. Cons: the refusal lands AFTER the template bytes and the seed commit are already in the checkout (the seed then sits on top of their commits), so a re-run cannot help until they push — the tool has written into a checkout it then declines to finish.

    Option 3 — explicit opt-in. Keep the verbatim push but refuse by default when commits ahead are not seeds, printing them, and add wip init --push-local-history (name to be chosen) that publishes them knowingly. Pros: the person can finish in one re-run. Cons: a flag on a command that is meant to be run once and forgotten; the refusal has to be Option 1's or Option 2's anyway, so this is an addition to one of them, not an alternative.

    Option 4 — status quo, documented. Amendment 9(c) says an adopted checkout is the person's own clone of their own workspace repository, and commits on its main are theirs to publish; wip init stating this in its usage text and printing the commits it is about to push is the whole change. Pros: no behaviour change; idempotence untouched. Cons: it is the finding, restated as a feature — an unreviewed local commit still leaves the workstation because someone ran a setup command.

    Recommendation from this lane: Option 1. It closes the finding at the gate that already exists for it, keeps the ruleset re-run promise by recognising the seed commit, and its trade-off (push your own commits first) is the right rule for a repository whose purpose is unfinished work. Option 3's flag can be added later if a real workflow wants it. The tests would live in tests/test_wip_init_command.py: an adopted checkout ahead by a person's commit refuses naming it and writes nothing; one ahead by a ruleset-rejected seed re-runs and pushes; the "could not ask the remote" arm still falls through to the probe push.

    Brett: which option, or another? I hold the object and will build whichever you name.

  5. brettheap commented on Oct 2, 2026

    @brettheap
    ContributorAuthor

    RULING (Brett Heap, 2026-10-02, verbatim): "go with option 1 on #64".

    Option 1 is therefore what lane openRepoTools-1 builds: step 6a refuses an ADOPTED checkout whose HEAD is ahead of origin/main by anything that is not this command's own seed commit. The remote is asked at 6a (step 8's ls-remote origin main, moved earlier, keeping its could-not-ask → fall-through arm); every commit in <remote_head>..HEAD must carry the seed subject and trailer AND differ from its parent only at template paths; anything else is a refusal (exit 2) naming the commits, with nothing written into the checkout and the remedy on screen (push or discard them, then re-run). The ruleset-rejected first push keeps its re-run promise because its one seed commit is recognised. Tests: a person's commit ahead refuses and writes nothing; a seed ahead re-runs and pushes; a remote that cannot be asked still falls through to the probe push; a commit wearing the seed subject but touching a non-template path is refused.

  6. added 2 commits that reference this issue on Oct 3, 2026
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