Context
loop-cli.js maintains its own separate, in-memory convergenceHistory Map for the autonomous loop daemon's run-loop-boundary gate -- distinct from, and now redundant with, the real, SQLite-persisted attempt-history portfolio-queue.js's getAttemptHistory already provides (#5654). loop-cli.js's own header still documents this as a known gap: "convergence/cap-usage history is IN-MEMORY, scoped to this loop process's own lifetime... a durable version needs attempt-log.js to grow a repo+issue index." That durable version now exists -- just via a different store (portfolio-queue.js, already real and persisted) than the header anticipated (attempt-log.js).
Left as-is, a loop-daemon restart (crash, deploy, systemd bounce) silently resets convergence/consecutive-failure counters for every in-flight item, weakening the stuck-loop detector exactly at the point -- a real restart -- it matters most.
Dependencies
None -- builds directly on #5654's already-shipped getAttemptHistory.
Requirements
- Replace
loop-cli.js's in-memory convergenceHistory Map with real reads from portfolio-queue.js's getAttemptHistory -- the same function attempt-cli.js's own buildAttemptGovernorContext already consumes, so the loop daemon and a one-shot attempt invocation share one real source of truth instead of two independent counters (one persisted, one not).
- Remove the stale "DOCUMENTED GAP" header comment once the in-memory Map is gone.
- Out of scope: changing the run-loop-boundary gate's own decision thresholds (
DEFAULT_AMS_POLICY_SPEC.convergenceThresholds) -- only its data source changes.
Deliverables / Acceptance Criteria
Test Coverage Requirements
This PR must ship with full test coverage for every changed line and branch -- the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced.
Expected Outcome
The non-convergence detector's cross-cycle memory survives a real process restart, closing a real durability gap in the autonomous loop daemon specifically (a one-shot attempt invocation is unaffected -- it already reads the real store via #5654).
Links & Resources
Context
loop-cli.jsmaintains its own separate, in-memoryconvergenceHistoryMap for the autonomous loop daemon's run-loop-boundary gate -- distinct from, and now redundant with, the real, SQLite-persisted attempt-historyportfolio-queue.js'sgetAttemptHistoryalready provides (#5654).loop-cli.js's own header still documents this as a known gap: "convergence/cap-usage history is IN-MEMORY, scoped to this loop process's own lifetime... a durable version needs attempt-log.js to grow a repo+issue index." That durable version now exists -- just via a different store (portfolio-queue.js, already real and persisted) than the header anticipated (attempt-log.js).Left as-is, a loop-daemon restart (crash, deploy, systemd bounce) silently resets convergence/consecutive-failure counters for every in-flight item, weakening the stuck-loop detector exactly at the point -- a real restart -- it matters most.
Dependencies
None -- builds directly on #5654's already-shipped
getAttemptHistory.Requirements
loop-cli.js's in-memoryconvergenceHistoryMap with real reads fromportfolio-queue.js'sgetAttemptHistory-- the same functionattempt-cli.js's ownbuildAttemptGovernorContextalready consumes, so the loop daemon and a one-shotattemptinvocation share one real source of truth instead of two independent counters (one persisted, one not).DEFAULT_AMS_POLICY_SPEC.convergenceThresholds) -- only its data source changes.Deliverables / Acceptance Criteria
loop-cli.js's run-loop-boundary gate reads real, persisted convergence history viagetAttemptHistoryconvergenceHistoryMap and its stale header comment are removedTest Coverage Requirements
This PR must ship with full test coverage for every changed line and branch -- the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced.
Expected Outcome
The non-convergence detector's cross-cycle memory survives a real process restart, closing a real durability gap in the autonomous loop daemon specifically (a one-shot
attemptinvocation is unaffected -- it already reads the real store via #5654).Links & Resources
packages/gittensory-miner/lib/loop-cli.js(the in-memoryconvergenceHistoryMap and its own header comment)packages/gittensory-miner/lib/portfolio-queue.js'sgetAttemptHistory(Track real per-issue attempt-history on the portfolio queue, feed the Governor's convergenceInput #5654)