Skip to content

Design adopt Before Rebuilding It: the Measurement That Removed It From handoff.py v1 #1499

Closed as not planned

Description

@ptr727

scripts/handoff.py shipped without an adopt subcommand. This records why, with the measurement, and what a later design has to answer before it returns.

What adopt was for

Putting the handoff label and the metadata block on an issue that predates both, so a hand-written handoff joins the chain. #1470 specified it, and it was built and reviewed alongside the other six subcommands.

Why it was dropped

Ten adversarial review passes ran over the branch. The first six each found a new defect in adopt, always the same shape: a multi-step write that leaves the chain forked, orphaned, or unrecoverable while every step reports success. Each round closed the member it found and the next round found another.

The tenth pass measured it rather than arguing it. A randomised search over reachable stores, built only from command sequences that exited 0, found 60 distinct all-green sequences that fork or orphan a track in 20000 trials. Every one of them requires adopt. Two independent controls restricted to new and link found 0 in 400 trials and 0 in 150.

The shortest fork is three commands, no malformed data, no failed write:

new   --track alpha                                   # -> #2, round 1
adopt 5 --track alpha --round 2 --previous 2          # a hand-written handoff, closed
new   --track alpha                                   # -> #6, round 2, previous=2
chain --grep 'written by hand'                        # -> 0 of 2 links walked match

#5 is unreachable from every later walk, and the search answers "not tried" over a chain that contains the text. That is precisely the failure the chain replaces a file to prevent.

Why the core path is not affected

new and link write the chain forward from state the tool itself produced. adopt writes it from state a human typed: an issue number, a track, a round, and a predecessor, none of which the tool can derive. Every guard it needed was discovered one review pass at a time rather than designed, which is the pattern the measurement made visible.

What a returning design has to answer

  • Where does the round number come from? Taking it from the caller is what let a link claim a round its position in the chain contradicts. Deriving it from the named predecessor is one candidate.
  • What is the whole set of positions an issue can be adopted into? Head, tail, and interior are three different validations, and the shipped version validated a subset of one of them.
  • Which invariants must hold after the write, checked against both the open and closed sides? The shipped version checked one side or the other depending on branch, and every round found a branch that checked neither.
  • Is a subcommand the right shape at all? The state adopt produced is reachable by hand in two edits, adding the block to a body and adding the label, and the tool's refusals already name both. A subcommand earns its place only if it is safer than those two edits, which the measurement says this one was not.

Until then, a hand-written handoff joins a chain by hand, and handoff.py's refusals for an unmarked labeled issue say exactly which edit to make.

Acceptance

  • A design that answers the four questions above, reviewed before implementation rather than after.
  • The randomised reachable-state search re-run against the new implementation, reaching 0 forks over a sample at least as large as the 20000 that condemned the first one.

Activity

  1. added
    enhancement
    script
    on Sep 10, 2026
  2. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Decision needed (decision triage, 2026-11-01)

    Question: Now that #3402 replaced the per-session handoff chain with one standing issue per track, should this issue (re-design an adopt subcommand for scripts/handoff.py) be closed with manual adoption as the permanent answer?

    Options, recommended first:

    1. Close as not planned (recommended): Keep One Standing Handoff Issue per Track #3402 removed the link chain model the four design questions and the fork measurement were about. Adoption is now two hand edits (label plus metadata block) or new --track X --body-file, and the tool already refuses with the edit to make. No work in flight.
    2. Keep open, re-scope to the standing-issue model: Worth it only if hand-written track issues prove common enough to justify a subcommand. Needs a rewrite, since its acceptance criteria name a model that no longer exists. No work in flight.
    3. Keep open as written: Not defensible: its head/tail/interior questions and caller-supplied round target new/link code that is gone. No work in flight.

    Evidence: 92875fb (#3402, "Keep One Standing Handoff Issue per Track", decision on #3391 item 5). scripts/handoff.py:1447-1513 offers only current, resume, chain, new, close, tracks, and new derives the round itself. Refusals name the manual fix (handoff.py:700-701, :1113-1128). The issue itself: "A subcommand earns its place only if it is safer than those two edits."

    Blocks: none

  3. added
    decision
    on Nov 1, 2026
  4. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer (decision triage, 2026-11-01): Option 1: close as not planned. Manual adoption (two hand edits, or new --body-file) is the permanent answer under the standing-issue model.

  5. removed
    decision
    on Nov 1, 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

    enhancementscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions