claude-code - 💡(How to fix) Fix Model fills in anthropics as owner for `owner/repo#N` references instead of resolving the current repo [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45058Fetched 2026-04-09 08:14:17
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2renamed ×1

When following the system-prompt instruction to format GitHub references as owner/repo#123 (introduced for the v2.1.84 linkification change, see #39114), the model frequently emits a guessed owner instead of resolving the actual owner of the current repo. The result is broken / non-clickable links.

This is distinct from the compaction-related context-loss bugs (e.g. #15169 → #10960, #14968, #13678): no compaction is required to reproduce.

Root Cause

Root cause (hypothesis)

RAW_BUFFERClick to expand / collapse

Summary

When following the system-prompt instruction to format GitHub references as owner/repo#123 (introduced for the v2.1.84 linkification change, see #39114), the model frequently emits a guessed owner instead of resolving the actual owner of the current repo. The result is broken / non-clickable links.

This is distinct from the compaction-related context-loss bugs (e.g. #15169 → #10960, #14968, #13678): no compaction is required to reproduce.

Reproduction

  1. Open Claude Code in any repository whose owner is not anthropics.
  2. Fresh session, no compaction.
  3. Ask: "what are open PRs".
  4. The model lists PRs and may format them as anthropics/<repo>#<N> (or another guessed owner) instead of <actual-owner>/<repo>#<N>.

In my session the repo was owned by a non-anthropics org and the model emitted anthropics/<repo>#<N> for every PR.

Root cause (hypothesis)

The instruction tells the model what format to use but does not require it to resolve the owner first. The example in the instruction text uses a real owner (anthropics/claude-code#100), which may further anchor the guess — but the underlying issue is the missing verification step, not the example itself.

Suggested fix

Any of:

  1. Add an explicit verification step to the instruction, e.g. "Before formatting a GitHub reference, resolve the current repo owner via gh repo view --json nameWithOwner or the git remote."
  2. Have the harness resolve nameWithOwner once at session start and surface it in the environment block, so the model has it without a tool call.
  3. Change the example to a neutral placeholder (owner/repo#123) to remove any anchoring effect.

(1) or (2) addresses the root cause; (3) is cosmetic and only helps if the anchoring hypothesis is real.

Environment

  • Claude Code (Opus 4.6)
  • Fresh session, no compaction
  • Repo owner != anthropics

🤖 90% Claude

extent analysis

TL;DR

To fix the issue of the model emitting a guessed owner instead of the actual owner for GitHub references, add an explicit verification step to the instruction to resolve the current repo owner.

Guidance

  • Verify that the issue is not related to compaction by checking if the problem persists in a fresh session with no compaction.
  • Consider implementing one of the suggested fixes: adding an explicit verification step to the instruction, resolving the repo owner at session start, or changing the example to a neutral placeholder.
  • Test the fix by asking the model to list open PRs and checking if the links are correctly formatted with the actual owner.
  • If the anchoring hypothesis is correct, changing the example to a neutral placeholder may also help mitigate the issue.

Example

No code snippet is provided as the issue does not require a specific code change, but rather a modification to the instruction or environment.

Notes

The suggested fixes assume that the issue is due to the model not resolving the actual owner of the current repo. If the issue persists after implementing these fixes, further investigation may be needed to determine the root cause.

Recommendation

Apply workaround by adding an explicit verification step to the instruction, as this addresses the root cause of the issue and is a more comprehensive solution than changing the example to a neutral placeholder.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Model fills in anthropics as owner for `owner/repo#N` references instead of resolving the current repo [1 participants]