GeezerVison is showing github.com — feat(quota-plane): OpenCode pools consume quota-current — measured placement, rotation, demotion · Issue #1157 · developing-today/code
feat(quota-plane): OpenCode pools consume quota-current — measured placement, rotation, demotion #1157DescriptionPriority P1 — order 4. Horizon: Week. Design: quota-plane-design-2026-10-26.md (usage-billing-hub goal files), Stage 2. Parent context: epic #1047. (§1, consumption)
Wire the OpenCode pools to consume quota-current for automated decisions: placement reads the fresh state (<=15-minute-old for adapter-covered pools once the gatherer is live; the measurement gate tightens accordingly); ordering = burn-by-expiry (soonest reset first, OpenAI final reserve); >=85% caution and wall exclusion applied from MEASURED values, complementing the fork's existing error-based demotion (>=3 quota errors/4h -> weight x0.01) so pools demote before errors happen. Never-funds rule unchanged: a walled plan pool rotates or stops, never PAYG.
Acceptance: a placement decision demonstrably changes when quota-current changes (test or staged demo); guidance output cites the measuredAt it used.
Acceptance criteria
- OpenCode pool placement reads quota-current (<=15-minute-old for adapter-covered pools once the gatherer is live) and a placement decision demonstrably changes when quota-current changes (test or staged demo) — restating the body's Acceptance section as the criteria section.
- Guidance output cites the
measuredAt it used.
- Ordering is burn-by-expiry (soonest reset first, OpenAI final reserve); measured demotion complements the fork's error-based demotion, and the never-funds rule is unchanged (a walled plan pool rotates or stops, never PAYG).
Activitydeveloping-today commented on Oct 27, 2026 dezren39 commented on Oct 27, 2026 REVIEW FINDING (2026-10-26, fork side): the fork's plan store (packages/core/src/model-plan.ts) is a plain-JSON file in OpenCode's data dir that "the tools here and OpenChamber read and write the same file" — plan_info is the in-session tool over it. Two facts for this issue: (1) QuotaWindow models ENTITLEMENTS (limit, windowHours, resetRule/resetAt) — it has no live "used" field; live usage is route telemetry (route_usage / model-usage), so the consumption contract must join measured usage (from the gatherer) with plan windows, not expect the plan store to hold readings. (2) Known fork bug developing-today-forks/opencode#550: route_usage silently omits plan quota windows that have no windowHours (monthly/reset-rule windows never appear) — consumption work must not build on route_usage output for monthly windows until that is fixed. dezren39 commented on Oct 28, 2026 Intake review
- Related: epic epic(usage-hub): SaaS/cloud services completion — v2 live collectors, daily console reads, v3 reconciliation #1047 (quota plane, Stage 2, order 4 — the consumption side the adapters feat(quota-plane): adapter — ClinePass via dashboard session token #1159/feat(quota-plane): adapter — OpenCode Go console, per-workspace windows #1161/feat(quota-plane): adapter — Claude via claude.ai session (usage API) #1163/feat(quota-plane): adapter — Command Code via CLI/app credential #1165 feed); design
quota-plane-design-2026-10-26.md (usage-billing-hub goal files, §1).
- Still live: a merged-PR search found no resolving PR; the issue carried only
meta/follow-up before this pass.
- Notes: the body states "Priority P1" in prose — normalized here to
priority/high. Its Acceptance line has been expanded into the appended ## Acceptance criteria section (original body preserved verbatim above it). One body detail is stale and a worker should reconcile it before implementing: the ">=85% caution" zone was retired by Drew on 2026-10-27 — pools are now used to 100%, and at a KNOWN 100% the pool is closed until reset or a fresh read shows it dropped (see the POOL MAP in the provider-quota registry). The measured-demotion intent stands; the 85% threshold does not.
- Risks: this is the consumer that makes bad adapter data dangerous — zero-on-expiry or stale reads would demote healthy pools; the measuredAt citation in guidance output is the audit trail that catches it.
- Suggested approach: wire consumption behind the gatherer's freshness stamp, prove the decision-flip with a staged quota-current change, and update the caution threshold to the current 100%-wall rule in the same pass.
- Labels normalized by fleet monitor:
kind/feature, priority/high (P1 in body), effort/m, source/human, status/needs-triage, meta/enriched.
dezren39 commented on Oct 29, 2026 DREW (2026-10-29, main chat): the demotion half of this issue is now a very-high-priority requirement, stated plainly — providers whose quota is KNOWN 100% used (reset not imminent) move OUT of the routes until reset or a fresh good read pulls them back in; failing targets also come out, with a warning and a retry policy. OpenCode-side mechanism: developing-today-forks/opencode#6 (raised to priority/critical tonight — credential.activate failover + route removal/promotion), reading the shared QuotaSnapshot contract (opencode#587, adopted 2026-10-29). This issue remains the quota-plane half: quota-current must carry the known-100% / good-again signals those moves consume. dezren39 commented on Nov 3, 2026 🤖 Agent note · done
Triage verdict — task 7207, verified at origin/main e425b6a (2026-11-03)
CONFIRMED STILL LIVE, with two acceptance points superseded by Drew's later quota doctrine. Re-verified fresh this run (the task 2437 verdict of 2026-11-02 stands in substance, with one correction):
- Producer side is live: the gatherer writes
quota-current.json; adapters exist in pm-stack/aggregator/src/ (quota-current.ts, quota-gather-map.ts, clinepass-adapter.ts, token-adapter.ts).
- Correction to the task 2437 note: the aggregator does read quota-current now — for display.
overlayQuotaCurrent (quota-current.ts:342) overlays it onto the /quota view (README quota table, line 473). The README's "Remaining hop: the aggregator does not read quota-current.json yet" text (line ~607) is stale — it predates the overlay; the still-missing hop is decision consumption, not display.
- No placement consumer exists: nothing in this repo reads quota-current to make a placement/rotation/demotion decision. Placement lives in the opencode fork's routing/plan store, i.e. the implementation surface is developing-today/opencode, not this repo. The fork's 429-failover piece (opencode issue Bump build/buck/preludes/buck2-prelude from
3a02ea3 to 4371899 #6) is CLOSED; measured placement/demotion is the part that remains.
- Stale acceptance — doctrine superseded: the body's ">=85% caution" rule was retired by Drew 2026-10-27/29: pools are used to ~100% at reset; a pool at a KNOWN 100% is closed until reset or a fresh good read, and a failed/stale quota read never idles a pool or stops dispatch (2026-10-30). Any implementation must follow the current doctrine, not the 85% text. The never-funds rule is unchanged.
- Ordering/blockers: this is a cross-repo set whose origin is this issue — implementation belongs on the opencode side (routing weights from measured quota-current, guidance citing
measuredAt), with the code side owing only the stale README correction above. No code-repo fix task is enqueued from this triage: the work is not in this repo, and a per-repo duplicate is exactly what the set rule forbids. Issue feat(quota-plane): OpenCode pools consume quota-current — measured placement, rotation, demotion #1157 stays open as the set's tracking home under epic issue epic(usage-hub): SaaS/cloud services completion — v2 live collectors, daily console reads, v3 reconciliation #1047.
dezren39 commented on Nov 8, 2026 Partial verification — staying open (2026-11-07 done-task-only audit, tracking: #7016).
Queue task(s) [7207, 2437] were marked done, and some work did land:
No merged change closes this issue's full scope, so the done status is not treated as completion. Remainder re-queued as triage task 11547. dezren39 commented on Nov 8, 2026 🤖 Agent note · done (triaged — verdict unchanged from task 7207; one docs remainder routed)
Verdict: still live, and the task 7207 triage (2026-11-03) stands in full — re-verified fresh at origin/main 801ceb9 this shift.
- Producer + display are live in this repo: the gatherer writes
quota-current.json, and the aggregator does read it for display — overlayQuotaCurrent at pm-stack/aggregator/src/quota-current.ts:352, consumed in src/sources/live.ts (line 1330, Stage 2 / issue feat(quota-plane): quota-gatherer service in the PM stack — 15-minute tick, quota-current contract #1151). No placement/rotation/demotion decision consumer exists in this repo — that part is unchanged.
- The implementation remainder lives on the opencode side and is already tracked there: developing-today-forks/opencode issue docs(repo): use one worker branch name across the workflow #566 ("Quota-aware session placement: filter by quota % and session type (root vs subsession)") is OPEN,
status/in-progress, queue/queued, effort/l. Per the cross-repo set rule, no per-repo duplicate is filed from here; issue feat(quota-plane): OpenCode pools consume quota-current — measured placement, rotation, demotion #1157 stays open as the set's tracking home under epic epic(usage-hub): SaaS/cloud services completion — v2 live collectors, daily console reads, v3 reconciliation #1047 until the opencode-side work lands.
- Doctrine corrections from task 7207 still bind: the body's ">=85% caution" text is superseded by Drew's 2026-10-27/29/30 doctrine (pools used to ~100% at reset; a KNOWN 100% pool is closed until reset or a fresh good read; a failed/stale read never idles a pool or stops dispatch; never-funds unchanged). Any implementation follows the current doctrine, not the 85% text.
- One code-repo remainder, routed as a fix packet:
pm-stack/aggregator/README.md:668 still says "Remaining hop: the aggregator does not read quota-current.json yet" — stale since the overlay landed, and flagged as owed by task 7207. That one-paragraph docs correction is the only remainder in this repo; it is enqueued as a small_fix follow-up from this triage (see the completion note / queue), scoped to the README paragraph only.
No other code-repo work remains on #1157. Re-triage only when opencode#566 lands (then verify the set closes) or the quota doctrine changes again.
developing-today commented on Nov 8, 2026 🤖 Agent note · done (queue task 12436, lane code-v, 2026-11-07)
The code-repo remainder from triage task 11907 is landed: PR #7296 (docs(aggregator): correct stale quota-current README claim) MERGED as 688f44dbe0b9a5716a948438020dd2831af38a19.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|