Problem: attempt-metering.ts (packages/gittensory-engine/src/miner/, built for #4311, closed in Wave 2) is a real, tested primitive for per-attempt token/turn/wallclock/cost accumulation with mid-attempt budget-abort capability (accumulateAttemptUsage/meterAttemptUsage/evaluateAttemptBudget). It has zero callers anywhere outside its own file and the public barrel re-export — no attempt has ever actually been metered or budget-aborted by it. Separately, #5356/#5382 (same-day follow-up work) built a NARROWER, independent mechanism: iterate-loop.ts now sums real per-iteration costUsd into IterateLoopResult.totalCostUsd, which loop-cli.js uses to increment GovernorCapUsage.budgetSpent — but this only tracks cumulative cost AFTER the fact (for the run-loop boundary gate to check between cycles), it has no mid-attempt abort capability and doesn't track tokens or wall-clock time per iteration the way attempt-metering.ts was designed to.
There are now two non-overlapping, partially-redundant cost-tracking mechanisms in the codebase: one fully built but never wired in, one narrower but actually shipped.
Area: Miner / Governor
Proposal: Pick one of two paths and close this issue accordingly:
- Wire it in properly — have
iterate-loop.ts's per-iteration driver-result handling call accumulateAttemptUsage/meterAttemptUsage for real, and consult evaluateAttemptBudget to allow a mid-attempt abort (not just a between-cycles run-loop halt) when a single attempt's own budget is exceeded. This gives genuine token/wall-clock accounting the current totalCostUsd wiring doesn't have.
- Remove it as legacy — if the narrower
totalCostUsd/budgetSpent mechanism is judged sufficient, delete attempt-metering.ts and its exports rather than carrying a fully-built, fully-tested, never-executed module indefinitely.
Deliverables: Either a real production caller for attempt-metering.ts's exports, or their removal — not indefinite coexistence with the newer mechanism.
Acceptance criteria:
Boundaries:
- This is a design decision issue as much as an implementation one — flag for maintainer discussion before picking a direction, since it affects the governor's own cap-enforcement architecture.
Problem:
attempt-metering.ts(packages/gittensory-engine/src/miner/, built for #4311, closed in Wave 2) is a real, tested primitive for per-attempt token/turn/wallclock/cost accumulation with mid-attempt budget-abort capability (accumulateAttemptUsage/meterAttemptUsage/evaluateAttemptBudget). It has zero callers anywhere outside its own file and the public barrel re-export — no attempt has ever actually been metered or budget-aborted by it. Separately, #5356/#5382 (same-day follow-up work) built a NARROWER, independent mechanism:iterate-loop.tsnow sums real per-iterationcostUsdintoIterateLoopResult.totalCostUsd, whichloop-cli.jsuses to incrementGovernorCapUsage.budgetSpent— but this only tracks cumulative cost AFTER the fact (for the run-loop boundary gate to check between cycles), it has no mid-attempt abort capability and doesn't track tokens or wall-clock time per iteration the wayattempt-metering.tswas designed to.There are now two non-overlapping, partially-redundant cost-tracking mechanisms in the codebase: one fully built but never wired in, one narrower but actually shipped.
Area: Miner / Governor
Proposal: Pick one of two paths and close this issue accordingly:
iterate-loop.ts's per-iteration driver-result handling callaccumulateAttemptUsage/meterAttemptUsagefor real, and consultevaluateAttemptBudgetto allow a mid-attempt abort (not just a between-cycles run-loop halt) when a single attempt's own budget is exceeded. This gives genuine token/wall-clock accounting the currenttotalCostUsdwiring doesn't have.totalCostUsd/budgetSpentmechanism is judged sufficient, deleteattempt-metering.tsand its exports rather than carrying a fully-built, fully-tested, never-executed module indefinitely.Deliverables: Either a real production caller for
attempt-metering.ts's exports, or their removal — not indefinite coexistence with the newer mechanism.Acceptance criteria:
Boundaries: