fix(engine): correct the iterate-policy ceiling field docs to match the real precedence - #10131
Conversation
…he real precedence
IterationState.maxIterations and costCeilingReached both documented an
unconditional abandon ("regardless of self-review outcome"), but
decideNextActionWithReason's own numbered precedence list puts the
selfReview.kind === 'pass' branch (step 3) AHEAD of both ceilings (steps 4-5).
So a clean predicted-gate pass at or past a ceiling still hands off, which the
field docs said was impossible -- and the test suite had no case combining a pass
with a reached ceiling, so the precedence between step 3 and steps 4-5 was unpinned.
Correct both field docs to state the real contract (the ceiling abandons only when
the self-review has not reached a clean pass; a clean pass still hands off, subject
to autonomyLevel) and point at the precedence list as the one canonical statement.
The precedence list, decideNextAction behaviour, reason strings and autonomyLevel
handling are all unchanged -- this is a doc correction plus precedence-pinning tests.
Closes JSONbored#9997
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-31 08:50:28 UTC
Review summary Nits — 2 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.
|
|
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 #10131 +/- ##
==========================================
- Coverage 91.95% 91.95% -0.01%
==========================================
Files 931 931
Lines 113937 113943 +6
Branches 27505 27505
==========================================
+ Hits 104774 104776 +2
Misses 7863 7863
- Partials 1300 1304 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
What & why
IterationState's two ceiling fields documented an unconditional abandon:But
decideNextActionWithReason's own numbered precedence list — twelve lines down — puts theselfReview.kind === "pass"branch (step 3) ahead of both ceilings (steps 4-5). The code matches the list, not the field doc: thepassbranch returns"handoff"before control ever reaches theiterationNumber >= maxIterationsorcostCeilingReachedchecks. Soreturns
"handoff"— which the field doc calls impossible.costCeilingReached's doc had the same contradiction, anditerate-policy.test.tshad no case combining apasswith a reached ceiling, so the precedence between step 3 and steps 4-5 was unpinned — a future reordering would break nothing and silently discard a passing attempt.The code's ordering is the correct one (the module header says the ceilings exist "so a stuck loop stops wasting turns … chasing a submission that was never going to land" — which does not describe an attempt that has just reached a clean predicted-gate pass). The defect is that the field docs lie to a reader and the precedence is untested.
The fix
Correct both field docs to state the real contract — the ceiling abandons only when the self-review has not reached a clean pass; a clean pass at or past the ceiling still hands off (subject to
autonomyLevel) — and point both atdecideNextActionWithReason's numbered precedence list as the one canonical statement of the ladder. The phrase "regardless of self-review outcome" is removed frommaxIterations.Unchanged: the precedence list,
decideNextActionWithReason/decideNextActionbehaviour,AbandonReason, every reason string, and theautonomyLevelhandling are all byte-identical — this is a doc correction plus precedence-pinning tests, no behaviour change.Tests
packages/loopover-engine/test/iterate-policy.test.ts): a clean pass at the iteration ceiling, with the cost ceiling reached, and with both reached each still returns{ action: "handoff" }with noabandonReason; and the two branches that DO win over a pass still do (rejectionSignaled→rejection_signaled;autonomyLevel: "observe"at a reached ceiling →autonomy_observe_only, notmax_iterations_reached) — pinning the ladder end to end.test/unit/engine-iterate-policy-autonomy.test.ts, the vitest mirror that imports the engine src directly for codecov): the same pass-precedes-ceiling assertions.Validation
node:testsuite (26 green) and the root vitest mirror (14 green).npm run typecheckclean for these files;npm run engine-parity:drift-checkpasses;npm run dead-exports:checkclean.git diff --checkclean; no schema/migration/generated-artifact change.Closes #9997