[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
#NNNNreference relates to based on conversation context (e.g., ifgh pr view 123 --repo org/nested-repowas just run, link there) - Let users configure which repo
#references resolve to (e.g., in.claude/settings.jsonorCLAUDE.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
- Create a parent git repo with its own GitHub remote
- Clone a different GitHub repo inside it (e.g.,
repos/other-org/other-repo/) - Start a Claude Code session in the parent repo
- Work on a PR in the nested repo (e.g., run
gh pr view 123 --repo other-org/other-repo) - Reference the PR as
#123in conversation - Observe that Claude Code auto-links
#123to 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_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗