[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

  1. Work in a local git repository (Repository A)
  2. Discuss an issue from a different GitHub repository (Repository B issue #7738)
  3. Reference the issue by number only: "Issue #7738 exists..."
  4. 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:

  1. Not auto-link bare issue references without explicit repo context
  2. Require full owner/repo#number format for auto-linking
  3. Track conversation context to infer correct repository from discussion
  4. Display a disambiguation prompt when ambiguity is detected

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗