[BUG] gh CLI repo context defaults to local repo instead of -R flag
Resolved 💬 2 comments Opened Mar 6, 2026 by tn819 Closed Mar 9, 2026
Problem
Claude Code auto-links GitHub issue references (e.g., #7738) based on the current working directory's git repository context, rather than the semantic context of the conversation. This causes issue links to resolve to the wrong repository.
Reproduction
- Work in a local git repository (Repository A)
- Discuss an issue from a different GitHub repository (Repository B issue #7738)
- Reference the issue by number only: "Issue #7738 exists..."
- Click the auto-linked #7738 reference
Expected behavior: Link resolves to Repository B's issue #7738
Actual behavior: Link resolves to active directory Repository A's issue #7738 (wrong repo)
Root Cause
Claude Code's auto-linking logic uses the current working directory's git remote to determine which repository to link to, ignoring the actual context of the conversation or the repository being discussed.
Impact
- Users are taken to incorrect issue pages
- Misleading links in conversation history
- Confusing user experience when working across multiple repositories
- Risk of users filing duplicate issues or missing important context
Solution
Claude Code should either:
- Not auto-link bare issue references without explicit repo context
- Require full
owner/repo#numberformat for auto-linking - Track conversation context to infer correct repository from discussion
- Display a disambiguation prompt when ambiguity is detected
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗