fix(skill-search): resolve token from gh credential store#399
Merged
Conversation
Adds resolveGhToken() which falls back to `gh auth token` after env vars, so credentials from `gh auth login` are used automatically. GitHub's Code Search API now returns 401 for unauthenticated requests; also improves the 401 error message to guide users toward gh auth login.
Deploying allagents with
|
| Latest commit: |
cc387b4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://30a051a1.allagents.pages.dev |
| Branch Preview URL: | https://fix-skill-search-gh-token.allagents.pages.dev |
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.
Summary
npx allagents@next skill search <query>was returning a 401 because the CLI only checkedGITHUB_TOKEN/GH_TOKENenv vars and ignored credentials set viagh auth loginresolveGhToken()which falls back togh auth tokensubprocess after env vars, mirroring the lookup order used by theghCLI itselfgh auth loginTest plan
GITHUB_TOKEN= GH_TOKEN= npx allagents@next skill search braintrust→Error: GitHub Code Search returned 401: Requires authentication.gh auth logindone) → returns skill results without needing env varstokenResolverdep injects token → Authorization header is set;resolveGhTokenreturns env vars; 401 maps to helpful error message