Skip to content

feat(rules): replace local find with git ls-tree on origin/main for ID-allocation discipline#3384

Merged
AceHack merged 3 commits into
mainfrom
feat/rule-id-alloc-git-ls-tree-otto-cli-2026-05-15
May 15, 2026
Merged

feat(rules): replace local find with git ls-tree on origin/main for ID-allocation discipline#3384
AceHack merged 3 commits into
mainfrom
feat/rule-id-alloc-git-ls-tree-otto-cli-2026-05-15

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 15, 2026

Summary

Updates the ID-allocation discipline in `.claude/rules/otto-channels-reference-card.md` to use `git fetch origin main` + `git ls-tree -r origin/main` instead of local `find docs/backlog`. Empirical anchor: tick 0742Z's "B-0528 free" misallocation that reached a public PR comment before Copilot caught it.

Root cause of the failure mode: when Otto-CLI's primary worktree is stuck on a stale HEAD (detached from an abandoned rebase, a feature branch behind main, etc.), local `find docs/backlog` returns stale state. The fix queries the remote ref directly so the answer is independent of local worktree state.

Test plan

  • `bun x markdownlint-cli2 .claude/rules/otto-channels-reference-card.md` → 0 violations
  • Empirical anchor (0742Z incident) cited
  • Composes with refresh-before-decide.md
  • CI required checks pass
  • Auto-merge fires

🤖 Generated with Claude Code

…D-allocation

Empirical anchor: tick 0742Z on 2026-05-15. Otto-CLI's primary worktree was stuck on
detached HEAD (65c7865) from an 8h-stale Lior rebase. The local `find docs/backlog`
returned B-0526 as the top, missing B-0527 + B-0528 already on origin/main. My
"B-0528 is free" advisory comment to Lior on PR #3323 was wrong as a result.
Caught by Copilot review on PR #3379.

The fix: use `git fetch origin main` + `git ls-tree -r origin/main` for the merged-state
check. This bypasses the local worktree's HEAD and reads actual merged state from the
remote ref. Local `find` is now explicitly called out as the wrong tool with the 0742Z
incident as the empirical anchor.

Composes with refresh-before-decide.md (the invariant) at the per-ID-allocation scope.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 15, 2026 08:10
@AceHack AceHack enabled auto-merge (squash) May 15, 2026 08:10
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a5e7eed34

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .claude/rules/otto-channels-reference-card.md Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Otto ID-allocation rule to prefer merged-state inspection from origin/main over stale local worktree scans.

Changes:

  • Replaces the local find docs/backlog example with a git fetch + git ls-tree pipeline.
  • Adds an empirical incident note explaining why local worktree state is unsafe for backlog ID allocation.
  • Keeps the in-flight PR check as the second required allocation surface.
Comments suppressed due to low confidence (1)

.claude/rules/otto-channels-reference-card.md:76

  • The trace path cited here does not exist in the tree (docs/hygiene-history/ticks/2026/05/15/0742Z.md is absent; this directory currently has 0710Z, 0717Z, and 0729Z but no 0742Z). This leaves the new empirical anchor unverifiable from the rule.
   See `docs/hygiene-history/ticks/2026/05/15/0742Z.md` for the trace.

Comment thread .claude/rules/otto-channels-reference-card.md Outdated
Comment thread .claude/rules/otto-channels-reference-card.md Outdated
…ical anchor

Codex P2 catch on PR #3384: my anchor cited docs/hygiene-history/ticks/2026/05/15/0742Z.md,
but that file doesn't exist on this branch (#3384's commit predates PR #3381 merge).
Chicken-and-egg between cross-PR file refs.

Fix: cite PRs #3381 + #3323 (durable on GitHub regardless of branch state) instead of
file path. The PR #3381 description contains the file content; readers can navigate
to the shard via the PR.

Co-Authored-By: Claude <noreply@anthropic.com>
AceHack added a commit that referenced this pull request May 15, 2026
…e update PR #3384 opened (#3385)

Co-authored-by: Claude <noreply@anthropic.com>
AceHack added a commit that referenced this pull request May 15, 2026
…aint discipline (#3387)

* shard(tick): 0813Z — PR #3384 Codex P2 fix (cross-PR file-ref chicken-and-egg); restraint discipline

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(shard): correct forward-predicted (PR #3386) → actual (PR #3387)

Forward-prediction failed: peer-Otto or other PR creation snagged #3386 between my
pipe-row write and gh pr create. Follow-up sed-fix to reflect actual PR number.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
…ion per Copilot

Two Copilot threads on PR #3384:

1. git fetch origin main only updates FETCH_HEAD; may leave refs/remotes/origin/main
   stale under some configs (refspec overrides, partial-clone). Switched to
    (no branch arg) which updates all configured refs reliably.

2. Name attribution 'Lior' in body prose violates the no-name-in-rule-body convention.
   Replaced with generic 'peer-agent' (preserves operational meaning; specific
   attribution lives in the linked tick shard).

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 15, 2026 08:24
@AceHack AceHack merged commit 4cb1137 into main May 15, 2026
23 checks passed
@AceHack AceHack deleted the feat/rule-id-alloc-git-ls-tree-otto-cli-2026-05-15 branch May 15, 2026 08:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d7c427b3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +66 to +68
git fetch origin
git ls-tree -r origin/main -- docs/backlog/ \
| awk '{print $4}' | grep -oE "B-[0-9]+" | sort -u -t- -k2 -n | tail -5
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Short-circuit ID lookup when fetch fails

The new origin/main check runs git ls-tree even if git fetch origin fails, because the commands are separate lines. In offline/auth-error cases this silently falls back to a stale origin/main, which recreates the exact stale-state ID collision this change is trying to prevent. Make the lookup conditional on a successful fetch (e.g., &&) or add an explicit failure guard before reading origin/main.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines +81 to +82
(which lands `docs/hygiene-history/ticks/2026/05/15/0742Z.md` carrying
the full trace), plus the correction comment on
Comment on lines +62 to +66
# `git fetch origin` (no branch arg) updates ALL configured remote-tracking
# refs reliably; the form `git fetch origin main` updates FETCH_HEAD but
# may not refresh refs/remotes/origin/main under all configs (refspec
# overrides, partial-clone, etc.).
git fetch origin
Comment on lines +62 to +65
# `git fetch origin` (no branch arg) updates ALL configured remote-tracking
# refs reliably; the form `git fetch origin main` updates FETCH_HEAD but
# may not refresh refs/remotes/origin/main under all configs (refspec
# overrides, partial-clone, etc.).
AceHack added a commit that referenced this pull request May 15, 2026
…chive active (#3388)

* shard(tick): 0820Z — PR #3385 merged; PR #3384 2-Copilot-thread fix; Lior archive automation observed active

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(shard): close (PR TBD) → (PR #3388) per post-PR-create discipline

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(shard): add explicit links for 'named attribution lives in linked tick shard' per Copilot P2

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants