Skip to content

fix(miner): gate doctor's claude/codex CLI-presence checks by MINER_CODING_AGENT_PROVIDER (#5165) - #5271

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
joaovictor91123:fix/miner-doctor-cli-gate-5165
Jul 12, 2026
Merged

fix(miner): gate doctor's claude/codex CLI-presence checks by MINER_CODING_AGENT_PROVIDER (#5165)#5271
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
joaovictor91123:fix/miner-doctor-cli-gate-5165

Conversation

@joaovictor91123

Copy link
Copy Markdown
Contributor

Summary

  • checkClaudeCliPresent/checkCodexCliPresent in packages/gittensory-miner/lib/laptop-init.js ran unconditionally, contradicting the code's own comment that a CLI is "only needed once a driver provider is configured" -- a rationale that was never actually implemented. As a result, doctor could not distinguish "no provider configured, CLI absence is fine" from "provider configured but the CLI is missing/broken, every attempt will fail."
  • Both checks now read MINER_CODING_AGENT_PROVIDER (via options.env/process.env, matching the existing pattern) and only flip ok to false when the relevant provider (claude-cli / codex-cli respectively) is configured and its CLI binary is absent.
  • Unconfigured, or a different provider configured, remains ok: true with the existing advisory message unchanged.
  • The already-present found/authenticated and found/unauthenticated details are completely unchanged -- this only touches the "CLI absent" branch of each function.
  • No other doctor check or runDoctorChecks()'s overall control flow is touched.

Test plan

  • npx vitest run test/unit/miner-cli-doctor-checks.test.ts -- 16/16 passing, including the new describe("provider-gated CLI-presence failures (#5165)", ...) block: the regression case (CLI missing + unconfigured stays ok: true), CLI missing + a different provider configured stays advisory, CLI missing + the matching provider configured fails with the actionable message, CLI present + matching provider configured is unaffected, for both claude-cli and codex-cli, plus an invariant that an unconfigured/differently-configured provider's check is never ok: false regardless of CLI presence.
  • npm run typecheck -- clean.
  • npm run build:miner -- clean (node --check on laptop-init.js and every other shipped miner lib file passes).
  • npm run docs:drift-check -- clean.
  • packages/gittensory-miner/** currently sits outside vitest's coverage.include glob (per the issue's own Codecov-visibility note), so codecov/patch cannot measure this change yet -- treating the 100%-including-invariants-and-regression tests above as the enforced house standard regardless, per the issue's instructions.
  • Did not run the full unsharded npm run test:coverage locally (shared/resource-contended machine); relying on the targeted test run above plus npm run typecheck/build:miner.

Fixes #5165.

…ODING_AGENT_PROVIDER (JSONbored#5165)

checkClaudeCliPresent/checkCodexCliPresent in laptop-init.js ran
unconditionally, contradicting their own comment that a CLI is "only
needed once a driver provider is configured" -- a rationale that was
never actually implemented, so doctor could not distinguish "no
provider configured, CLI absence is fine" from "provider configured
but the CLI is missing, every attempt will fail."

Both checks now read MINER_CODING_AGENT_PROVIDER and only flip ok to
false when the relevant provider (claude-cli / codex-cli) is
configured and its CLI binary is absent. An unconfigured provider, or
a different provider configured, remains ok: true with the existing
advisory message. The already-present authenticated/unauthenticated
detail is unchanged either way.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.37%. Comparing base (864c52d) to head (8d1813c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5271   +/-   ##
=======================================
  Coverage   94.37%   94.37%           
=======================================
  Files         474      474           
  Lines       40114    40114           
  Branches    14627    14627           
=======================================
  Hits        37856    37856           
  Misses       1583     1583           
  Partials      675      675           
Flag Coverage Δ
shard-1 46.27% <ø> (-0.15%) ⬇️
shard-2 34.73% <ø> (+0.01%) ⬆️
shard-3 32.05% <ø> (-0.05%) ⬇️
shard-4 31.82% <ø> (-0.26%) ⬇️
shard-5 33.59% <ø> (-0.07%) ⬇️
shard-6 45.06% <ø> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 12, 2026
@loopover-orb

loopover-orb Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-12 12:56:33 UTC

2 files · 2 AI reviewers · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR gates checkClaudeCliPresent/checkCodexCliPresent's ok result on whether MINER_CODING_AGENT_PROVIDER matches the CLI in question, fixing the stated bug where doctor previously ignored the configured provider entirely. The logic is correct and symmetric between the two checks, the found/authenticated branches are untouched, and the new test suite exercises all four provider/presence combinations plus an explicit invariant test. This is a narrow, well-targeted fix tied to a real prior gap (the comment admitted the provider-gating was never implemented).

Nits — 5 non-blocking
  • The 'magic number' flag from the external brief (line reference to '5165') is a false positive — that's an issue-number reference in a comment, not a magic numeric literal in logic.
  • laptop-init.js: codingAgentProviderConfiguredFor does an exact string match on MINER_CODING_AGENT_PROVIDER; consider whether case-insensitivity or trimming is needed if this env var can be set with stray whitespace elsewhere in the codebase (verify against how other MINER_CODING_AGENT_PROVIDER reads handle it).
  • Confirm the PR links/closes issue Gate doctor's claude/codex CLI-presence checks by the configured MINER_CODING_AGENT_PROVIDER #5165 in the actual GitHub PR metadata, not just the description, per repo convention for external contributor PRs.
  • Consider extracting the two duplicated 'not installed (optional until a coding-agent driver is configured)' string literals into a shared constant, since checkClaudeCliPresent and checkCodexCliPresent now repeat both the advisory and failure detail strings almost verbatim.
  • nit: `packages/gittensory-miner/lib/laptop-init.js:107` compares the raw environment value exactly, so a value with accidental surrounding whitespace is treated as unconfigured; either mirror the provider normalization used by the runtime config path or leave a short reason that this variable is intentionally exact-match only.
Signal Result Evidence
Code review ✅ No blockers 2 reviewers, synthesized
Linked issue ✅ Linked #5165
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 117 registered-repo PR(s), 68 merged, 11 issue(s).
Contributor context ✅ Confirmed Gittensor contributor joaovictor91123; Gittensor profile; 117 PR(s), 11 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence. LLM value judgment: moderate — The change closes a real observability gap in doctor by making CLI-presence failures actionable exactly when they matter (provider configured) while preserving the advisory behavior otherwise, backed by symmetric tests for both CLIs and all provider states.
Linked issue satisfaction

Addressed
The diff adds provider gating via a shared helper in both checkClaudeCliPresent and checkCodexCliPresent, keeping ok:true/advisory when unconfigured or a different provider is set and flipping to ok:false with a clear actionable message when the matching provider is configured and the CLI is missing, exactly as required. Tests were added covering the regression, different-provider, configured-miss

Review context
  • Author: joaovictor91123
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 117 PR(s), 11 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
[BETA] Chat with Gittensory

Ask 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.

  • @gittensory ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

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.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit fb9fb20 into JSONbored:main Jul 12, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gate doctor's claude/codex CLI-presence checks by the configured MINER_CODING_AGENT_PROVIDER

1 participant