Skip to content

feat(miner-hands): CodingAgentDriver factory + provider-style config resolution #4289

Description

@JSONbored

Once the CodingAgentDriver interface (#4262) and at least the CLI-subprocess implementation (#4266) exist, something needs to pick WHICH concrete driver to instantiate for a given attempt — mirroring how src/selfhost/ai-config.ts resolves AI_PROVIDER into a concrete SelfHostAi today. That file's resolveConfiguredProviderNames/isConfiguredSelfHostProvider (lines 41-74) parse a comma-separated provider-name env var and validate each name against what's actually configured (e.g. claude-code/codex are always "configured" since they're locally-authenticated CLIs with no required API key; openai/anthropic require their respective API key env var), and SELF_HOST_REVIEWER_MODEL_ENV (lines 15-22) maps each provider name to its model-override env var. This issue builds the equivalent resolution layer for coding-agent drivers.

Deliverables

  • packages/gittensory-engine/src/miner/driver-factory.ts (path coordinated with feat(miner-hands): define the CodingAgentDriver interface seam #4262) exporting a provider-name → CodingAgentDriver factory, structurally mirroring resolveConfiguredProviderNames/isConfiguredSelfHostProvider (src/selfhost/ai-config.ts:41-74) but over the driver set from this batch (CLI-subprocess from feat(miner-hands): CLI-subprocess CodingAgentDriver (reuse SpawnFn/redactSecrets/EFFORT_TIMEOUT_MS pattern) #4266, Agent-SDK from feat(miner-hands): Agent-SDK CodingAgentDriver (query() loop) #4267) rather than the six review providers.
  • A per-provider config-resolution map analogous to SELF_HOST_REVIEWER_MODEL_ENV (src/selfhost/ai-config.ts:15-22) for whatever a coding-agent driver needs configured beyond a model name (e.g. effort/turn budget, worktree base path) — reuse the firstConfigured/repo-override-over-env-var priority pattern from src/selfhost/ai.ts:117-134 if a per-repo override (.gittensory-miner.yml-sourced, mirroring review.ai_model's .gittensory.yml precedent) makes sense here too.
  • Deny-by-default / fail-closed behavior for an unconfigured or unknown provider name, matching this codebase's house style elsewhere (resolveAutonomy's deny-by-default in src/settings/autonomy.ts:25-27, isConfiguredSelfHostProvider's default: return false in src/selfhost/ai-config.ts:64-65) rather than silently falling through to some default driver.
  • Unit tests for: a valid single provider name, an unknown provider name (rejected), and — if this factory supports a fallback chain the way AiRunOptions' fallback field does for reviewers — a primary-then-fallback resolution case.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.gittensor:priorityMaintainer-selected Gittensor priority — scores a 1.5x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions