docs(claude): check the base before spending a gate slot (phaze-fkha3) - #539
Merged
Conversation
A 20-25 minute gate measures a TREE, and origin/main can move while it runs, so the gate may characterise a tree nobody will merge. The failure surfaces as SOMEONE ELSE'S red test in your own transcript: measured 2026-08-24, a seat's gate went red 23 minutes in on test_litellm_pin_is_unchanged, in a bead whose own diff was one ADR plus three comment-only edits, while origin/main advanced four commits and another seat fixed that guard as a P0. THE CHECK: `git fetch origin && git rev-list --left-right --count HEAD...origin/main` before check/submit. One second against 20-25 minutes. NOT A MANDATE TO REBASE, and the cost of reading it that way is measured: phaze-irby2 gated green, ran the check, rebased, and paid a second ~22-minute gate because the rebase changed its tree and invalidated the (tree, cmd_hash) ledger key. Rebase-looping against a main moving at 2.71 commits/h never converges. The rule is "know before you spend the slot". MEASURED RATE, so the guidance is proportionate rather than adjectival: 65 commits in 24h on origin/main (2.71/h). Expected commits landing DURING one gate = 0.99 for a 22-minute full run, 0.027 for a 35.57s check-fast selected run. The check earns its keep on the ESCALATED path; both numbers or neither. METHOD CORRECTION: disjointness is `git merge-tree --write-tree`, never hunk arithmetic β three-dot diff headers are in merge-base coordinates (measured 22-line offset on CLAUDE.md). Two limits on it, both measured on git 2.50.1: exit 1 is AMBIGUOUS between a conflict and an unresolvable ref (`nosuchref` -> exit 1), so a never-fetched worktree reports "conflict" having measured nothing; and clean is NECESSARY NOT SUFFICIENT β phaze-sy8z3 merged clean and went 2 failed, 7985 passed on a field another branch renamed. The judgement criterion nothing structural sees: do the new commits FALSIFY or DUPLICATE a claim my text makes? It can tell a seat its text is wrong even when no rebase is needed. Applied to this very section, it caught a closing sentence duplicating the ceiling section's; cross-referenced instead. Population for the whole-tree-guard criterion, measured: 78 of 585 test files read a tracked repo file and assert on its content β one in eight β so a disjoint file list is the wrong answer for that class. The litellm guard is one. AC 4 VERIFIED AGAINST bh 0.15.0 SOURCE, NOT INFERRED (the bead flagged it as an inference). The config's staleness backstop is real but narrower than assumed: it is the MOLECULE boundary only (work_merge.py:282/394; the per-bead path at :854 has no `stale` term), and it cannot see origin/main at all because `git fetch` appears NOWHERE in the lifecycle (work.py, work_merge.py, work_submission.py, work_group.py, worktree*) β the one hit, worktree.py:823, is upstream/<base> for kind=external hives. The developer gate has nothing: impl_check (work_submission.py:10-71) never resolves a base. `bh work merge --help` is silent on all of it. GENERAL FORM (rule 5), as the next term in CLAUDE.md's own series rather than a free-standing aphorism: a gate's M is a property of a RUN not a COMMAND; an M is also a property of a MOMENT, never of the repo in perpetuity β an M about STATE decays, an M about MECHANISM does not. The label makes it worse, because M is the marker that says "do not re-verify this". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GazEx6kCcyQuRvifWb3aBF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A 20-25 minute gate measures a tree, and
origin/maincan move while it runs β so the gate may characterise a tree nobody will merge. The failure surfaces as someone else's red test in your own transcript.Measured 2026-08-24: a seat's gate went red 23 minutes in on
test_litellm_pin_is_unchanged, in a bead whose own diff was one ADR plus three comment-only edits, whileorigin/mainadvanced four commits and another seat fixed that guard as a P0.Adds one section to
CLAUDE.md, directly after the gate-slot rationing section it belongs beside β that one rations slots against the machine's headroom, this one against the result's validity.The check
git fetch origin && git rev-list --left-right --count HEAD...origin/mainOne second against 20-25 minutes.
Explicitly not a mandate to rebase.
phaze-irby2gated green, ran this check, rebased, and paid a second ~22-minute gate because the rebase changed its tree and invalidated the(tree, cmd_hash)ledger key. The rule is know before you spend the slot.Measured, so the guidance is proportionate rather than adjectival
origin/maintook 65 commits in 24 h (2.71/h). Expected commits landing during one gate: 0.99 for a 22-minute full run, 0.027 for a 35.57 scheck-fastselected run. The check earns its keep on the escalated path; both numbers or neither.Method correction
Disjointness is
git merge-tree --write-tree, never hunk arithmetic β three-dot diff headers are in merge-base coordinates (measured 22-line offset onCLAUDE.md). Two limits, both measured on git 2.50.1:nosuchrefβ exit 1), so a never-fetched worktree reports "conflict" having measured nothing.phaze-sy8z3merged clean and went2 failed, 7985 passedon a field another branch renamed.AC 4 β verified against bh 0.15.0 source, not inferred
The bead flagged this as an inference. It is narrower than assumed:
work_merge.py:282/:394; the per-bead path at:854has nostaleterm.origin/mainat all βgit fetchappears nowhere in the lifecycle (work.py,work_merge.py,work_submission.py,work_group.py,worktree*); the one hit,worktree.py:823, isupstream/<base>forkind=externalhives.impl_check(work_submission.py:10-71) never resolves a base.General form (rule 5)
The next term in this file's own series rather than a free-standing aphorism: a gate's M is a property of a RUN, not a COMMAND β and an M is also a property of a MOMENT, never of the repo in perpetuity. An M about STATE decays; an M about MECHANISM does not. The label makes it worse, because M is the marker that says do not re-verify this.
Validation
Full suite on an isolated seat, read from the gate log body:
Per AC 7, this bead ran its own step-1 check immediately before gating β
1 0, base had not moved, so it did not gate on a stale base. Re-run after the base moved 6 commits:merge-treeclean, all asserted claims content-grepped and still true, nothing duplicated β so no rebase, which is the guidance demonstrating itself.π€ Generated with Claude Code
https://claude.ai/code/session_01GazEx6kCcyQuRvifWb3aBF