Uh oh!
There was an error while loading. Please reload this page.
Base the worktree recipe on a fetched origin/main - #6449
Conversation
The documented worktree recipe branched off the local `main` ref, which nothing in the recipe or its surrounding prose fetches. A worktree created by following it literally starts as far back as whoever last happened to update that ref -- and on a long-lived shared checkout, nobody has a reason to. Measured on this repo's shared checkout at claim time: local `main` was 473 commits / 116.8 hours behind `origin/main`. `origin/main` alone would carry the same defect one layer down, since it too is a local ref only a fetch moves, so each in-scope site now begins with an explicit `git fetch origin main &&` and names `origin/main` as the base. Four sites repaired: `CLAUDE.md`, `AGENTS.md` §9, and the recipe both worktree guards print when they block an edit -- the copy an agent is most likely to run verbatim. The two `-cmp` comparison-tree lines take an explicit ref from the caller and are correct as written; they are unchanged. Net ±0 lines on every file touched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CZgmFFzqA9cX8tBMhvpFe
os-warren
commented
Aug 26, 2026
Reading note — the body's angle-bracket placeholders were eaten on writeGitHub's body sanitizer strips short
Restated with sanitizer-safe spellings — this is the shape now landed at all four in-scope sites (uppercase words stand in for the angle-bracket placeholders the files actually carry): ⛔ The body was not edited to repair this. The diff itself is unaffected — the sanitizer only rewrites the PR body, never the committed files. Verified at Reviewer: @os-zhuang. Generated by Claude Code Generated by Claude Code |
os-warren
commented
Aug 26, 2026
Correction to my own previous comment: its closing verification block was eaten by the same sanitizer it was describing, so it now shows the stripped form and appears to contradict the claim above it. Comments are not a safe channel for this either — only the uppercase substitutions in that comment's table survived. Stated without any angle brackets, so nothing can be stripped: line 16 of the committed ⭐ Review the diff, not any quotation of it in this thread. The Files-changed view is the authoritative rendering of what this PR does; every prose quotation of the recipe on this page is lossy by construction. Generated by Claude Code Generated by Claude Code |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#6208
Ports the repair landed upstream in objectstack#11934 (objectstack#11540), whose body notes this repo's copy was deliberately left to this card.
The defect
The documented worktree recipe branched off the local
mainref, which nothing in the recipe or its surrounding prose fetches. A worktree created by following it literally starts as far back as whoever last happened to update that ref — and on a long-lived shared checkout, nobody has a reason to.Drift re-measured on THIS repo, not relayed
Measured on this repo's live shared checkout (
/home/user/objectui) at claim time. The upstream card's numbers are its own snapshot of a different repo; these are this one's.main60d452ee0· 2026-08-21T03:27:52Zorigin/mainc8ea8af9c· 2026-08-26T00:13:35Zmainbehindorigin/mainThe second
rev-listis the positive control:0in the other direction, so this is a strict lag, not a divergence.It is not an abstract lag for this PR in particular. Across that same range:
Following the old recipe to fix the old recipe would have based this branch on a copy of
AGENTS.mdthat is 109 lines out of date.origin/mainalone would have the same defect one layer down — it is a local ref only a fetch moves — so each fixed site begins with an explicitgit fetch origin main &&. Measured here: that fetch movedorigin/main0 commits, because another agent had fetched ten minutes earlier. Luck, not a guarantee, which is the point.Sites enumerated and judged one by one
Enumerated independently (
git grep -n 'worktree add' origin/main, plus a widerworktreesweep across the repo) rather than inherited from the card:CLAUDE.md:16mainbase — the site the card namedAGENTS.md:234(§9 多 agent 协作纪律)mainbase, inside the fuller Chinese statement of the rule.claude/hooks/guard-main-checkout.sh:57mainbase. Not named by the card. This is the copy an agent is most likely to run verbatim, because it arrives at the exact moment the agent needs it.claude/hooks/guard-main-checkout-bash.sh:544CLAUDE.md:40-cmpcomparison-tree line takes an explicit<ref>from the caller — correct as writtenAGENTS.md:240.claude/hooks/guard-main-checkout-bash.selftest.sh:40git worktree add -q "$WT" -b selftest-wtinside a throwaway temp repo. Not a recipe anyone follows, and it has no shared checkout to be stale againstcontent/docs/guide/ci-cd-pipeline.md:1592scripts/pm/check-half-states.mjs:1494git worktree addtime"; not a recipeAfter the change,
grep -rn 'worktree add' --include='*.md' --include='*.sh' | grep -v origin/mainreturns exactly the three out sites and nothing else.What the upstream template did differently, and why
AGENTS.md:173,AGENTS.md:203,CLAUDE.md:33); one of them had no base ref at all, which this repo has no equivalent of. Its.claude/guards do not print the recipe in their block message, so it had no hook sites to judge. This repo's two guards do, so two sites are in here that had no counterpart upstream.scripts/pm/dispatch-gates.mjsto announce a stale tree. That file does not exist in this repo (scripts/pm/here holds onlycheck-half-states.mjs), so there is nothing to port; the recipe half is the whole of this card.AGENTS.md/CLAUDE.md— noCEILINGSmap covers them and no workflow measures their length. Checked rather than assumed. The repair was still spliced in place: net ±0 lines on all four files (CLAUDE.md51,AGENTS.md448,guard-main-checkout.sh64,guard-main-checkout-bash.sh561 — identical before and after).The shape now landed
Gates — all run at
3e77bb6c3, the final commitThe whole
scripts/__tests__tree, not a subject-matter subset:(That run prints a
check-vi-mock-specifiers: the population COLLAPSEDbanner on stderr. It is a deliberate fixture —scripts/__tests__/check-vi-mock-specifiers.test.ts:371asserts the gate emits exactly that text when fed an empty tree — not a failure.)Every gate family the changed paths (
AGENTS.md,CLAUDE.md,.claude/hooks/*.sh,.changeset/*.md) trigger, derived from this repo's ownpackage.jsonand.github/workflows/, quoting each gate's own verdict line:Both hook self-tests are re-run because
.claude/hooks/*.shchanged;.github/workflows/hook-selftests.ymlruns them in CI. Noteguard-main-checkout.shhas no self-test of its own — its edited line is a message string, unpinned by any gate here.Changeset added with empty frontmatter (
.changeset/6208-worktree-recipe-fetch-base.md): instruction-file and hook prose only, no published package'ssrc/changed, so nothing ships. This repo has noskip-changesetlabel; the empty-frontmatter changeset is how that is declared here.Governance
⛔ Governed surface (
CLAUDE.md,AGENTS.md,.claude/**). This PR stays draft — not flipped ready, not armed, not queued.update_pull_requestwas deliberately not called: that endpoint sendsdraft: falsealongside a reviewers-only update and published a governed-surface draft into the merge queue earlier today (PR #6183, recorded as objectstack#12200 and decision card #6325). No reviewer was requested through the API for the same reason.Review requested from @os-zhuang by mention — a mention notifies without touching draft state. The hand-merge is the review record.
One declared deviation
The dispatch order said to create the worktree with the recipe as written (
… -b <branch> main). It was created off a freshly fetchedorigin/maininstead, and this is flagged rather than done quietly: the measurement above put localmain473 commits behind withAGENTS.mditself 109 lines out of date, so following the defective recipe would have written this repair on top of a stale copy of the very file it repairs. Base commit:c8ea8af9c, which isorigin/mainat claim time.Generated by Claude Code
Generated by Claude Code