[BUG] autolinking of github PRs wrong for nested repos

Resolved 💬 3 comments Opened Feb 23, 2026 by banagale Closed Feb 25, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

PR numbers are autolinked to the parent repo.When working in a project with nested git repos (e.g., a parent repo at ~/projects/parent/ containing a subrepo at ~/projects/parent/repos/nested-repo/), Claude Code auto-links #NNNN references to the parent repo's GitHub remote. So #123 links to the parent repo's issues instead of the nested repo's PR, even when the conversation is entirely about PRs in the nested repo.

What Should Happen?

Either:

  • Detect which repo the #NNNN reference relates to based on conversation context (e.g., if gh pr view 123 --repo org/nested-repo was just run, link there)
  • Let users configure which repo # references resolve to (e.g., in .claude/settings.json or CLAUDE.md)
  • At minimum, prefer the git remote of the deepest nested repo relative to the working directory, not the outermost parent

Error Messages/Logs

Steps to Reproduce

  1. Create a parent git repo with its own GitHub remote
  2. Clone a different GitHub repo inside it (e.g., repos/other-org/other-repo/)
  3. Start a Claude Code session in the parent repo
  4. Work on a PR in the nested repo (e.g., run gh pr view 123 --repo other-org/other-repo)
  5. Reference the PR as #123 in conversation
  6. Observe that Claude Code auto-links #123 to the parent repo instead of the nested repo

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.50

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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