feat(miner): build the autonomous supervising loop#5303
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 9c4d41f | Commit Preview URL Branch Preview URL |
Jul 12 2026, 01:38 PM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5303 +/- ##
=======================================
Coverage 94.37% 94.37%
=======================================
Files 474 474
Lines 40128 40128
Branches 14631 14631
=======================================
+ Hits 37869 37871 +2
+ Misses 1583 1582 -1
+ Partials 676 675 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-12 13:45:23 UTC
⏸️ Suggested Action - Manual Review
Review summary Blockers
Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk 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.
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.
|
Closes #5135 The final piece of Wave 3.5's Miner AMS epic (#5130): a real discover -> claim -> attempt -> observe -> re-enter loop, composing every existing primitive (runDiscover, runAttempt, the run-loop boundary gate, loop-reentry, loop-closure) into an actual repeat- until-halted CLI command. No daemon/watch pattern existed anywhere in this package before this change. New pieces: - lib/loop-cli.js: `gittensory-miner loop` -- fails closed if governor state can't be loaded; checks the kill switch and a real per-repo policy-aware run-loop boundary gate before every claim; runs a real attempt via runAttempt's onResult hook; on a submitted outcome, polls the real PR disposition and records it; tracks real in-memory convergence history and persists real GovernorCapUsage (turnsTaken from runMinerAttempt's own totalTurnsUsed, elapsedMs from wall-clock) via governor-state.js's saveCapUsage -- previously uncalled anywhere. A permanent AI-usage-policy block marks its item done instead of requeuing it forever; any other non-submitted outcome requeues, and a genuinely stuck item halts the whole run via real non-convergence detection rather than looping forever. - lib/pr-disposition-poller.js: polls a PR's real merge/close disposition (distinct from ci-poller.js's check-run polling) and classifies it into loop-reentry's merged/disengaged/other vocabulary -- the missing piece pr-outcome.js's store had no real caller for. - attempt-cli.js: surfaces runMinerAttempt's real loopResult turn usage (totalTurnsUsed/iterationsUsed) through options.onResult, so the loop can save genuine cap usage instead of a fabricated number. Documented, deliberate gaps (not silently papered over): convergence and cap-usage history are scoped to this loop process's own lifetime (cap usage itself persists across restarts; per-issue convergence counters do not -- a durable version needs attempt-log.js to grow a repo+issue index, a separate schema change); the loop's kill-switch and boundary checks are global-scope only, matching runAttempt's own existing gap (a per-repo `.gittensory-miner.yml` pause resolver now exists via #5255 but isn't wired into either call site yet).
63be71c to
9c4d41f
Compare
Summary
gittensory-miner loop, the final piece of Wave 3.5's Miner AMS epic (Epic: Miner Wave 3.5 — Wire the autonomous loop end-to-end #5130): a real discover → claim → attempt → observe → re-enter loop composing every existing primitive (runDiscover,runAttempt, the run-loop boundary gate, loop-reentry, loop-closure) into an actual repeat-until-halted CLI command. No daemon/watch pattern existed anywhere in this package before this change.pr-disposition-poller.js: polls a PR's real merge/close disposition (distinct fromci-poller.js's check-run polling) and classifies it into loop-reentry'smerged/disengaged/othervocabulary — the missing piecepr-outcome.js's store had no real caller for.attempt-cli.jsto surfacerunMinerAttempt's realloopResultturn usage (totalTurnsUsed/iterationsUsed) throughoptions.onResult, so the loop can save genuineGovernorCapUsageviagovernor-state.js'ssaveCapUsage— previously uncalled anywhere in the codebase — instead of a fabricated number.Acceptance criteria (#5135)
--max-cycles/--cycle-delay-msfor bounded/paced runs).Design notes
attemptLoopReentry's own dequeue is the authoritative claim for every cycle after the first (its own doc: "if allowed -- dequeues the next candidate") — the loop does not also callportfolioQueue.dequeueNext()on a successful reentry, which would silently double-claim.governor-state.js; per-issue convergence counters do not — a durable version needsattempt-log.jsto grow a repo+issue index, a separate schema change); the loop's kill-switch and boundary checks are global-scope only, matchingrunAttempt's own existing gap (a per-repo.gittensory-miner.ymlpause resolver now exists via feat(miner): resolve the real per-repo MinerGoalSpec from a cloned worktree (#5132) #5255 but isn't wired into either call site yet).Test plan
npx vitest run test/unit— 733 files / 14,538 tests passnpx tsc --noEmit -p . --incremental false(fresh, no cache) — cleannpm run test:engine-parity— passnpm run --prefix packages/gittensory-miner build(allnode --checkentries, including the two new files) — passgit diff --check— clean