Skip to content

Decide fate of attempt-metering.ts: wire real per-attempt budget enforcement, or remove it #5395

Description

@JSONbored

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:

  1. 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.
  2. 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:

  • A clear decision is recorded (wire vs. remove) and the losing mechanism's dead code/tests are cleaned up.
  • If wired: a single iteration that blows its own per-attempt budget aborts that attempt immediately, not just at the next run-loop boundary check.

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.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions