Skip to content

fix(skill-search): resolve token from gh credential store#399

Merged
christso merged 1 commit into
mainfrom
fix/skill-search-gh-token
May 18, 2026
Merged

fix(skill-search): resolve token from gh credential store#399
christso merged 1 commit into
mainfrom
fix/skill-search-gh-token

Conversation

@christso
Copy link
Copy Markdown
Contributor

Summary

  • npx allagents@next skill search <query> was returning a 401 because the CLI only checked GITHUB_TOKEN/GH_TOKEN env vars and ignored credentials set via gh auth login
  • GitHub's Code Search API now requires authentication outright (401), so unauthenticated requests always fail
  • Added resolveGhToken() which falls back to gh auth token subprocess after env vars, mirroring the lookup order used by the gh CLI itself
  • Improved the 401 error message to guide users toward gh auth login

Test plan

  • Red E2E (before): GITHUB_TOKEN= GH_TOKEN= npx allagents@next skill search braintrustError: GitHub Code Search returned 401: Requires authentication.
  • Green E2E (after): same command (with gh auth login done) → returns skill results without needing env vars
  • Unit tests: tokenResolver dep injects token → Authorization header is set; resolveGhToken returns env vars; 401 maps to helpful error message

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.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying allagents with  Cloudflare Pages  Cloudflare Pages

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

View logs

@christso christso merged commit e687969 into main May 18, 2026
1 check passed
@christso christso deleted the fix/skill-search-gh-token branch May 18, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant