feat(miner): resolve GitHub token from loopover-mcp session for AMS git operations - #6132
Conversation
…it operations Closes #6116 AMS's git-operation call sites (loop, attempt, init --verify-token, manage poll) previously read GITHUB_TOKEN from the environment directly, requiring a separately-configured PAT even after a user completed `loopover-mcp login`. resolveGitHubToken() now resolves, at each CLI entrypoint: an explicit GITHUB_TOKEN override first, else a live token fetched from the authenticated loopover-mcp session (#6114/#6115), threaded down explicitly to every real GitHub caller. doctor's github-token check now recognizes a recorded login session too, so it no longer reports a spurious "not set" warning for a user who only ran the new login flow.
The #6116 changes make loopover-mcp login sufficient on its own for AMS's git operations, but the miner README's setup section still only described the GITHUB_TOKEN PAT flow. Add the one-command login path as primary, with the PAT kept as the documented explicit fallback.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6132 +/- ##
=======================================
Coverage 95.32% 95.33%
=======================================
Files 597 598 +1
Lines 47133 47178 +45
Branches 15026 15026
=======================================
+ Hits 44930 44975 +45
Misses 1477 1477
Partials 726 726
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-15 12:12:42 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 7 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
loop,attempt,init --verify-token,manage poll) now resolve a GitHub token via a newresolveGitHubTokenhelper instead of readingenv.GITHUB_TOKENdirectly: an explicitGITHUB_TOKENoverride wins outright (existing self-host PAT setups keep working unchanged), else a live token is fetched from the authenticatedloopover-mcp loginsession (POST /v1/auth/github/token, Persist + expose the GitHub user-to-server token from login instead of discarding it #6114/Decide + implement GitHub token refresh/expiration handling for long-running AMS sessions #6115) and cached in memory for the process's lifetime.doctor'sgithub-tokenpresence check now recognizes a recordedloopover-mcp loginsession (offline, no network call) in addition toGITHUB_TOKEN, so a user who only ran the new login flow no longer sees a spurious "not set" warning.packages/loopover-miner/README.mdnow documentsloopover-mcp loginas the primary auth path with the PAT as an explicit fallback;packages/loopover-miner/docs/config-precedence.mdgets a new precedence section for this resolution order.loopover-mcp's config-file read standalone ingithub-token-resolution.jsrather than adding@loopover/mcpas a runtime dependency of@loopover/miner— the two are separately-installable CLIs, and this milestone's whole point is that installing one doesn't require the other.Closes #6116
Test plan
test/unit/miner-github-token-resolution.test.ts(25 tests, 100% stmt/line, 98.21% branch on the new module — the one uncovered branch is the real-homedir()fallback, same accepted-gap pattern as the module this mirrors)test/unit/miner-cli-doctor-checks.test.tsextended forcheckGitHubTokenPresent's new dual-source behavior (env-only, session-only, neither, empty-string)env.GITHUB_TOKENfixturesnpm run typecheck,npm run test:coverage(unsharded),npm run docs:drift-check,npm run command-reference:checkall passnpm run test:cigate green