From 2f9e1512beb63af07ab9c0a32c7e7214cf588cef Mon Sep 17 00:00:00 2001 From: Self-Managing Codebase Manager <7004983+WillTaylor22@users.noreply.github.com> Date: Tue, 26 May 2026 09:58:07 +0000 Subject: [PATCH] memory: check open PRs before picking up a Linear ticket MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #15 and PR #16 were opened in parallel for ENG-26 today by two different sessions (sesn_01GwXk... and sesn_01UTKG...). #15 merged first; #16 had to be closed as redundant. Mitigation: list open PRs and grep for the ticket ID before branching. One extra MCP call, prevents the race. Standalone memory PR — no Linear ticket (this isn't bug work, it's a convention surfaced during the operational loop). --- .claude/memory/MEMORY.md | 1 + .claude/memory/conventions/check-open-pr-before-ticket-pickup.md | 1 + 2 files changed, 2 insertions(+) create mode 100644 .claude/memory/conventions/check-open-pr-before-ticket-pickup.md diff --git a/.claude/memory/MEMORY.md b/.claude/memory/MEMORY.md index 1f8b851..9f678d0 100644 --- a/.claude/memory/MEMORY.md +++ b/.claude/memory/MEMORY.md @@ -16,3 +16,4 @@ Keep this file under 200 lines — anything longer is content bloat, not memory. ## Conventions - [conventions/pr-session-id-marker](conventions/pr-session-id-marker.md) — PR body MUST end with `` (or legacy `sthr_...`) so webhooks can resume - [conventions/agent-review-marker](conventions/agent-review-marker.md) — Reviewer's verdict goes on the first line as `AGENT_REVIEW: APPROVED|REQUEST_CHANGES|ESCALATE — ` +- [conventions/check-open-pr-before-ticket-pickup](conventions/check-open-pr-before-ticket-pickup.md) — Before branching for a Linear ticket, grep open PRs for the ticket ID; abort if one already exists (PR #15 vs #16 ENG-26 race) diff --git a/.claude/memory/conventions/check-open-pr-before-ticket-pickup.md b/.claude/memory/conventions/check-open-pr-before-ticket-pickup.md new file mode 100644 index 0000000..25d62a3 --- /dev/null +++ b/.claude/memory/conventions/check-open-pr-before-ticket-pickup.md @@ -0,0 +1 @@ +Before branching for a Linear ticket picked from Triage/Todo, list open PRs and grep for the ticket ID in titles AND bodies. If a PR already exists for the ticket, do NOT open a parallel one — either continue the existing branch (if it's yours) or skip the ticket and let the other session ship it. ENG-26 was opened by two sessions in parallel today (PRs #15 and #16, branches `claude/eng-26-webhook-sesn-regex-sesn_01GwXk...` and `...sesn_01UTKG...`); #15 merged first and #16 had to be closed as redundant. The race is real because Linear's In-Progress transition isn't atomic across sessions that pick up at the same wall-clock tick. The cheap mitigation is one extra `list_pull_requests` + grep before `git checkout -b`.