feat(miner): consult selfLoopAutonomy in decideNextAction's pass-to-handoff step - #6581
Conversation
…andoff step decideNextActionWithReason had no notion of autonomy -- its own header called that out as a deferred gap, and a clean predicted-gate pass was the only path to handoff regardless of what the operator configured. JSONbored#6559 landed AmsPolicySpec.selfLoopAutonomy; this wires it into the decision and threads it end-to-end. The new check narrows step 3 of the precedence ladder ONLY: - "auto" (or unset): unchanged handoff, no requiresApproval. - "auto_with_approval": still a handoff, plus requiresApproval: true. - "observe": abandons with the new autonomy_observe_only reason, whose message notes a clean pass WAS reached and the configured level is what stopped it -- nothing went wrong, so it does not reuse any existing reason's wording. Steps 1 and 2 are untouched and still win over every level: rejectionSignaled disengages silently, and an ambiguous self-review abandons, even under "observe". Steps 4-6 (iteration ceiling, cost ceiling, no-progress) are likewise unchanged -- autonomy gates the pass->handoff transition and nothing else, never iteration count or write-action scope. autonomyLevel is optional on IterationState and treated as "auto" when unset, mirroring costCeilingReached's own precedent, so every pre-existing hand-built IterationState fixture keeps its exact prior decision. A regression test asserts an omitted field and an explicit "auto" produce deep-equal decisions. Plumbing follows rejectionSignaled's existing end-to-end path exactly: IterateLoopInput.autonomyLevel is copied verbatim into the per-iteration IterationState in runIterateLoopCore, and buildAttemptLoopInput maps amsPolicySpec.selfLoopAutonomy into it the same way it already maps maxIterations/maxTurnsPerIteration. Closes JSONbored#6560
|
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 #6581 +/- ##
==========================================
+ Coverage 93.62% 93.64% +0.01%
==========================================
Files 678 678
Lines 67959 67964 +5
Branches 18675 18678 +3
==========================================
+ Hits 63628 63642 +14
+ Misses 3360 3347 -13
- Partials 971 975 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-16 15:17:08 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver 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://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
decideNextActionWithReasonhad no notion of autonomy — its own header called that out as a deferred gap, and a clean predicted-gate pass was the only path tohandoffregardless of what the operator configured. AmsPolicySpec: add selfLoopAutonomy config field (default auto) #6559 landedAmsPolicySpec.selfLoopAutonomy; this wires it into the decision and threads it end-to-end."auto"(or unset) — unchangedhandoff, norequiresApproval."auto_with_approval"— still ahandoff, plusrequiresApproval: true(mirrorssettings/autonomy.ts'sautonomyRequiresApproval)."observe"— abandons with the newautonomy_observe_onlyreason, whose message notes a clean pass was reached and the configured level is what stopped it. Nothing went wrong here, so it deliberately does not reuseself_review_ambiguous's (or any other reason's) wording.rejectionSignaleddisengages silently and an ambiguous self-review abandons, even under"observe". Steps 4-6 (iteration ceiling, cost ceiling, no-progress) are likewise untouched: autonomy gates the pass→handoff transition and nothing else, never iteration count or write-action scope.autonomyLevelis a true no-op when unset. It's optional onIterationStateand treated as"auto"whenundefined, mirroringcostCeilingReached's own precedent, so every pre-existing hand-builtIterationStatefixture across the suite keeps its exact prior decision.rejectionSignaled's existing end-to-end path exactly:IterateLoopInput.autonomyLevelis copied verbatim into the per-iterationIterationStateinrunIterateLoopCore, andbuildAttemptLoopInputmapsamsPolicySpec.selfLoopAutonomyinto it the same way it already mapsmaxIterations/maxTurnsPerIteration.Closes #6560
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #6560.Validation
git diff --checknpm run typecheck— 0 errorsnpm run test:coveragelocally;codecov/patchrequires ≥99% of changed lines AND branches — verified line-by-line against this diff's exact added lines initerate-policy.ts: zero uncovered statements, zero uncovered branches (all three autonomy levels plus the unset arm are exercised).npm run build --workspace @loopover/enginenpm run test --workspace @loopover/engine— 588/588 pass (includes the newiterate-policy.test.tsautonomy cases)iterate-policy/iterate-loop/buildAttemptLoopInput— 137/137 passnpx eslinton every changed file — 0 errorsIf any required check was skipped, explain why:
npm audit --audit-level=moderatecould not complete in this environment — the registry audit endpoint was unreachable (npm error audit endpoint returned an error), not a reported advisory. This PR adds no dependencies.Safety
Notes for review
Dual test suites, per the engine convention and the issue's own Codecov caveat:
test/unit/engine-iterate-policy-autonomy.test.ts(the vitest mirror importingsrc/, which is whatcodecov/patchactually measures forpackages/loopover-engine/src/**) andpackages/loopover-engine/test/iterate-policy.test.ts(node:test, required to keepnpm run test --workspace @loopover/enginegreen intest:ci).One necessary test update:
miner-attempt-input-builder.test.ts's exhaustivetoEqualon the builtIterateLoopInputnow expects the newautonomyLevelfield (18 keys vs 17). That assertion is intentionally exact, so it correctly caught the addition.The stale
AUTONOMY DIAL (not yet wired)header comment initerate-policy.tsis updated to describe the wiring it now documents.