Skip to content

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

Merged
gittensory-orb[bot] merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/coding-agent-driver-factory-4289-v2
Jul 10, 2026
Merged

feat(miner-hands): CodingAgentDriver factory + provider-style config resolution (#4289)#4633
gittensory-orb[bot] merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/coding-agent-driver-factory-4289-v2

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Closes #4289

Summary

Wires the landed CLI-subprocess (#4266) and Agent-SDK (#4267) backends into createCodingAgentDriver, mirroring src/selfhost/ai-config.ts provider resolution: comma-separated MINER_CODING_AGENT_PROVIDER, deny-by-default unknown names, per-provider env config map with every declared key consumed, and primary-then-fallback selection via resolveFirstConfiguredCodingAgentDriverName.

Fixes the gate blocker that closed prior attempts (#4561, #4593) — dry-run/paused attempts no longer require spawn for CLI providers.

Provider registry

Name Backend Config env keys (consumed)
noop stub
claude-cli createCliSubprocessCodingAgentDriver("claude") MINER_CODING_AGENT_CLAUDE_MODEL, MINER_CODING_AGENT_TIMEOUT_MS
codex-cli createCliSubprocessCodingAgentDriver("codex") MINER_CODING_AGENT_CODEX_MODEL, MINER_CODING_AGENT_TIMEOUT_MS
agent-sdk createAgentSdkCodingAgentDriver — (SDK uses account default; no model key today)

Deliberately not declared: max-turns (task-level CodingAgentDriverTask.maxTurns) and agent-sdk model (driver exposes no model option).

Key design choices

  • Fail-closed: unknown provider → unconfigured_coding_agent_driver:<name>; CLI without spawnunconfigured_coding_agent_driver_missing_spawn:<name>.
  • Config consumption: model env prefixes --model <value> onto defaultCliSubprocessArgs; timeout env sets timeoutMs when a positive integer.
  • Lazy driver construction (feat(miner-hands): resolve concrete CLI/SDK providers in the CodingAgentDriver factory #4593 fix): runCodingAgentAttempt uses createNoopCodingAgentDriver() when !codingAgentModeExecutes(mode), so dry-run/paused attempts with claude-cli/codex-cli never require spawn/query deps (matches coding-agent-driver.md lifecycle).
  • No default spawn in engine: real child_process wiring stays in the miner package; tests always inject fakes.

Changes

Area Change
packages/gittensory-engine/src/miner/driver-factory.ts Full factory: registry, config map, fallback resolution, lazy mode-aware driver pick
packages/gittensory-engine/src/miner/cli-subprocess-driver.ts Export defaultCliSubprocessArgs for factory argv prefixing
packages/gittensory-engine/src/index.ts Export new symbols
packages/gittensory-miner/docs/coding-agent-driver.md Updated registry + lifecycle diagram
Tests test/unit/coding-agent-miner.test.ts, packages/gittensory-engine/test/driver-factory.test.ts

Test plan

  • Valid provider names resolve (noop, claude-cli, codex-cli, agent-sdk)
  • Unknown provider rejected (deny-by-default)
  • Model env consumed in CLI argv (claude vs codex keys isolated)
  • Timeout env consumed / invalid values fall back to 120s default
  • Missing spawn fail-closed for CLI providers (live construction only)
  • Primary-then-fallback via resolveFirstConfiguredCodingAgentDriverName
  • runCodingAgentAttempt dry_run with claude-cli, no spawn — shadow event, no throw
  • runCodingAgentAttempt live claude-cli end-to-end with model env
  • npm run test:ci before push
  • Engine package test suite after tsc

Notes

  • Provider names are claude-cli/codex-cli (not cli-subprocess) to mirror self-host's claude-code/codex naming.
  • Per-repo overrides (.gittensory-miner.yml) remain a follow-up — env-only for now; firstConfiguredEnvValue helper is in place for when that lands.

@andriypolanski andriypolanski marked this pull request as draft July 10, 2026 08:28
@superagent-security

Copy link
Copy Markdown
Contributor

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

@gittensory-orb gittensory-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. label Jul 10, 2026
@gittensory-orb gittensory-orb Bot added the gittensor:priority Maintainer-selected Gittensor priority — scores a 1.75x multiplier. label Jul 10, 2026
@gittensory-orb

gittensory-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown

Tip

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

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-10 08:40:45 UTC

7 files · no blockers · readiness 96/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge
Signal Result Evidence
Code review ✅ No blockers No AI review summary
Linked issue ✅ Linked #4289
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 (draft PR; 1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 138 registered-repo PR(s), 85 merged, 25 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 138 PR(s), 25 issue(s).
Gate result ✅ Passing No configured blocker found.
Linked issue satisfaction

Addressed
The PR adds driver-factory.ts's CODING_AGENT_DRIVER_NAMES/CODING_AGENT_DRIVER_CONFIG_ENV mirroring the referenced ai-config.ts pattern, wires claude-cli/codex-cli/agent-sdk with deny-by-default unknown-name and missing-spawn fail-closed errors, and adds resolveFirstConfiguredCodingAgentDriverName for primary-then-fallback selection, with unit tests covering a valid provider, an unknown/rejected pr

Review context
  • Author: andriypolanski
  • 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: 138 PR(s), 25 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Mark ready when done.
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.

🟩 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

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.11%. Comparing base (efcd25d) to head (ec525fe).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4633   +/-   ##
=======================================
  Coverage   94.11%   94.11%           
=======================================
  Files         432      432           
  Lines       38348    38373   +25     
  Branches    13979    13990   +11     
=======================================
+ Hits        36091    36116   +25     
  Misses       1600     1600           
  Partials      657      657           
Files with missing lines Coverage Δ
...ttensory-engine/src/miner/cli-subprocess-driver.ts 100.00% <100.00%> (ø)
...ages/gittensory-engine/src/miner/driver-factory.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andriypolanski andriypolanski marked this pull request as ready for review July 10, 2026 08:39

@gittensory-orb gittensory-orb Bot left a comment

Copy link
Copy Markdown

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.

@gittensory-orb gittensory-orb Bot merged commit 30b62ae into JSONbored:main Jul 10, 2026
10 checks passed
@gittensory-orb gittensory-orb Bot added gittensor:bug Gittensor-scored bug fix — scores a 0.5x multiplier. and removed gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.75x multiplier. labels Jul 10, 2026
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.5x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant