Skip to content

feat(miner): add --dry-run to attempt and loop - #5527

Merged
JSONbored merged 1 commit into
mainfrom
feat/attempt-loop-dry-run-4847
Jul 13, 2026
Merged

feat(miner): add --dry-run to attempt and loop#5527
JSONbored merged 1 commit into
mainfrom
feat/attempt-loop-dry-run-4847

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Adds --dry-run to gittensory-miner attempt and gittensory-miner loop — the two REMOTE-mutating commands (attempt opens a real git worktree, claims the issue, and can run a real coding-agent driver that pushes/opens a PR; loop wraps attempt plus its own portfolio-queue/ledger writes).
  • --live's absence already skipped the coding-agent driver, but every worktree clone, claim-ledger write, and ledger append still happened regardless — not the "zero actual writes, local or remote" Add a --dry-run / simulate mode across the miner CLI #4847's acceptance criteria asks for.
  • --dry-run reports what a real invocation would target (repo, issue, resolved coding-agent mode, base branch) and returns immediately, before any store is opened — a provable zero-write path, not just "opened but didn't write to."
  • For loop specifically, this also means skipping discovery, since runDiscoveryOnce() enqueues newly-found candidates into the local portfolio queue even before any attempt happens.
  • The MINER_CODING_AGENT_PAUSED check still runs before the dry-run short-circuit, so a dry run of a paused config honestly reports the refusal rather than fabricating a "would succeed."

Scope note: the issue's acceptance criteria covers "every mutating command." This PR covers the two highest-stakes, remote-mutating commands, which needed real design work (deciding what "--dry-run" means given the existing --live semantics, and how far up the pipeline to short-circuit). The remaining ~10 commands (claim claim/release, queue next/done/claim-batch, state set, governor pause/resume, discover, orb export --enable) are simple, mechanical single-local-DB-write additions with none of attempt/loop's semantic questions — scoped as a follow-up PR so this one stays reviewable and its harder design decision doesn't get bundled with (or block) the easy ones.

Test plan

  • npx vitest run test/unit test/contract — 779 files / 15233 tests passing, 0 regressions (one pre-existing unrelated flake in agent-sdk-driver.test.ts, a real-git-worktree test timing out under full-suite parallel load — confirmed passing in isolation, untouched by this diff)
  • npm run build --workspace @jsonbored/gittensory-miner clean
  • npx tsc --noEmit clean
  • npm run docs:drift-check && npm run manifest:drift-check && npm run engine-parity:drift-check && npm run miner:env-reference:check
  • npm audit --audit-level=moderate — 0 vulnerabilities
  • Dedicated tests proving zero stores are opened under --dry-run (every open*/init* dependency spied and asserted never-called) for both commands, JSON + human-readable output, --dry-run --live reporting the live mode it would have used, and the pause-check-before-dry-run-short-circuit precedence

Advances #4847

Both are the two REMOTE-mutating commands in the miner CLI (attempt
opens a real git worktree, claims the issue, and can run a real
coding-agent driver that pushes/opens a PR; loop wraps attempt plus
its own portfolio-queue/ledger writes). --live's absence already
skipped the coding-agent driver, but every worktree/claim/ledger write
still happened regardless -- not the "zero actual writes, local or
remote" #4847 asks for.

--dry-run reports what a real invocation would target (repo, issue,
resolved coding-agent mode, base branch) and returns immediately,
BEFORE any store is opened -- a provable zero-write path, not just
"opened but didn't write to." For loop specifically, this also means
skipping discovery, since it enqueues newly-found candidates into the
local portfolio queue even before any attempt happens.

The MINER_CODING_AGENT_PAUSED check still runs before the dry-run
short-circuit, so a dry run of a paused config honestly reports the
refusal rather than fabricating a "would succeed."

Extending --dry-run to the remaining local-mutating commands (claim,
queue, state, governor, discover, orb export) is scoped as a
follow-up -- those are simple single-DB-write commands with none of
attempt/loop's semantic questions, and bundling them here would risk
the review getting bogged down in this PR's harder design decision.

Advances #4847
@superagent-security

Copy link
Copy Markdown
Contributor

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

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui d527bb2 Commit Preview URL

Branch Preview URL
Jul 13 2026, 01:20 AM

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.79%. Comparing base (05d1fb0) to head (d527bb2).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5527   +/-   ##
=======================================
  Coverage   94.79%   94.79%           
=======================================
  Files         566      566           
  Lines       45065    45085   +20     
  Branches    14675    14675           
=======================================
+ Hits        42718    42738   +20     
  Misses       1613     1613           
  Partials      734      734           
Flag Coverage Δ
shard-1 43.75% <0.00%> (-0.45%) ⬇️
shard-2 35.42% <50.00%> (-0.05%) ⬇️
shard-3 31.65% <0.00%> (-0.30%) ⬇️
shard-4 31.58% <0.00%> (-0.35%) ⬇️
shard-5 33.05% <12.50%> (+0.18%) ⬆️
shard-6 44.09% <54.16%> (+0.58%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/gittensory-miner/lib/attempt-cli.js 97.00% <100.00%> (+0.19%) ⬆️
packages/gittensory-miner/lib/cli.js 100.00% <ø> (ø)
packages/gittensory-miner/lib/loop-cli.js 93.95% <100.00%> (+0.29%) ⬆️
🚀 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 the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 13, 2026
@loopover-orb

loopover-orb Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-13 03:13:45 UTC

7 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This PR adds --dry-run to attempt and loop, short-circuiting before any store is opened, and closes issue #4847's zero-write acceptance criteria for the two highest-stakes remote-mutating commands. The implementation is careful about ordering: the MINER_CODING_AGENT_PAUSED check still runs before the dry-run short-circuit so a paused config honestly reports refusal rather than fabricating success, and tests assert zero calls to every store constructor (allocator, claim ledger, event ledger, attempt log, governor ledger, portfolio queue, run state). The console.log calls flagged by the external brief are the intended dry-run output mechanism, not debug leftovers, so that brief finding is a false positive.

Nits — 5 non-blocking
  • The dry-run message construction in loop-cli.js (`parsed.search !== null ? ... : parsed.targets.join(...)`) duplicates similar target-formatting logic likely present elsewhere in the file — verify there isn't already a shared helper to reuse.
  • attempt-cli.js's dry-run result includes `attemptId` even though no attempt occurs; confirm this is intentional (previewing what the real attemptId would be) rather than a leftover field copy-pasted from the real-result shape.
  • The PR description scopes out ~10 other mutating commands as a follow-up; worth confirming that follow-up issue exists/is linked before this lands, per repo convention of closing the full acceptance criteria or explicitly splitting it.
  • Consider a shared `formatDryRunTarget(parsed)` helper if similar target-string logic already exists in discover-cli or other commands, to avoid drift between --json and human-readable branches.
  • Double check attempt-cli.d.ts's `AttemptCliResult` dry_run variant doesn't need to omit `attemptId`/`mode` fields that aren't meaningful pre-run, for stronger type honesty.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.

2. Maintainer requires a linked issue — Link the relevant issue (for example `Closes #123`) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 44 registered-repo PR(s), 36 merged, 403 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 44 PR(s), 403 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, JavaScript, MDX, Shell, Solidity
  • Official Gittensor activity: 44 PR(s), 403 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

🟩 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 13, 2026
@JSONbored
JSONbored merged commit a952d43 into main Jul 13, 2026
19 checks passed
@JSONbored
JSONbored deleted the feat/attempt-loop-dry-run-4847 branch July 13, 2026 04:01
JSONbored added a commit that referenced this pull request Jul 13, 2026
Completes the --dry-run coverage started in #5527/#5532: governor pause/resume
(#4851) are the last local-mutating commands in the CLI. Reports what would
happen and returns before opening governor-state, matching every other
mutating command's dry-run pattern. governor status is read-only and needs no
dry-run.

Closes #4847
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. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant