Repository navigation
Document expiring tokens in the gh skill - #14782
Merged
Merged
Conversation
Teach agents how gh reports and refreshes expiring tokens, which hosts support them, why `gh auth token` output must not be cached, and how to handle a rejected refresh token. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ac178b5a-5b62-49bd-9e83-4796c7ddec46
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new authentication-status examples omit the required JSON field selector and return errors instead of authentication data.
1 open issue
What changed in this PR
Updates the gh agent skill to document expiring-token behavior introduced by the refreshable-token work.
Changes:
- Documents expiry metadata and supported hosts.
- Explains token caching, refresh-failure recovery, and environment-token limitations.
| File | Description |
|---|---|
| skills/gh/SKILL.md | Adds expiring-token guidance to Authentication. |
Review effort: Balanced
Clarify behavior of `gh auth status --json` regarding token refresh and expiration. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
sergiou87
approved these changes
Oct 21, 2026
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.

Part of #14449.
Description
ghcan now store expiring OAuth tokens and refresh them automatically (gh auth login --expiring). The gh agent skill inskills/gh/SKILL.mddoesn't mention this yet, so an agent following it may cache the output ofgh auth token, keep retrying after a refresh token is rejected, or expect expiring tokens on hosts that don't issue them.This adds a few bullets to the Authentication section of the skill:
gh auth status --jsonwith"refreshable": trueand atokenExpiresAttimestamp.*.ghe.com) hosts support expiring tokens so far.gh auth tokenshould not be cached, because gh rotates expiring tokens on refresh. Agents should run it again when they need a token, or prefergh apiso gh handles the refresh.refresh_expiredstate means the refresh token was rejected and needs an interactivegh auth loginorgh auth refresh, so the agent should ask the user instead of retrying.GH_TOKENorGITHUB_TOKENare never refreshed.How did you test this change?
Not tested with an agent, since this is a documentation-only change to the skill. I checked each statement against the code on trunk: the
refreshableandtokenExpiresAtfields and therefresh_expiredstate inpkg/cmd/auth/status, and the warninggh auth login --expiringprints for GitHub Enterprise Server hosts inpkg/cmd/auth/shared/login_flow.go.Key points
The new lines are hard-wrapped to match the rest of
SKILL.md. The guidance stays short and focused on what an agent needs to do differently, and leaves the details of the login and refresh flows togh help auth loginandgh help auth refresh.Notes for reviewers
The whole change is in the Authentication section of
skills/gh/SKILL.md. #14449 tracks the expiring token work this documents.Authorship and follow-up
Who wrote this:
Who answers review comments: