GeezerVison is showing github.com — Native quota intelligence: burn-rate estimation and dynamic reprioritization to consume quota before reset · Issue #568 · developing-today-forks/opencode
Native quota intelligence: burn-rate estimation and dynamic reprioritization to consume quota before reset #568DescriptionProblem
Plan quotas that reset with unused headroom are wasted money; quotas blown early strand work. Today OpenCode's relationship to quotas is essentially binary — a model is available until it isn't. We want OpenCode to treat quotas as a managed resource with a deadline:
- Know each pool's current % used, its reset time, and its usage history.
- Know, empirically, how much of a window a typical session costs — e.g. a medium session on model X burns ~N% of the weekly window, a high/xhigh session ~M%.
- Then reprioritize across the board at a calculated rate: if projected usage won't consume a pool before reset, spend the surplus on quality — upgrade models and efforts. If it will overshoot, downgrade early instead of hitting the wall mid-session.
Examples of the intended upgrades when a pool is under-projected to be consumed:
- Sonnet medium → Sonnet xhigh, Opus medium, or Opus high (same provider, richer effort/model)
- DeepSeek → Muse Wonder (cross-provider substitution toward a pool with surplus)
- A small/fast model (e.g. Luna-class) → Sonnet or Flash High
…and the mirror-image downgrades when a pool is projected to exhaust early.
Desired behavior
- Routine quota telemetry: poll/refresh each pool's % used and next reset on a configurable interval; keep a history so rates are computed from data, not guesses. Stale data is marked stale and never treated as headroom.
- Per-session burn-rate model: from history, estimate the typical % of window consumed per session, bucketed by provider/model/effort (low/medium/high/xhigh). Cold start uses configured priors.
- Projection + controller loop: project end-of-window usage from remaining time, reset schedule, and recent burn rate. When the projection under-consumes by more than a configurable margin, raise effective weights/effort floors along a configured upgrade ladder (within a provider first, then across providers). When it over-consumes, step down the ladder. The goal: land near 100% at reset — never into PAYG.
- Safety bounds: upgrades never exceed configured per-pool ceilings; the final-reserve pool (OpenAI/Codex in our fleet) is excluded from burn-up behavior unless explicitly opted in; every controller action is logged with its inputs (projection, margin, ladder step) so a human can audit why a model was upgraded.
- Safe default bets: ship with a small set of conservative defaults (telemetry on, controller in observe/advise mode first, upgrades opt-in per pool) so this can land incrementally: measure → advise → act.
Non-goals / boundaries
Acceptance criteria
- Quota % + reset time are refreshed on an interval and persisted with history for every configured pool.
- Burn-rate estimates per model/effort bucket are computed from history and exposed for inspection.
- Given a scripted quota history and clock, the controller's projection and ladder decisions are deterministic and unit-tested (under-consume → upgrade; over-consume → downgrade; at-target → no change).
- Observe mode logs the action it would take without applying it; act mode applies it through the shared weight model.
- Controller never selects a PAYG route and never burns the configured final-reserve pool without explicit opt-in — covered by tests.
- All thresholds (poll interval, under/over margins, ladder steps, ceilings) are configuration.
Context
Fleet rule (Drew, 2026-10-27): use plan quotas all the way to 100%, then stop until reset (or until a fresh read shows an early reset). Companion issues: #566 (quota-% × session-type placement filtering) and #567 (time-of-day weighting with temporary priority windows). Activitydeveloping-today commented on Oct 27, 2026 dezren39 commented on Oct 27, 2026 Intake review
Fleet monitor intake pass (protocol §5), 2026-10-27. Verified still live: no merged PR implements or resolves this issue as of this run, and no duplicate open issue covers it.
Related: Related: companions #566 and #567 (same wave); fleet rule context (burn to 100%, then stop) is recorded in the body and in developing-today/code's quota registry.
Notes / risks / suggested approach: Risk: a reprioritization controller that acts on bad projections can strand work — the observe-mode-first criterion is the right guardrail; keep act mode behind explicit configuration as specified.
Labels normalized by this pass: kind/feature, status/needs-triage, priority/high, effort/l, meta/enriched.
dezren39 commented on Oct 29, 2026 Triage verdict (task 2144, 2026-10-28, main b5ac11f645)
Verdict: confirmed, partially built — foundation done, the #568 layer itself not implemented. Routed one scoped phase packet (task 3031); the acting controller stays on this epic.
What exists today:
What does NOT exist (verified by code search at HEAD):
Routing: task 3031 enqueued for the burn-rate building block only — a pure, derived-never-stored estimation module (QuotaSnapshot style) with cold-start priors, observe-only surfacing, and tests. The acting controller (dynamic reprioritization, ladders, ceilings) deliberately stays on this epic: the issue's own safety section wants observe/advise mode first, and the controller should be a Drew-visible go-ahead once burn-rate data exists.
dezren39 commented on Oct 29, 2026 Phase update (task 3031): PR #817 opened with the burn-rate estimation layer — QuotaBurnRate pure derivation (bucket → model → effort-prior → default-prior fallback chain, every estimate naming its source) plus observe-only burnRates in the route_usage tool. Laptop verification: 47/47 across the burn-rate, quota-snapshot, route-usage, route-tuning, and model-usage suites; core typecheck clean. Awaiting CI; will merge on green.
Still remaining on this epic after #817: the projection step (end-of-window usage from burn rate + reset schedule) and the acting controller with upgrade ladders and ceilings — intentionally not started; per this issue's safety defaults they follow observe-mode data and a Drew-visible go-ahead.
dezren39 commented on Oct 29, 2026 🤖 Agent note · phase delivered (burn-rate estimation)
- Agent: repo-queue-worker-shift-opencode-b (Lane B)
- Task: queue task 3031 — per-session burn-rate estimation from route history (observe-only)
- Delivered: PR feat(core): per-session burn-rate estimation for quota windows (#568) #817 merged 2026-10-29T04:53Z (merge commit
e9b3851d). QuotaBurnRate pure derivation in packages/core/src/quota-burn-rate.ts (bucketed by provider/model/effort, configured cold-start priors, derived never stored), surfaced observe-only via route_usage's burnRates; nothing in the selection path reads it.
- CI note: unit (linux) failed only on the known unrelated config-plugin watcher "loads skills" flake and unit (windows) only on the unrelated detached-PTY timing test — neither area is touched by PR feat(core): per-session burn-rate estimation for quota windows (#568) #817's 3 files. Typecheck, builds, affected-packages, nix-eval and standards all passed; laptop verification was 47/47 across the burn-rate/quota neighbour suites.
- Remaining on this epic: projection + the acting controller + upgrade/downgrade ladders — still gated on Drew's go-ahead after observe-mode data exists, per the epic's safe-defaults requirement.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|