Skip to content

feat(miner-hands): wire CLI and Agent-SDK drivers into CodingAgentDriver factory - #4561

Closed
carlh7777 wants to merge 1 commit into
JSONbored:mainfrom
carlh7777:feat/driver-factory-concrete-drivers-4289
Closed

feat(miner-hands): wire CLI and Agent-SDK drivers into CodingAgentDriver factory#4561
carlh7777 wants to merge 1 commit into
JSONbored:mainfrom
carlh7777:feat/driver-factory-concrete-drivers-4289

Conversation

@carlh7777

Copy link
Copy Markdown
Contributor

Summary

Closes #4289

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Focused local validation: npx vitest run test/unit/coding-agent-miner.test.ts (+ CLI/SDK driver suites), engine driver-factory node:test suite after tsc, npm run typecheck, npm run docs:drift-check, npm run build:miner, and npm audit --audit-level=moderate. Full npm run test:ci not finished in this environment (Windows rm in engine test script / pack spawn quirks); CI will run the full gate on the PR.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

N/A — no visible UI/frontend/extension change.

Notes

  • CODING_AGENT_DRIVER_NAMES is now ["noop", "cli-subprocess", "agent-sdk"].
  • Real child_process / SDK paths stay behind injected defaults (createDefaultCliSubprocessSpawn, Agent-SDK lazy import); tests always inject fakes.

… factory

- Introduced `cli-subprocess` and `agent-sdk` as new provider options in the coding agent driver factory.
- Enhanced `CODING_AGENT_DRIVER_CONFIG_ENV` to include configuration for the new drivers.
- Implemented `createDefaultCliSubprocessSpawn` for lazy loading of the CLI subprocess.
- Updated tests to validate the new driver configurations and their functionality.

This change expands the capabilities of the coding agent by allowing integration with CLI subprocesses and an Agent-SDK, improving flexibility in coding agent operations.
@carlh7777
carlh7777 requested a review from JSONbored as a code owner July 10, 2026 02:47
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 10, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@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.08%. Comparing base (80d623f) to head (a727f44).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4561   +/-   ##
=======================================
  Coverage   94.08%   94.08%           
=======================================
  Files         427      427           
  Lines       37961    37972   +11     
  Branches    13864    13869    +5     
=======================================
+ Hits        35715    35726   +11     
  Misses       1586     1586           
  Partials      660      660           
Files with missing lines Coverage Δ
...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.

@loopover-orb loopover-orb Bot added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels Jul 10, 2026
@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-10 03:01:15 UTC

5 files · 1 AI reviewer · 1 blocker · readiness 100/100 · CI green · unstable

🛑 Suggested Action - Reject/Close

  • AI reviewers agree on a likely critical defect: driver-factory.ts declares `MINER_CODING_AGENT_CLI_MODEL`, `MINER_CODING_AGENT_SDK_MODEL`, and `MINER_CODING_AGENT_MAX_TURNS` in `CODING_AGENT_DRIVER_CONFIG_ENV` (lines 45-54), but `createCodingAgentDriver`'s switch (lines ~175-198) only reads `command`/`timeoutMs` for `cli-subprocess` and passes nothing but `query`/`hooks` to `createAgentSdkCodingAgentDriver`, so setting those model/maxTurns env vars has zero effect — dead, misleading config-as-code surface. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
This PR wires the already-landed CLI-subprocess (#4266) and Agent-SDK (#4267) backends into `createCodingAgentDriver`, extending `CODING_AGENT_DRIVER_NAMES` and adding matching switch cases, tests, and doc updates. The provider selection, deny-by-default unknown-name handling, and command/timeout resolution (including malformed/blank env fallbacks) are correctly wired and well covered by both the engine unit tests and the `dist`-based package tests. However, the newly declared `CODING_AGENT_DRIVER_CONFIG_ENV` keys for model and max-turns overrides are never actually consumed anywhere in the factory, so those env vars silently do nothing despite being presented as configurable.

Blockers

  • driver-factory.ts declares `MINER_CODING_AGENT_CLI_MODEL`, `MINER_CODING_AGENT_SDK_MODEL`, and `MINER_CODING_AGENT_MAX_TURNS` in `CODING_AGENT_DRIVER_CONFIG_ENV` (lines 45-54), but `createCodingAgentDriver`'s switch (lines ~175-198) only reads `command`/`timeoutMs` for `cli-subprocess` and passes nothing but `query`/`hooks` to `createAgentSdkCodingAgentDriver`, so setting those model/maxTurns env vars has zero effect — dead, misleading config-as-code surface.
Nits — 5 non-blocking
  • `firstConfigured` (driver-factory.ts:67-69) treats a value as valid once `trim() !== ""` but returns it untrimmed, so a padded `MINER_CODING_AGENT_CLI=" codex "` would be passed straight to `spawn` with the surrounding whitespace intact.
  • `createDefaultCliSubprocessSpawn` (driver-factory.ts:81-116) nests the lazy-singleton IIFE, the promisified spawn, and the `stdout`/`stderr`/`close` handlers 5-6 levels deep; pulling the real spawn implementation into its own named function would read closer to `src/selfhost/ai.ts`'s `defaultSpawn` it's meant to mirror.
  • `isConfiguredCodingAgentDriver` (driver-factory.ts:130-142) unconditionally returns true for `agent-sdk` with no check that the SDK package is actually resolvable — fine given the lazy-import comment, but worth a one-line note that failures surface only at first `run()`, not at configuration time.
  • Either forward `model`/`maxTurns` from `CODING_AGENT_DRIVER_CONFIG_ENV` into `createCliSubprocessCodingAgentDriver`/`createAgentSdkCodingAgentDriver`, or drop those keys from the config map until the underlying drivers accept them, so the advertised env surface matches what's actually wired.
  • Trim the resolved `command` value (driver-factory.ts:176-178) before handing it to `spawn`.

Why this is blocked

  • driver-factory.ts declares `MINER_CODING_AGENT_CLI_MODEL`, `MINER_CODING_AGENT_SDK_MODEL`, and `MINER_CODING_AGENT_MAX_TURNS` in `CODING_AGENT_DRIVER_CONFIG_ENV` (lines 45-54), but `createCodingAgentDriver`'s switch (lines ~175-198) only reads `command`/`timeoutMs` for `cli-subprocess` and passes nothing but `query`/`hooks` to `createAgentSdkCodingAgentDriver`, so setting those model/maxTurns env vars has zero effect — dead, misleading config-as-code surface.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
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 (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 183 registered-repo PR(s), 114 merged, 17 issue(s).
Contributor context ✅ Confirmed Gittensor contributor carlh7777; Gittensor profile; 183 PR(s), 17 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Linked issue satisfaction

Addressed
The PR registers the CLI-subprocess and Agent-SDK backends in createCodingAgentDriver, adds the CODING_AGENT_DRIVER_CONFIG_ENV per-provider env map mirroring SELF_HOST_REVIEWER_MODEL_ENV, keeps deny-by-default for unknown providers, and adds unit tests covering valid providers, unknown-provider rejection, and env/option override resolution as required by the issue's deliverables.

Review context
  • Author: carlh7777
  • 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: 183 PR(s), 17 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.

🟩 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 added the manual-review Gittensor contributor context label Jul 10, 2026
@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (AI reviewers agree on a likely critical defect: driver-factory.ts declares `MINER_CODING_AGENT_CLI_MODEL`, `MINER_CODING_AGENT_SDK_MODEL`, and `MINER_CODING_AGENT_MAX_TURNS` in `CODING_AGENT_DRIVER_CONFIG_ENV` (lines 45-54), but `createCodingAgentDriver`'s switch (lines ~175-198) only reads `command`/`timeoutMs` for `cli-subprocess` and passes nothing but `query`/`hooks` to `createAgentSdkCodingAgentDriver`, so setting those model/maxTurns env vars has zero effect — dead, misleading config-as-code surface.). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant