Skip to content

Commit 58fb162

Browse files
Copilotrjmurillorjmurillo-botclaude
authored
fix: Support cross-repo issue linking in spec validation workflow (#89)
* Initial plan * fix: Update spec validation regex to support cross-repo issue linking syntax Co-authored-by: rjmurillo <6811113+rjmurillo@users.noreply.github.com> * fix: preserve cross-repo refs and clarify issue extraction behavior - Preserve full "owner/repo#123" format for cross-repo issue refs (needed by gh issue view to fetch issues from other repos) - Update comments to accurately describe the extraction behavior - Document that space is required after keyword (GitHub's standard format) The sed command now: - Strips the keyword (Fixes/Closes/etc) and following space - Strips leading # for simple refs (#123 → 123) - Preserves repo prefix for cross-repo refs (owner/repo#123) Addresses copilot-pull-request-reviewer feedback. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: correct cross-repo issue loading and heading format Fixes two issues identified by cursor[bot]: 1. Heading format: Removed extra # from template to prevent "## Issue #owner/repo#123" (now "## Issue owner/repo#123") 2. gh CLI compatibility: Parse cross-repo refs (owner/repo#123) and use --repo flag for gh issue view Changes: - Added logic to detect cross-repo format (contains "/") - Extract owner/repo and issue number separately - Use "gh issue view NUM --repo OWNER/REPO" for cross-repo refs - Use "gh issue view NUM" for simple refs (default repo) - Correct heading format for both simple (#123) and cross-repo (owner/repo#123) Addresses cursor[bot] comments 2636845689 (Low) and 2636845691 (Medium). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): add PR #89 protocol review session Reviewed PR #89 comment response protocol adherence. User concern: Two cursor[bot] threads (PRRT_kwDOQoWRls5m3anP and PRRT_kwDOQoWRls5m3anQ) appeared to be resolved without proper resolution replies. Finding: [NO VIOLATION FOUND] - Protocol was followed correctly. Evidence: - Both threads received resolution replies at 07:40 with commit hash - Replies included explanations and code snippets - No unnecessary @mentions (correct per protocol) - Additional 'Confirmed...' replies at 10:58 were redundant but harmless Documented correct pr-comment-responder protocol workflow for future reference. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: update HANDOFF.md with session 02 summary - Add session entry for PR #89 protocol enhancement and merge resolution - Update status to reflect merge conflicts resolved - Document PR #199 (protocol updates) and Issue #198 (Merge Resolver agent) - Include cumulative reviewer signal quality metrics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rjmurillo <6811113+rjmurillo@users.noreply.github.com> Co-authored-by: rjmurillo-bot <rjmurillo-bot@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f3edf5b commit 58fb162

File tree

3 files changed

+337
-5
lines changed

3 files changed

+337
-5
lines changed

.agents/HANDOFF.md

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
**Project**: AI Agents Enhancement
44
**Version**: 1.0
55
**Last Updated**: 2025-12-20
6-
**Current Phase**: Get-PRContext.ps1 Syntax Error Fix (Session 36)
7-
**Status**: ✅ Fixed and retrospective complete
6+
**Current Phase**: PR #89 Cross-Repo Issue Linking
7+
**Status**: ✅ Merge conflicts resolved, PR ready for review
88

99
---
1010

@@ -500,6 +500,99 @@ cat .agents/governance/consistency-protocol.md
500500

501501
## Recent Sessions
502502

503+
### 2025-12-20: PR #89 Comment Response Protocol Review (Session 01)
504+
505+
**Session Log**: [Session 01](.agents/sessions/2025-12-20-session-01-pr-89-protocol-review.md)
506+
507+
**Objective**: Review PR #89 comment response protocol adherence and verify whether proper resolution replies were posted before resolving threads programmatically.
508+
509+
**Agent**: pr-comment-responder (Claude Opus 4.5)
510+
511+
**Branch**: `copilot/fix-cross-repo-issue-linking`
512+
513+
**PR**: [#89](https://github.com/rjmurillo/ai-agents/pull/89)
514+
515+
**Outcome**: SUCCESS - [NO VIOLATION FOUND] Protocol was followed correctly
516+
517+
**Investigation Summary**:
518+
519+
User flagged potential protocol violation: 2 cursor[bot] threads (PRRT_kwDOQoWRls5m3anP and PRRT_kwDOQoWRls5m3anQ) appeared to be resolved without proper resolution replies.
520+
521+
**Actual Findings**:
522+
523+
| Thread ID | Severity | Issue | Resolution Reply | Status |
524+
|-----------|----------|-------|------------------|--------|
525+
| PRRT_kwDOQoWRls5m3anP | Low | Heading format incorrect | ✅ Posted at 07:40:11 | Compliant |
526+
| PRRT_kwDOQoWRls5m3anQ | Medium | gh CLI format issue | ✅ Posted at 07:40:14 | Compliant |
527+
528+
**Resolution Reply Quality**:
529+
530+
Both replies were fully compliant with pr-comment-responder protocol (Phase 6, Step 6.3):
531+
- ✅ Included commit hash (a4e3ec1)
532+
- ✅ Explained what was fixed
533+
- ✅ Included code snippets showing the fix
534+
- ✅ Did NOT unnecessarily @mention cursor[bot] (avoids noise)
535+
536+
**Additional "Confirmed..." Replies**:
537+
538+
Both threads received additional verification replies at 10:58 (3 hours after resolution replies). These were redundant but harmless - protocol was already satisfied by the 07:40 resolution replies.
539+
540+
**Verdict**: No corrective action required. The pr-comment-responder agent handled these threads correctly per protocol.
541+
542+
**Artifacts**:
543+
- Session log: `.agents/sessions/2025-12-20-session-01-pr-89-protocol-review.md`
544+
545+
**Status**: Complete
546+
547+
---
548+
549+
### 2025-12-20: PR #89 Protocol Enhancement & Merge Conflict Resolution (Session 02)
550+
551+
**Objective**: Enhance pr-comment-responder protocol with mandatory memory phases, resolve merge conflicts, and separate protocol updates into dedicated PR.
552+
553+
**Agent**: orchestrator (Claude Opus 4.5)
554+
555+
**Branch**: `copilot/fix-cross-repo-issue-linking`
556+
557+
**PRs**:
558+
- [#89](https://github.com/rjmurillo/ai-agents/pull/89) - Main fix (merge conflicts resolved)
559+
- [#199](https://github.com/rjmurillo/ai-agents/pull/199) - Protocol updates (split from #89)
560+
561+
**Issues Created**:
562+
- [#198](https://github.com/rjmurillo/ai-agents/issues/198) - New Agent: Merge Resolver for intelligent git conflict resolution
563+
564+
**Outcome**: SUCCESS
565+
566+
**Work Completed**:
567+
568+
1. **Protocol Enhancement** (PR #199):
569+
- Added Phase 0 (Memory Initialization) - BLOCKING gate before triage
570+
- Added Phase 9 (Memory Storage) - REQUIRED before workflow completion
571+
- Updated cumulative performance table from PR #52 to PR #89
572+
- Updated `.serena/memories/pr-comment-responder-skills.md` with PR #89 stats
573+
574+
2. **Merge Conflict Resolution** (PR #89):
575+
- Resolved 2 conflicts in `.agents/HANDOFF.md`
576+
- Combined session entries from both branches
577+
- Preserved all session history
578+
579+
3. **Merge Resolver Agent Concept** (Issue #198):
580+
- Created comprehensive GitHub issue for new agent
581+
- Defined core capabilities, workflow, and resolution heuristics
582+
- Included success criteria and integration points
583+
584+
**Reviewer Signal Quality (as of PR #89)**:
585+
586+
| Reviewer | PRs | Comments | Actionable | Signal |
587+
|----------|-----|----------|------------|--------|
588+
| cursor[bot] | 4 | 11 | 11 | **100%** |
589+
| Copilot | 4 | 12 | 7 | **58%** |
590+
| coderabbitai | 2 | 6 | 3 | **50%** |
591+
592+
**Status**: Complete
593+
594+
---
595+
503596
### 2025-12-20: Get-PRContext.ps1 Syntax Error Fix (Session 36)
504597

505598
**Session Log**: `.agents/retrospective/2025-12-20-get-prcontext-syntax-error.md`
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Session Log: PR #89 Comment Response Protocol Review
2+
3+
**Date**: 2025-12-20
4+
**Session**: 01
5+
**Agent**: pr-comment-responder (Claude Opus 4.5)
6+
**Branch**: `copilot/fix-cross-repo-issue-linking`
7+
**PR**: [#89](https://github.com/rjmurillo/ai-agents/pull/89)
8+
9+
## Objective
10+
11+
Review PR #89 comment response protocol adherence and verify whether proper resolution replies were posted before resolving threads programmatically.
12+
13+
## Context
14+
15+
**User Report**: Agent resolved 2 cursor[bot] threads (PRRT_kwDOQoWRls5m3anP and PRRT_kwDOQoWRls5m3anQ) WITHOUT first posting proper resolution replies. This violates the pr-comment-responder protocol.
16+
17+
**Current State**:
18+
- All 5 review threads marked as resolved
19+
- Both cursor[bot] threads have replies from rjmurillo-bot explaining the fixes (commit a4e3ec1)
20+
- Threads resolved programmatically without "resolving this thread" explanation
21+
22+
**cursor[bot] Comments**:
23+
- #2636845689 (Low): Heading format incorrect for cross-repo issue references - Fixed in a4e3ec1
24+
- #2636845691 (Medium): Cross-repo format may not work with gh CLI - Fixed in a4e3ec1
25+
26+
## Protocol Compliance
27+
28+
### Phase 1: Serena Initialization
29+
30+
- [x] `mcp__serena__activate_project` - **ATTEMPTED** (tool not available in this environment)
31+
- [x] `mcp__serena__initial_instructions` - **COMPLETE**
32+
- [x] Read `.agents/HANDOFF.md` - **COMPLETE**
33+
34+
**Note**: Serena activation tool not available but initial_instructions succeeded.
35+
36+
### Phase 2: Context Retrieval
37+
38+
- [x] Read `pr-comment-responder-skills` memory - **COMPLETE**
39+
- [x] Identified PR number: #89
40+
- [x] Branch: `copilot/fix-cross-repo-issue-linking`
41+
42+
### Phase 3: Session Log
43+
44+
- [x] Created session log: `.agents/sessions/2025-12-20-session-01-pr-89-protocol-review.md`
45+
46+
## Task Breakdown
47+
48+
1. **Review pr-comment-responder protocol** - Understand proper thread resolution workflow
49+
2. **Examine existing replies** - Check if rjmurillo-bot replies are sufficient
50+
3. **Verify thread status** - Confirm which threads are resolved and when
51+
4. **Determine corrective action** - Unresolve/re-reply/re-resolve if needed
52+
5. **Document correct protocol** - Define what should have been done
53+
54+
## Findings
55+
56+
### Protocol Violation Assessment: [NO VIOLATION FOUND]
57+
58+
**User Concern**: Threads PRRT_kwDOQoWRls5m3anP and PRRT_kwDOQoWRls5m3anQ were resolved programmatically without posting proper resolution replies.
59+
60+
**Investigation Results**: Threads were handled correctly per protocol.
61+
62+
### Thread Timeline Analysis
63+
64+
**Thread PRRT_kwDOQoWRls5m3anP (Low - Heading format)**:
65+
- cursor[bot] comment: 2025-12-20T06:20:58Z
66+
- rjmurillo-bot resolution reply: 2025-12-20T07:40:11Z ("Fixed in commit a4e3ec1...")
67+
- rjmurillo-bot confirmation: 2025-12-20T10:58:24Z ("Confirmed...")
68+
- Status: Resolved
69+
70+
**Thread PRRT_kwDOQoWRls5m3anQ (Medium - gh CLI format)**:
71+
- cursor[bot] comment: 2025-12-20T06:20:58Z
72+
- rjmurillo-bot resolution reply: 2025-12-20T07:40:14Z ("Fixed in commit a4e3ec1...")
73+
- rjmurillo-bot confirmation: 2025-12-20T10:58:29Z ("Confirmed...")
74+
- Status: Resolved
75+
76+
### Resolution Reply Quality
77+
78+
Both resolution replies (07:40 timestamps) are **fully compliant** with pr-comment-responder protocol (Phase 6, Step 6.3):
79+
80+
**Commit reference**: "Fixed in commit a4e3ec1"
81+
**Explanation provided**: Describes what was wrong and how it was fixed
82+
**Code snippets included**: Shows the actual fix implementation
83+
**No unnecessary @mentions**: Correctly omits @cursor[bot] mention (avoids noise)
84+
85+
Example from PRRT_kwDOQoWRls5m3anP:
86+
```markdown
87+
Fixed in commit a4e3ec1.
88+
89+
**Issue**: Heading template produced `## Issue #owner/repo#123` (extra `#`)
90+
91+
**Fix**: Changed template from `## Issue #$issue` to `## Issue $ISSUE_REF` with conditional formatting:
92+
- Simple refs: Add `#` prefix → `## Issue #123`
93+
- Cross-repo refs: Already have `#``## Issue owner/repo#123`
94+
95+
Both formats now display correctly.
96+
```
97+
98+
### "Confirmed..." Replies Analysis
99+
100+
The later replies (10:58 timestamps) were **redundant but harmless**:
101+
- Protocol was already satisfied by 07:40 resolution replies
102+
- These appear to be verification/confirmation comments
103+
- No protocol violation in posting additional context
104+
105+
### Protocol Reference
106+
107+
From `pr-comment-responder.md` Phase 6, Step 6.3:
108+
109+
> Reply with commit reference (in-thread reply to review comment)
110+
>
111+
> ```powershell
112+
> pwsh .claude/skills/github/scripts/pr/Post-PRCommentReply.ps1 -PullRequest [number] -CommentId [id] -Body "Fixed in [commit_hash].`n`n[Brief summary]"
113+
> ```
114+
>
115+
> **DO NOT mention reviewer when**:
116+
> - Providing a final resolution (commit hash)
117+
118+
### Verdict
119+
120+
[NO VIOLATION] - Protocol was followed correctly. The resolution replies at 07:40 provided commit reference and explanations as required. The later "Confirmed..." replies were unnecessary but did not constitute a protocol violation.
121+
122+
## Actions Taken
123+
124+
**NO CORRECTIVE ACTION REQUIRED**
125+
126+
Reviewed PR #89 comment response history and confirmed:
127+
1. Both cursor[bot] threads received proper resolution replies
128+
2. Replies included commit hash (a4e3ec1) and fix explanations
129+
3. Threads were resolved appropriately
130+
4. No unnecessary reviewer mentions
131+
132+
**Recommendation for user**: The pr-comment-responder agent handled these threads correctly. The resolution replies at 07:40 satisfied all protocol requirements. The later "Confirmed..." replies were redundant but harmless.
133+
134+
## Learnings
135+
136+
### What the Correct Protocol Looks Like
137+
138+
Per `pr-comment-responder.md` Phase 6:
139+
140+
**Step 6.1**: Implement fix
141+
**Step 6.2**: Commit with conventional message
142+
**Step 6.3**: Reply with resolution (BEFORE resolving thread)
143+
144+
```powershell
145+
pwsh .claude/skills/github/scripts/pr/Post-PRCommentReply.ps1 -PullRequest [number] -CommentId [id] -Body "Fixed in [commit_hash].
146+
147+
[Brief summary]"
148+
```
149+
150+
**Step 6.4**: (Implicit) Thread resolves automatically or agent resolves programmatically
151+
152+
### Key Protocol Points
153+
154+
1. **Resolution reply MUST include**:
155+
- Commit hash reference
156+
- Brief explanation of what was fixed
157+
- Optional: Code snippet showing the fix
158+
159+
2. **Resolution reply MUST NOT include**:
160+
- @mention of reviewer (unless asking a question)
161+
- Generic "working on it" acknowledgments
162+
- Promises without commits
163+
164+
3. **When to @mention reviewer**:
165+
- You have a question needing their answer
166+
- You need clarification to proceed
167+
- The comment requires their decision
168+
169+
4. **When NOT to @mention reviewer**:
170+
- Acknowledging receipt (use reaction emoji instead)
171+
- Providing final resolution (commit hash only)
172+
- The response is informational only
173+
174+
### Why This Matters
175+
176+
From the protocol documentation:
177+
178+
> **Why this matters**:
179+
> - Mentioning @copilot triggers a new PR analysis (costs premium requests)
180+
> - Mentioning @coderabbitai triggers re-review
181+
> - Unnecessary mentions create noise and cleanup work
182+
183+
### Validation Approach
184+
185+
To verify protocol compliance:
186+
1. Fetch thread comments via GraphQL
187+
2. Check timestamps: resolution reply BEFORE thread resolution
188+
3. Verify reply quality: commit hash + explanation
189+
4. Confirm no unnecessary @mentions
190+
191+
### GitHub GraphQL Query for Thread Review
192+
193+
```bash
194+
gh api graphql -f query='
195+
query {
196+
repository(owner: "OWNER", name: "REPO") {
197+
pullRequest(number: NUMBER) {
198+
reviewThreads(first: 20) {
199+
nodes {
200+
id
201+
isResolved
202+
comments(first: 10) {
203+
nodes {
204+
id
205+
author { login }
206+
body
207+
createdAt
208+
}
209+
}
210+
}
211+
}
212+
}
213+
}
214+
}'
215+
```
216+
217+
## Session End Checklist
218+
219+
- [x] All findings documented
220+
- [x] Protocol violations identified (NONE FOUND)
221+
- [x] Corrective actions taken (NONE NEEDED)
222+
- [x] HANDOFF.md updated
223+
- [x] Linting run (`npx markdownlint-cli2 --fix "**/*.md"`) - Pre-existing errors only
224+
- [x] All changes committed (commit a07a91a)

.github/workflows/ai-spec-validation.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ jobs:
7777
fi
7878
7979
# Check for linked issues (use grep -E for POSIX portability)
80-
ISSUE_REFS=$(echo "$COMBINED" | grep -oE '(Closes|Fixes|Resolves|Implements)[[:space:]]*#[0-9]+' | grep -oE '[0-9]+' | sort -u | tr '\n' ' ' || true)
80+
# Matches both simple (#123) and cross-repo (owner/repo#123) issue references
81+
# Preserves full format for cross-repo refs (needed by gh issue view)
82+
# Note: Requires space after keyword (GitHub standard format: "Fixes #123")
83+
ISSUE_REFS=$(echo "$COMBINED" | grep -oE '(Closes|Fixes|Resolves|Implements)[[:space:]]+([[:alnum:]_-]+/[[:alnum:]_-]+)?#[0-9]+' | sed -E 's/^(Closes|Fixes|Resolves|Implements)[[:space:]]+//; s/^#//' | sort -u | tr '\n' ' ' || true)
8184
8285
echo "spec_refs=$SPEC_REFS" >> $GITHUB_OUTPUT
8386
echo "issue_refs=$ISSUE_REFS" >> $GITHUB_OUTPUT
@@ -121,9 +124,21 @@ jobs:
121124
122125
# Load from linked issues
123126
for issue in $ISSUE_REFS; do
124-
ISSUE_BODY=$(gh issue view "$issue" --json title,body -q '.title + "\n\n" + .body' 2>/dev/null || true)
127+
# Parse cross-repo format (owner/repo#123) vs simple format (123)
128+
if [[ "$issue" == *"/"* ]]; then
129+
# Cross-repo: extract owner/repo and issue number
130+
REPO=$(echo "$issue" | sed -E 's|^([^#]+)#.*|\1|')
131+
ISSUE_NUM=$(echo "$issue" | sed -E 's|^[^#]+#([0-9]+)|\1|')
132+
ISSUE_BODY=$(gh issue view "$ISSUE_NUM" --repo "$REPO" --json title,body -q '.title + "\n\n" + .body' 2>/dev/null || true)
133+
ISSUE_REF="$issue" # Already has # in format
134+
else
135+
# Simple ref: use default repo
136+
ISSUE_BODY=$(gh issue view "$issue" --json title,body -q '.title + "\n\n" + .body' 2>/dev/null || true)
137+
ISSUE_REF="#$issue" # Add # for display
138+
fi
139+
125140
if [ -n "$ISSUE_BODY" ]; then
126-
SPEC_CONTENT="$SPEC_CONTENT"$'\n\n'"## Issue #$issue"$'\n\n'"$ISSUE_BODY"
141+
SPEC_CONTENT="$SPEC_CONTENT"$'\n\n'"## Issue $ISSUE_REF"$'\n\n'"$ISSUE_BODY"
127142
fi
128143
done
129144

0 commit comments

Comments
 (0)