Fix pull requests silently disappearing until lazygit is restarted - #5921
Merged
Conversation
go-gh reads gh's config file once per process and answers from that snapshot for the rest of the process's life. gh rewrites the file whenever the active account changes, and stores the active account's token either in it or in the system keyring, depending on the account. A lazygit that has been running for a while therefore consults a snapshot that no longer describes reality: it either keeps using a token for an account that is no longer active, or, when the snapshot was taken while a keyring-backed account was active, finds no token at all and silently stops showing pull requests until it is restarted. Asking gh resolves the token afresh on every refresh, from whichever of the environment, the keyring or the config file currently holds it. go-gh's lookup stays behind as a fallback for setups without the gh binary, where it still picks up GH_TOKEN and friends. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Aug 13, 2026
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | patch | `v0.64.0` → `v0.64.1` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary> ### [`v0.64.1`](https://github.com/jesseduffield/lazygit/releases/tag/v0.64.1) [Compare Source](jesseduffield/lazygit@v0.64.0...v0.64.1) <!-- Release notes generated using configuration in .github/release.yml at v0.64.1 --> #### What's Changed This fixes a few regressions that were introduced in the [last release](https://github.com/jesseduffield/lazygit/releases#release-v0.64.0), and some long-standing bugs that I didn't see any reason to hold back until the next big one. ##### Fixes 🔧 - Fix transitions of entering and exiting filtering mode (e.g. by path or author) by [@​stefanhaller](https://github.com/stefanhaller) in [#​5897](jesseduffield/lazygit#5897) - Fix race in "Stash staged changes" on git versions before 2.35.0 by [@​stefanhaller](https://github.com/stefanhaller) in [#​5903](jesseduffield/lazygit#5903) - Fix several problems with repos whose git dir lives outside the working tree by [@​stefanhaller](https://github.com/stefanhaller) in [#​5910](jesseduffield/lazygit#5910) - Update the UI after stash operations in a single frame by [@​stefanhaller](https://github.com/stefanhaller) in [#​5905](jesseduffield/lazygit#5905) - Honor the conflict-marker-size gitattribute by [@​stefanhaller](https://github.com/stefanhaller) in [#​5902](jesseduffield/lazygit#5902) - Fix hang on quit when confirmOnQuit is true by [@​stefanhaller](https://github.com/stefanhaller) in [#​5919](jesseduffield/lazygit#5919) - Fix pull requests silently disappearing until lazygit is restarted by [@​stefanhaller](https://github.com/stefanhaller) in [#​5921](jesseduffield/lazygit#5921) ##### Maintenance ⚙️ - Don't let integration tests race a background git repack by [@​stefanhaller](https://github.com/stefanhaller) in [#​5898](jesseduffield/lazygit#5898) - update Nix flake dependencies by [@​TyceHerrman](https://github.com/TyceHerrman) in [#​5894](jesseduffield/lazygit#5894) - Simplify the run\_integration\_tests.sh script by [@​stefanhaller](https://github.com/stefanhaller) in [#​5908](jesseduffield/lazygit#5908) - Bump actions/setup-go from 6 to 7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​5843](jesseduffield/lazygit#5843) - Bump github.com/kyokomi/emoji/v2 from 2.2.13 to 2.2.14 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​5813](jesseduffield/lazygit#5813) - Bump mheap/github-action-required-labels from 5.5.2 to 5.6.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​5769](jesseduffield/lazygit#5769) - Bump github.com/lucasb-eyer/go-colorful from 1.4.0 to 1.4.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​5916](jesseduffield/lazygit#5916) - Bump JamesIves/github-sponsors-readme-action from 1.6.0 to 1.6.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​5917](jesseduffield/lazygit#5917) **Full Changelog**: <jesseduffield/lazygit@v0.64.0...v0.64.1> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODguMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A lazygit instance that has been open for a while sometimes stops showing pull requests, and keeps not showing them until you quit and restart it. The cause is that we resolve the GitHub token once per process and then keep using that stale answer.
We get the token from go-gh, which reads gh's
hosts.ymlon the first call and caches it for the lifetime of the process. gh rewrites that file whenever the active account changes, and keeps the active account's token either in the file or in the system keyring, depending on the account. Once the file changes under us, our snapshot no longer describes reality: either we keep sending a token for an account that is no longer active, or — if the snapshot was taken while a keyring-backed account was active — we find no token at all, drop the remote, and show no pull requests. Nothing is reported to the user, so it looks like PR fetching is simply broken.Switching accounts with
gh auth switchis the easiest way to trigger this, but it isn't limited to multi-account setups: a single account hits the same thing whenever its token is rotated, or moved between the keyring andhosts.ymlby a freshgh auth login.So ask gh itself for the token on every refresh, with
gh auth token --hostname <host>, which resolves it afresh from whichever of the environment, the keyring, or the config file currently holds it. Not passing--secure-storage(which go-gh does internally) also means it stops mattering which of the two the active account uses. go-gh's lookup stays as a fallback for setups without the gh binary, where it still picks upGH_TOKENand friends; when gh is present it checks those variables itself.To reproduce on master, with two gh accounts, one with its token in the keyring and one in
hosts.yml: start lazygit while the keyring-backed account is active, then rungh auth switchto the other one. The pull request information disappears on the next refresh and doesn't come back until lazygit is restarted. Runninggh auth token --secure-storage --hostname github.comby hand at that point printsno oauth token found for github.com.