Skip to content

openRepoShape --doctor, the form AGENTS.md names first and the one --install gives a person, prints every NEXT command as a path into its temporary clone of the standard, which its EXIT trap deletes before the person can paste the command, so each one fails with can't open file; and it refuses --json and --placement-plan, which AGENTS.md's doctor steps 7 and 4 use #500

Closed

Description

@brettheap

Lane: openreposhape-4 (openRepoShape-4)

(lane openRepoShape-4, 2026-10-12T23:17Z) Found by lane 4's v1.0.0 README/AGENTS.md audit (finding auU-01), re-verified on main 437a360. Lane 4 claims it.

What is wrong. AGENTS.md's compliance section opens with "openRepoShape --doctor [<path>] — or ./shape-doctor.py --root <path> from a checkout" (AGENTS.md:205-206). README says that, installed, "it clones the standard into a temporary directory first" (README.md:1105-1115). Then AGENTS.md says:

  • step 3: a FINDING "carries the exact next command … Run the one the row names" (:226-232);
  • step 4: run shape-doctor.py --root <path> --placement-plan <file> (:239-241);
  • step 7: use --json (:258-259).

Installed, every NEXT names a file under $TMPDIR/tmp.XXXX/shape/. "Installed" means no checkout beside the command, which is what openRepoShape --install places. The command deletes that directory as it exits, so pasting any of those NEXT lines fails with python3: can't open file …: [Errno 2] No such file or directory, exit 2. The --upstream that the shape currency NEXT passes is the same deleted clone. And --doctor refuses every argument except the path, so --json and --placement-plan cannot be asked for at all.

Reproduction. Offline, on Linux. $U is a checkout of main 437a360.

  • The one file $U/openRepoShape is copied to $R/bin/, with nothing beside it, as --install would place it.
  • OPENREPOSHAPE_REPO=$U, so the standard is cloned from a local path and never from GitHub; TMPDIR=$R/tmp.
  • A gh that exits 97 stands first on PATH (the machine row asks it --version and auth status); GIT_ALLOW_PROTOCOL=file is set, and git reads an empty global config.
  1. A plain repository $R/plainrepo: one commit, no manifest. $R/bin/openRepoShape --doctor $R/plainrepo:
    standard    <R>/tmp/tmp.eYSPsRzNqg/shape
                NEXT          python3 <R>/tmp/tmp.eYSPsRzNqg/shape/adopt-project.py plan --source <R>/plainrepo --project plainrepo
                NEXT          python3 <R>/tmp/tmp.eYSPsRzNqg/shape/setup-project.py --preflight   # it names each missing prerequisite and offers to install it, on a typed yes
    NOT A SHAPE ROOT   (exit 2)
    
  2. After it exits, $R/tmp holds 0 entries.
  3. Each NEXT, pasted as printed:
    python3: can't open file '<R>/tmp/tmp.eYSPsRzNqg/shape/adopt-project.py': [Errno 2] No such file or directory
    python3: can't open file '<R>/tmp/tmp.eYSPsRzNqg/shape/setup-project.py': [Errno 2] No such file or directory
    
    Exit 2 each.
  4. A project scaffolded with local remotes, with its pinned .gitignore edited and committed: the verdict is DRIFTED, and the shape currency NEXT is python3 <R>/tmp/tmp.TwP4HtqAFh/shape/update-shape.py check --root <R>/Atlas --upstream <R>/tmp/tmp.TwP4HtqAFh/shape # then apply …. Afterwards $R/tmp again holds 0 entries.
  5. --doctor $R/plainrepo --json, and --doctor $R/plainrepo --placement-plan $R/pp.yaml, each give:
    REFUSED: --doctor takes a path and nothing else; it reads a repository and writes nothing.
        To scaffold, drop --doctor. To check this machine, run: openRepoShape --preflight
    
    Exit 2 each.

Run from a checkout (python3 $U/shape-doctor.py --root …), the same rows name files under $U that exist, and --json and --placement-plan are shape-doctor.py's own flags (shape-doctor.py:5394-5400).

Why. At 437a360:

  • The clone is deleted on exit. workdir sets trap 'rm -rf -- "$WORKDIR"' EXIT (openRepoShape:112-117). shape_checkout clones the standard into $WORKDIR/shape (:329-350). run_doctor runs shape-doctor.py from that clone and then returns: "RUN, never exec: the EXIT trap that removes a cloned checkout belongs to THIS process" (:379-410, the comment at :400-401). So the trap removes the clone.
  • Every printed command is built from that clone. The doctor builds each command it prints from ctx.shape, the standard it was run from:
    • the way in (shape-doctor.py:4948-4950);
    • machine (:4761);
    • shape currency, its --upstream included (:2500-2519);
    • CANNOT ANSWER's git -C <standard> fetch --all (:2438);
    • placement (:3649-3654);
    • agent files (:3982-3990) and the template-validator lines (:1259);
    • naming (:1606).
  • The flags are refused. The argument loop refuses anything beside the path (openRepoShape:463-471). Its comment says --json is "deliberately not plumbed through here while the mode is one path wide".
  • Tests pin both halves. test_the_shim_from_stdin_clones_the_standard_first asserts that the clone does not outlive the run (tests/test_shape_doctor.py:2067-2092). test_the_shim_doctor_takes_a_path_and_nothing_else (:2098) pins the refusal. No test pastes a NEXT from an installed run.

Proposed fix (for review on the PR). Options for Brett:

  1. Keep the standard in a stable cache. Clone into a per-user cache, for example ${XDG_CACHE_HOME:-~/.cache}/openRepoShape/<ref>, fetch it on each run and never delete it, so every NEXT names files that exist. Cost: a directory the person did not ask for, and rules for when it is stale.
  2. Keep this run's clone and say so. Drop the EXIT trap for --doctor, and have the report's last line name the directory and say it is safe to delete. Cost: one temporary directory left behind per run.
  3. Print NEXT lines that do not depend on the clone. The shim tells the doctor how its standard is reached (an env var, say), and the doctor then names openRepoShape … forms, or "from a clone of openRepoShape: …". Cost: every row's NEXT gets two spellings, and the other tools (update-shape.py, adopt-project.py) have no installed form today.

In each option, --json and --placement-plan <file> are passed through to shape-doctor.py, with a relative <file> resolved against the directory the person ran from. AGENTS.md:205-206 then says what the installed form gives (#483's text).

How to test. Extend the shim tests in tests/test_shape_doctor.py:

  • Run the installed form (bash -s -- --doctor, with OPENREPOSHAPE_REPO a local path) on a plain repository and on a drifted project.
  • After the shim has exited, run every NEXT as pasted (the part before #), and assert that none fails with can't open file.
  • --json gives the same rows as the checkout's --json, and --placement-plan <file> writes that file and nothing else.
  • Adjust the two tests named in Why to the chosen option.

Why v1.0.0. openRepoShape --doctor is the form AGENTS.md and README name first, and the only one a person has who installed the command and holds no checkout. AGENTS.md's step 3 is "run the command the row names", and from the installed form no row's command can run. P2 rather than P1 because it fails loudly, creates nothing, and the checkout form named in the same sentence works. Proposed P2.

Parent: #460 (doctor).

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-4, session bf1c72df-1c56-4ac9-aace-3ddd139d7ea3@Eagle, 2026-10-12T23:32:21Z, for #500

    Logged in lanes/log/openRepoShape-4.md at b0030200baceef99ff1002fd7883b6123b0d9d20.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#500:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#500"`, kept where the row or its body names `#500`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `500` as a whole token:
       none
    
  3. added 4 commits that reference this issue on Oct 13, 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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions