Fix: Add --repo flag to gh commands in issue optimizer - #637
Conversation
When the workflow checks out the Workflows repo, the working directory context changes. The gh CLI needs explicit --repo flag to target the consumer repo when posting comments or editing issues. Without this, gh CLI tries to operate on stranske/Workflows instead of the consumer repo, causing 'Resource not accessible by integration' errors.
Automated Status SummaryHead SHA: e26c227
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where the agents:optimize workflow was unable to interact with consumer repository issues after checking out the stranske/Workflows repository. The fix adds explicit --repo flags to all gh issue commands to ensure they target the correct repository.
Key Changes:
- Added
--repo "${{ github.repository }}"flag to allgh issue commentandgh issue editcommands - Introduced a
REPOenvironment variable in the label management step for consistency - Updated 9 command invocations across 4 workflow phases (analyze, dedup check, apply, format, and label management)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ | ||
| --remove-label "agents:optimize" || true | ||
| gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ | ||
| --remove-label "agents:apply-suggestions" | ||
| gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ | ||
| --add-label "agents:formatted" | ||
| echo "Labels updated: removed optimize/apply-suggestions, added formatted" | ||
| elif [[ "$PHASE" == "format" ]]; then | ||
| # Remove format trigger label and add formatted result label | ||
| gh issue edit "${ISSUE_NUMBER}" --remove-label "agents:format" | ||
| gh issue edit "${ISSUE_NUMBER}" --add-label "agents:formatted" | ||
| gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ | ||
| --remove-label "agents:format" | ||
| gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ | ||
| --add-label "agents:formatted" |
There was a problem hiding this comment.
Inconsistent quoting style for the --repo flag. Lines 141, 202, 260, and 300 use double quotes with GitHub Actions expression syntax "${{ github.repository }}", while lines 314-326 use double quotes with shell variable expansion "${REPO}". While both approaches work, it's better to use the same pattern throughout for consistency. Consider using "${{ github.repository }}" directly in all locations, or consistently use the environment variable approach everywhere.
🤖 Keepalive Loop StatusPR #637 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
Automated Status Summary
Scope
Address unmet acceptance criteria from PR #183.
Original scope:
Context for Agent
Related Issues/PRs
References
Tasks
Acceptance criteria
Head SHA: 0e12379
Latest Runs: ✅ success — Gate
Required: gate: ✅ success