Skip to content

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

Description

@JSONbored

Context

checkClaudeCliPresent/checkCodexCliPresent in packages/gittensory-miner/lib/laptop-init.js run unconditionally today, 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 currently cannot distinguish "no provider configured, CLI absence is fine" from "provider configured but the CLI is missing/broken, every attempt will fail."

Dependencies

None — independently shippable. MINER_CODING_AGENT_PROVIDER is already read elsewhere via process.env/options.env in existing tests, so this only requires reading that same value inside the two existing check functions.

Requirements

  1. Inside checkClaudeCliPresent, read MINER_CODING_AGENT_PROVIDER (via process.env/options.env, matching the existing pattern used in tests) and only flip ok to false when the provider is configured as claude-cli and the CLI binary is not present.
  2. Inside checkCodexCliPresent, apply the equivalent gating for codex-cli.
  3. When no provider is configured (or a provider other than the CLI being checked is configured), the check must remain ok: true with an advisory-only message — never fail doctor for an irrelevant/unconfigured CLI.
  4. When the relevant provider IS configured and its CLI is missing, ok must be false and the message must clearly state that every attempt will fail without it.
  5. Do not change any other doctor check's behavior or the overall runDoctorChecks() control flow beyond these two functions.
  6. Update test/unit/miner-cli-doctor-checks.test.ts to cover the new gating behavior for both claude-cli and codex-cli.

Deliverables / Acceptance Criteria

  • checkClaudeCliPresent gated by MINER_CODING_AGENT_PROVIDER === 'claude-cli'
  • checkCodexCliPresent gated by MINER_CODING_AGENT_PROVIDER === 'codex-cli'
  • Unconfigured-provider case remains ok: true advisory, not a failure
  • Configured-but-missing-CLI case is ok: false with a clear message
  • test/unit/miner-cli-doctor-checks.test.ts updated with new cases
  • No change to any other doctor check or to runDoctorChecks()'s overall structure

Test Coverage Requirements

This PR must ship with full test coverage for every changed line and branch — the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced. Add: (1) unit tests covering all four combinations (provider unconfigured/CLI missing, provider unconfigured/CLI present, provider configured/CLI missing, provider configured/CLI present) for both claude-cli and codex-cli, (2) an invariant test asserting that an unconfigured provider's CLI check is never reported as ok: false regardless of CLI presence — "not installed, nobody cares" must never fail doctor, and (3) a regression test asserting the previously-unconditional failure mode (CLI missing while unconfigured) no longer breaks doctor, since this issue is framed as a bug fix for the never-implemented gating comment.

Codecov visibility note: packages/gittensory-miner/**, apps/gittensory-miner-ui/**, and apps/gittensory-miner-extension/** currently sit entirely outside vitest's coverage.include glob, so codecov/patch cannot measure changes there yet — closing that gap is exactly what #4864 and #4865 (in this same milestone) do. Any part of this change under packages/gittensory-engine/src/** or the repo's own src/** remains fully Codecov-instrumented as usual. Either way, this does not lower the bar: treat the 100%-including-invariants-and-regression target above as the enforced house standard regardless of what Codecov can currently see, and it becomes gate-enforced for real once #4864/#4865 ship.

Expected Outcome

An operator running gittensory-miner doctor can now tell the difference between "I haven't set up a coding-agent CLI and don't need to" and "I configured a provider but its CLI is broken/missing and every attempt will fail" instead of getting an unconditional, uninformative check result either way.

Links & Resources

  • packages/gittensory-miner/lib/laptop-init.js (checkClaudeCliPresent, checkCodexCliPresent)
  • test/unit/miner-cli-doctor-checks.test.ts
  • See Make doctor validate config content, not just its path #4873 (validates .gittensory-miner.yml content — a distinct, unrelated doctor check)
  • Theme: Claude/Codex self-host operational parity

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions