[Desktop] 环境信息面板无法显示私有仓库的拉取请求状态(未带 GitHub 鉴权)
Author: AAAclcCreated Sep 17, 2026Updated Sep 17, 2026
Summary
The desktop 环境信息 panel always shows 「无法获取拉取请求状态」 for private GitHub repositories, even when the user is logged into GitHub (gh) and has full repo access.
Environment
- App: Xiaomi MiMo Desktop (Electron)
- OS: Windows
- Remote:
[email protected]:AAAclc/2027RC.git(private) - Branch:
main(no open PRs; expected UI state would be “当前分支暂无拉取请求”) gh auth status: logged in as the repo owner, scopesrepo,read:org,workflow
Steps to reproduce
- Open a git workspace whose
originis a private GitHub repo. - Look at the right-side 环境信息 panel.
- Observe the PR row.
Expected
- If the current branch has a PR → show number/state.
- If not → show 「当前分支暂无拉取请求」.
- If auth is required → prompt for / reuse a GitHub token instead of a hard failure.
Actual
Always shows 「无法获取拉取请求状态」 (infoPanel.prUnavailable).
Root cause (from resources/app.asar)
The panel fetches PR status without any Authorization header:
const url = new URL(`https://api.github.com/repos/${owner}/${repo}/pulls`);
url.searchParams.set("state", "all");
url.searchParams.set("head", `${owner}:${branch}`);
url.searchParams.set("per_page", "10");
await fetch(url.href, {
headers: {
Accept: "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
"User-Agent": "MiMo-Desktop",
// no Authorization
},
signal: AbortSignal.timeout(8000),
});GitHub returns 404 for unauthenticated access to private-repo /pulls (same as “not found”). The client maps 401/404 → unauthorized → prUnavailable.
This is independent of:
- local
ghlogin - configured GitHub MCP
- whether the branch actually has PRs
Suggested fix
- Reuse an existing credential when available:
gh auth token/ keyring, orGH_TOKEN/GITHUB_TOKENenv, or- a Desktop Settings → GitHub token.
- Send
Authorization: Bearer <token>on the/pullsrequest. - Distinguish responses for better UX:
404with no token → “需要登录 GitHub 才能查看私有仓库 PR”200+ empty list → “当前分支暂无拉取请求”403/429→ rate-limit message
Workarounds today
- Query PRs in-session via
gh pr list/ GitHub MCP. - Make the repo public (not acceptable for private work).
Related observation: local MCP spawn previously failed with npx ENOENT/EINVAL on Windows when npx was not on PATH / was a .cmd. Using absolute node.exe + npx-cli.js fixed MCP startup; this does not fix the sidebar PR row, which does not use MCP.
Source: XiaomiMiMo/MiMo-Code