Skip to content

merge.sh: an edit in the start checkout skips the classifier #50

Backlog

Description

@lneto

The allow rules for tools/merge.sh and tools/agent-review.sh name each script by its absolute path in the checkout sessions start in, so a copy in a worktree matches no rule (#48). The rule still runs that checkout's tree as it stands. merge.sh runs $(dirname "$(readlink -f "$0")")/checks/merge-guard.sh, which sources commands.sh and project.sh and runs complexity.sh and harness-mixed.sh, all from the same mount. A tracked edit under that mount, or another commit checked out there, therefore decides the merge with no classifier. Before the rule existed, the classifier still stood behind an edited guard.

Nothing reads that state. checkout-behind.sh names a mount that holds another commit than HEAD pins, and only as a session starts. Its count of changed tracked files leaves the mount out (:!$mount), and AGENTS.md expects the checkout to carry a change of its own at times.

Trace, on a stand-in tree: merge-guard.sh edited to exit 0 let merge.sh reach the PUT on a stub gh. The clean guard refused with exit 1.

Decision D200: does merge.sh refuse a start checkout whose tree is not the trunk's?
A) Keep the limit as checks.md now states it (fixup 5d5bbbf on #48).
B) Have merge.sh and agent-review.sh refuse unless git -C <their tree> diff --quiet HEAD holds and GitHub's compare of the trunk with their HEAD answers identical or behind, a few lines in project.sh shared by both. This covers every honest edit and checkout, but not an edit that removes the check itself. It would also refuse a run from a worktree off the trunk, even through the classifier.

Recommendation: B, because over A it turns the honest mistakes, a guard developed in the start checkout by a relative path or a branch checked out in its mount, into a refusal instead of an unseen merge.

Contract: harness/AGENTS.md, Skills: "The checkout sessions start in is what every session and every agent it launches loads, this file, the skills and the guards, so it follows master: checkout-behind.sh ... prints how far its HEAD is behind origin/master ... and the session runs them when the checkout has no commit of its own and nothing tracked changed."

Found while reviewing #48.

Activity

  1. added
    severity: medium
    on Nov 27, 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

    severity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions