Skip to content

Persist governor cross-attempt state (rate-limit, budget, convergence, reputation, self-plagiarism) #5134

Description

@JSONbored

Problem: Every governor-*.js wrapper (governor-write-rate-limit.js, governor-chokepoint.js, budget/turn/termination caps, convergence/reputation/self-plagiarism throttles) is a pure in/out transform over caller-supplied state — confirmed by reading the code directly, not assumed. governor-chokepoint.js:34-51 and governor-write-rate-limit.js compute and return rateLimitBuckets/backoffAttempts, but nothing writes them to disk anywhere in packages/gittensory-miner/lib/*.js. This means the mutable counters that must gate the next decision reset to zero on every process start. Contrast: governor-ledger.js does have real SQLite persistence (an append-only governor_events audit table, governor-ledger.js:69-96, chmod 0600) reachable via governor list — decisions are durably logged, but the state that should have produced a different decision on attempt N+1 isn't.

Area: AMS / Miner / Safety

Proposal: Add a real persistence layer for the governor's mutable counters (rate-limit buckets, backoff attempts, budget/turn/termination running totals, convergence history, reputation/self-plagiarism throttle state), mirroring governor-ledger.js's existing SQLite pattern — loaded at the start of each attempt, saved at the end, keyed the same way the ledger already keys its own rows.

Deliverables:

  • Governor counters that survive across separate CLI invocations, not just within a single process's lifetime.

Acceptance criteria:

  • Two sequential CLI invocations correctly accumulate rate-limit/budget state — a limit tripped in invocation 1 is honored (and observable) in invocation 2.
  • The existing governor-ledger.js audit trail remains the authoritative history log; this issue adds the decision-input state, not a second history log.
  • evaluateGovernorChokepoint's existing precedence ladder (kill-switch > pause > dry-run > rate-limit > budget/turn/termination > non-convergence > reputation > self-plagiarism > allow) is unchanged — this issue only makes its optional input fields durable, it does not alter the chokepoint's own logic.

Boundaries:

  • This is the safety-critical core of this whole gap-fill batch — needs its own dedicated review, not just a passing test.

Part of #5130.

Metadata

Metadata

Assignees

Labels

gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions