fix(miner): add offline GITHUB_TOKEN and coding-agent-credential checks to doctor (#5170) - #5514
Conversation
…octor functionality This update introduces two new checks in the doctor functionality: `checkGitHubTokenPresent` and `checkCodingAgentCredential`. The former verifies the presence of the `GITHUB_TOKEN` environment variable, while the latter checks for the configured coding agent's credentials, enhancing the overall robustness of the setup validation process. Additionally, the `runDoctorChecks` function has been updated to include these new checks, ensuring users are informed of any missing credentials before attempting operations that require them.
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
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 #5514 +/- ##
=======================================
Coverage 94.75% 94.75%
=======================================
Files 565 565
Lines 44920 44935 +15
Branches 14675 14675
=======================================
+ Hits 42565 42580 +15
Misses 1621 1621
Partials 734 734
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-13 00:23:27 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Flagged checks (non-blocking)
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory 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/gittensory-commands 🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
gittensory-miner doctoris a no-network readiness check, but it never verified two credentials every real attempt needs, so an operator could passdoctorcleanly and then have their first attempt fail mid-run purely on a missing credential:GITHUB_TOKEN(needed the moment an attempt pushes a branch or opens a PR), andMINER_CODING_AGENT_PROVIDER.This adds both as offline checks in
runDoctorChecks()(packages/gittensory-miner/lib/status.js):checkGitHubTokenPresent— string presence/length check; fails doctor whenGITHUB_TOKENis unset or empty. No API call.checkCodingAgentCredential— resolves the configured provider via the existingresolveFirstConfiguredCodingAgentDriverNameand checks the credential that provider actually requires:claude-cli/agent-sdk→ a Claude credential env var (CLAUDE_CODE_OAUTH_TOKEN, the same token the rest of the tree reads viacreateClaudeCodeAi; the Agent SDK also accepts a rawANTHROPIC_API_KEY, so either satisfies it),codex-cli→auth.jsonreadability, reusinglaptop-init.js'sresolveCodexAuthPath(now exported) so the path never drifts from the existing codex auth probe,noop/ no provider configured → a clean skip.Both preserve doctor's documented zero-network invariant, and neither ever prints a credential value — only presence booleans and env-var / file-path names.
Distinct from the existing
checkClaudeCliPresent/checkCodexCliPresent, which by design keepok: truewhen only the credential is missing (#5165) — this new check is what actually fails doctor on a missing credential.Closes #5170
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.gittensory-miner doctor#5170).Validation
git diff --checknpm run typecheck(clean, incl. the updated.d.tsdeclarations)node --checkon both changed lib files (the miner package's build gate)miner-cli-doctor-checks.test.ts(every provider × present/absent, both||sides, fallback-chain resolution, the no-secret-value invariant, and the missing-credential regression) plus the updatedminer-status.test.tshealthy-setup fixtures — all pass.packages/gittensory-miner/**sits outside Codecov'ssrc/**include glob, socodecov/patchcannot measure it, but every new line and branch is covered to the 100% house standard regardless.npm run test:workers·build:mcp·ui:*— N/A (miner-package + test change only; no worker/MCP/UI/OpenAPI surface touched).If any required check was skipped, explain why:
Change is confined to the
packages/gittensory-minerlib (authored JS, validated bynode --check) + its.d.ts+ unit tests. It touches no workersrc/**, workflow, MCP, OpenAPI, or UI surface.Safety
UI Evidence
N/A — no UI/frontend/docs changes.
Notes
agent-sdk's credential: the repo has noANTHROPIC_API_KEYreference anywhere and authenticates Claude viaCLAUDE_CODE_OAUTH_TOKEN; sinceagent-sdkis the in-process form of the same Claude backend asclaude-cli, the check accepts either token (both are valid Agent-SDK auth), documented inline.GITHUB_TOKENin their fixture (a healthy setup now genuinely requires it) and the new check names — not weakened.