claude-code - 💡(How to fix) Fix PR widget: GitHubPrManager drops --repo when session cwd is a non-git parent dir

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…

Error Message

2026-05-26 22:03:17 [error] [GitHubPrManager] Failed to get PR checks: gh pr checks timed out 2026-05-26 22:03:18 [error] [GitHubPrManager] Failed to get PR state for branch: gh pr view timed out

  • git init D:\Decklaration with a single origin silently returns the wrong PR for cross-repo numbers. Tested: PR #47 in 1-Now/One-Now-Backend is an unrelated "location error fixes" PR; PR #47 in 1-Now/One-Now-Frontend is "fix(website-builder): stop destructive empty-string writes on Logo & Favicon". With origin=Backend, gh pr view 47 would return the wrong PR and the widget would overwrite cached Frontend state with Backend data.

Root Cause

Note the repo=<none> even though the session JSON has prs[].repo populated. Because cwd=D:\Decklaration isn't a git repo, gh pr view 288 errors with fatal: not a git repository (or any of the parent directories): .git. In older builds the same call hung until the manager's 4-second timeout fired.

Fix Action

Fix / Workaround

Why workarounds don't work

Code Example

D:\Decklaration\           ← not a git repo
     ├─ One-Now-Backend\      ← origin = 1-Now/One-Now-Backend
     ├─ One-Now-Frontend\     ← origin = 1-Now/One-Now-Frontend
     └─ Template-1Now-FE\     ← origin = 1-Now/Template-1Now-FE

---

{
     "prNumber": 288,
     "url": "https://github.com/1-Now/One-Now-Backend/pull/288",
     "repo": "1-Now/One-Now-Backend",
     "branch": "fix-1now-1101-section-dedupe",
     "baseRef": "development",
     "state": "OPEN"
   }

---

2026-05-29 10:24:45 [info] LocalSessions.getPrChecks: cwd=D:\Decklaration, prNumber=288, repo=<none>
2026-05-29 10:24:45 [info] LocalSessions.getPrChecks: cwd=D:\Decklaration, prNumber=29, repo=<none>
2026-05-29 10:24:45 [info] LocalSessions.getPrChecks: cwd=D:\Decklaration, prNumber=93, repo=<none>
2026-05-26 22:03:17 [error] [GitHubPrManager] Failed to get PR checks: gh pr checks timed out
2026-05-26 22:03:18 [error] [GitHubPrManager] Failed to get PR state for branch: gh pr view timed out

---

> gh pr view 288 --json state,number
failed to run git: fatal: not a git repository (or any of the parent directories): .git
exit 1

> gh pr view 288 --repo 1-Now/One-Now-Backend --json state,number
{"number":288,"state":"OPEN"}
exit 0

---

for (const pr of session.prs) {
  await runGh(["pr", "view", String(pr.prNumber), "--repo", pr.repo, "--json", "state,..."]);
  await runGh(["pr", "checks", String(pr.prNumber), "--repo", pr.repo, "--json", "..."]);
}
RAW_BUFFERClick to expand / collapse

PR widget: gh pr view call drops --repo when session cwd is a non-git parent directory

Claude Code Desktop version: 1.8555.2.0 (also reproduced in 1.8089.1.0) OS: Windows 11 Pro 10.0.26200 gh version: verified working (gh pr view <num> --repo <owner>/<repo> succeeds from any cwd)

Symptom

Each session's PR widget shows: "Pull request status couldn't be checked and may be out of date." The cached PR state is still displayed, but no refresh succeeds.

Reproduction

  1. Have a parent folder that is not a git repo but contains multiple sibling git repos. Example layout:
    D:\Decklaration\           ← not a git repo
      ├─ One-Now-Backend\      ← origin = 1-Now/One-Now-Backend
      ├─ One-Now-Frontend\     ← origin = 1-Now/One-Now-Frontend
      └─ Template-1Now-FE\     ← origin = 1-Now/Template-1Now-FE
  2. Start a Claude Code Desktop session with cwd = D:\Decklaration.
  3. From inside that session, push branches and open PRs in any of the sibling repos. Claude Code Desktop correctly detects them and stores them in the session's prs[] array, e.g.:
    {
      "prNumber": 288,
      "url": "https://github.com/1-Now/One-Now-Backend/pull/288",
      "repo": "1-Now/One-Now-Backend",
      "branch": "fix-1now-1101-section-dedupe",
      "baseRef": "development",
      "state": "OPEN"
    }
  4. Wait for the periodic PR refresh. Every call fails.

Diagnosis

%APPDATA%\Claude\logs\main.log shows the manager invoking gh pr view/gh pr checks without --repo, even though each prs[] entry carries a repo field:

2026-05-29 10:24:45 [info] LocalSessions.getPrChecks: cwd=D:\Decklaration, prNumber=288, repo=<none>
2026-05-29 10:24:45 [info] LocalSessions.getPrChecks: cwd=D:\Decklaration, prNumber=29, repo=<none>
2026-05-29 10:24:45 [info] LocalSessions.getPrChecks: cwd=D:\Decklaration, prNumber=93, repo=<none>
2026-05-26 22:03:17 [error] [GitHubPrManager] Failed to get PR checks: gh pr checks timed out
2026-05-26 22:03:18 [error] [GitHubPrManager] Failed to get PR state for branch: gh pr view timed out

Note the repo=<none> even though the session JSON has prs[].repo populated. Because cwd=D:\Decklaration isn't a git repo, gh pr view 288 errors with fatal: not a git repository (or any of the parent directories): .git. In older builds the same call hung until the manager's 4-second timeout fired.

Verification

From the same cwd=D:\Decklaration:

> gh pr view 288 --json state,number
failed to run git: fatal: not a git repository (or any of the parent directories): .git
exit 1

> gh pr view 288 --repo 1-Now/One-Now-Backend --json state,number
{"number":288,"state":"OPEN"}
exit 0

The fix exists in the data; it just isn't being threaded through.

Why workarounds don't work

  • git init D:\Decklaration with a single origin silently returns the wrong PR for cross-repo numbers. Tested: PR #47 in 1-Now/One-Now-Backend is an unrelated "location error fixes" PR; PR #47 in 1-Now/One-Now-Frontend is "fix(website-builder): stop destructive empty-string writes on Logo & Favicon". With origin=Backend, gh pr view 47 would return the wrong PR and the widget would overwrite cached Frontend state with Backend data.
  • Clearing the cached prs[] removes the warning at the cost of losing the widget's value entirely.
  • A single session here legitimately tracks PRs across 3 repos, so there is no single correct origin to set on the parent dir.

Suggested fix

In GitHubPrManager's refresh path, when iterating session.prs[], pass the entry's repo field to gh as --repo <repo>. The corresponding top-level path (prNumber / prRepository) already has prRepository populated and should be threaded the same way.

Pseudocode:

for (const pr of session.prs) {
  await runGh(["pr", "view", String(pr.prNumber), "--repo", pr.repo, "--json", "state,..."]);
  await runGh(["pr", "checks", String(pr.prNumber), "--repo", pr.repo, "--json", "..."]);
}

This removes the dependency on cwd being a git repo of the right remote, and matches how every prs[] entry is already shaped.

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 PR widget: GitHubPrManager drops --repo when session cwd is a non-git parent dir