Skip to content

feat(miner-hands): add coding-agent dry-run mode and driver seam (#4313) - #4347

Merged
loopover-orb[bot] merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/add-coding-agent-dry-run-mode-and-driver-seam
Jul 9, 2026
Merged

feat(miner-hands): add coding-agent dry-run mode and driver seam (#4313)#4347
loopover-orb[bot] merged 4 commits into
JSONbored:mainfrom
andriypolanski:feat/add-coding-agent-dry-run-mode-and-driver-seam

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

  • Add packages/gittensory-engine/src/miner/coding-agent-driver.ts: the #4262 CodingAgentDriver interface seam — single run(task) method, provider-agnostic task/result types, fake/noop drivers for contract tests (mirrors SelfHostAi at src/selfhost/ai.ts:60-63).
  • Add coding-agent-mode.ts: three-state execution mode (paused | dry_run | live) structurally mirroring AgentActionMode (src/settings/agent-execution.ts:23-48) — deny-toward-safety precedence (global/per-config pause beats dry-run beats live), plus codingAgentModeExecutes() as the single boolean gate.
  • Dry-run semantics: pure no-op at the driver invocation boundary — the underlying CLI/SDK session is never spawned in dry_run; the attempt log records attempt_shadow with mode=dry_run so the shadow path stays auditable. (Worktree run-but-no-commit deferred to feat(miner-hands): git-worktree-per-attempt isolation primitive #4269.)
  • Add coding-agent-invoke.ts: invokeCodingAgentDriver() — the mode-gated call site (paused → abort, dry_run → shadow result, live → delegate to driver).
  • Add driver-factory.ts (feat(miner-hands): CodingAgentDriver factory + provider-style config resolution #4289 minimal): provider-name resolution (noop stub today, deny-by-default on unknown names) and runCodingAgentAttempt() end-to-end entry.
  • Add attempt-log.ts (feat(miner-hands): driver-level structured attempt log (JSONL event trace per attempt) #4294 minimal): pure event vocabulary + normalizeAttemptLogEvent / JSONL export — every event carries mode.
  • Wire codingAgentMode through preparePlanTemplate (packages/gittensory-engine/src/plan-templates.ts:84) and rawPlanStepSchema (src/mcp/server.ts) so a dry-run attempt is distinguishable on the plan DAG.

Closes #4313.

Part of Miner Wave 2. Includes the #4262 interface foundation this issue depends on; concrete CLI/SDK drivers (#4266/#4267) and SQLite persistence for the attempt log (#4294 IO layer) are follow-ups.

Scope

  • Three-state execution mode mirroring AgentActionMode (not a boolean) with documented dry-run tradeoff
  • CodingAgentDriver interface + fake/noop drivers
  • Mode-gated invocation (invokeCodingAgentDriver) — paused/dry_run never call driver.run()
  • Driver factory with deny-by-default provider resolution + runCodingAgentAttempt
  • Pure attempt-log event shapes (attempt_shadow for dry-run) with mode on every row
  • codingAgentMode visible on the prepare-phase coding-agent plan step + MCP rawPlanStepSchema
  • Barrel exports from packages/gittensory-engine/src/index.ts
  • Unit tests: mode precedence (mirrors resolveAgentActionMode bar), invoke branches, factory, attempt log, plan-template wiring

Changed files

File Change
packages/gittensory-engine/src/miner/coding-agent-mode.ts New: CodingAgentExecutionMode, resolveCodingAgentExecutionMode, codingAgentModeExecutes, global pause helper
packages/gittensory-engine/src/miner/coding-agent-driver.ts New: CodingAgentDriver interface, task/result types, fake/noop drivers
packages/gittensory-engine/src/miner/coding-agent-invoke.ts New: invokeCodingAgentDriver — mode gating + attempt-log writes
packages/gittensory-engine/src/miner/driver-factory.ts New: provider resolution, createCodingAgentDriver, runCodingAgentAttempt
packages/gittensory-engine/src/miner/attempt-log.ts New: event vocabulary, normalizer, JSONL formatter, in-memory buffer
packages/gittensory-engine/src/index.ts Export new miner module surface
packages/gittensory-engine/src/plan-templates.ts PlanTemplateContext.codingAgentMode + prepare-step wiring
packages/gittensory-engine/test/coding-agent-mode.test.ts Mode precedence tests
packages/gittensory-engine/test/coding-agent-driver.test.ts Fake/noop driver contract tests
packages/gittensory-engine/test/coding-agent-invoke.test.ts Paused/dry-run/live invoke branches
packages/gittensory-engine/test/driver-factory.test.ts Factory deny-by-default + end-to-end attempt
packages/gittensory-engine/test/attempt-log.test.ts Normalizer + JSONL buffer tests
src/mcp/server.ts Add optional codingAgentMode to rawPlanStepSchema
test/unit/plan-templates.test.ts Prepare-step codingAgentMode round-trip through schema

Validation

Ran locally (all green):

git diff --check
npm run typecheck
npm run test --workspace @jsonbored/gittensory-engine   # 295 tests passed (incl. 5 new miner test files)
npx vitest run test/unit/plan-templates.test.ts
npm run ui:openapi:check

@andriypolanski
andriypolanski requested a review from JSONbored as a code owner July 9, 2026 01:19
@andriypolanski
andriypolanski marked this pull request as draft July 9, 2026 01:19
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.95%. Comparing base (46a19f8) to head (321562c).
⚠️ Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4347      +/-   ##
==========================================
+ Coverage   93.94%   93.95%   +0.01%     
==========================================
  Files         397      402       +5     
  Lines       36760    36836      +76     
  Branches    13432    13455      +23     
==========================================
+ Hits        34535    34611      +76     
  Misses       1569     1569              
  Partials      656      656              
Files with missing lines Coverage Δ
...ackages/gittensory-engine/src/miner/attempt-log.ts 100.00% <100.00%> (ø)
...gittensory-engine/src/miner/coding-agent-driver.ts 100.00% <100.00%> (ø)
...gittensory-engine/src/miner/coding-agent-invoke.ts 100.00% <100.00%> (ø)
...s/gittensory-engine/src/miner/coding-agent-mode.ts 100.00% <100.00%> (ø)
...ages/gittensory-engine/src/miner/driver-factory.ts 100.00% <100.00%> (ø)
packages/gittensory-engine/src/plan-templates.ts 100.00% <100.00%> (ø)
src/mcp/server.ts 95.40% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andriypolanski
andriypolanski force-pushed the feat/add-coding-agent-dry-run-mode-and-driver-seam branch from d1aecd3 to 321562c Compare July 9, 2026 05:06
@andriypolanski
andriypolanski marked this pull request as ready for review July 9, 2026 05:16
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 9, 2026
@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Tip

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

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-09 11:41:47 UTC

16 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a clean, well-tested three-state execution-mode gate (paused/dry_run/live) and a CodingAgentDriver seam mirroring existing SelfHostAi/AgentActionMode/governor-ledger conventions, with dry-run correctly never spawning the underlying driver. However, it introduces a duplicate-export naming collision in the barrel file: `packages/gittensory-engine/src/index.ts` explicitly re-exports `type CodingAgentExecutionMode` from `./miner/coding-agent-mode.js` while also doing `export * from "./plan-templates.js"`, and this diff newly adds a colliding `export type CodingAgentExecutionMode = "paused" | "dry_run" | "live";` inside plan-templates.ts — a TS2308 ambiguous-export error. This lines up with the CI status given: `validate` and `validate-code` are the only two FAILED checks, while vitest/codecov-driven checks (which don't type-check across the barrel) passed. The mode-gating, attempt-log normalization, and driver-factory deny-by-default logic are otherwise correct and thoroughly tested.

Blockers

  • packages/gittensory-engine/src/index.ts re-exports `type CodingAgentExecutionMode` from `./miner/coding-agent-mode.js` and also `export * from "./plan-templates.js"`, which now defines its own `export type CodingAgentExecutionMode` (plan-templates.ts) — this ambiguous duplicate export is a real TS2308 build error and is almost certainly why the `validate`/`validate-code` checks are FAILED; fix by having plan-templates.ts `import type { CodingAgentExecutionMode } from "./miner/coding-agent-mode.js"` instead of redefining and re-exporting its own copy.
Nits — 5 non-blocking
  • src/mcp/server.ts only shows the `rawPlanStepSchema` addition; confirm `codingAgentMode` actually survives the transform into `planStepSchema`/the persisted PlanStep record rather than being validated then silently dropped, since the PR description claims it's 'visible end-to-end on the plan DAG'.
  • test/unit/queue.test.ts swaps the concurrency-fanout test's spy target from `resolveRepositorySettings` to `mapWithConcurrencyLimit` and adds a global `vi.restoreAllMocks()` to the shared `afterEach` — this is unrelated to the coding-agent-driver feature and isn't mentioned in the PR description; call out the scope creep or move it to its own PR.
  • driver-factory.ts's `CODING_AGENT_DRIVER_CONFIG_ENV` is declared but never consumed anywhere (only asserted in tests) — acceptable as a documented 'feat(miner-hands): CodingAgentDriver factory + provider-style config resolution #4289 minimal' scaffold, but flag for follow-through once a real provider config lands.
  • driver-factory.ts has two separate import statements from `./coding-agent-driver.js` (one mixed value+type, one type-only) that could be merged into one import for clarity.
  • The literal union `"paused" | "dry_run" | "live"` is now duplicated verbatim in both coding-agent-mode.ts and plan-templates.ts; beyond causing the export collision, this is a drift risk if a mode is ever added to one but not the other.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4313
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: 148 registered-repo PR(s), 89 merged, 25 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 148 PR(s), 25 issue(s).
Gate result ✅ Passing No configured blocker found.
Linked issue satisfaction

Addressed
The PR implements a three-state CodingAgentExecutionMode mirroring AgentActionMode with documented deny-toward-safety precedence, defines and documents the pure-no-op dry-run semantics (with the attempt log recording attempt_shadow/mode for auditability), wires the mode through both the driver-factory invocation path and the plan-templates coding-agent step/schema, and includes precedence-focused

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: 148 PR(s), 25 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 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 feb2ba8 into JSONbored:main Jul 9, 2026
10 checks passed
@andriypolanski
andriypolanski deleted the feat/add-coding-agent-dry-run-mode-and-driver-seam branch July 16, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner-hands): dry-run/no-op mode for CodingAgentDriver invocations

1 participant