GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(core): QuotaSnapshot derivation with a single staleness contract (design #587, phase 1) · Issue #588 · developing-today-forks/opencode

feat(core): QuotaSnapshot derivation with a single staleness contract (design #587, phase 1) #588

New issue
Copy link
New issue
Copy link
Closed
Closed
feat(core): QuotaSnapshot derivation with a single staleness contract (design #587, phase 1)#588
Copy link
Labels
app/corePackage: core (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/featureNew feature or capability requestpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobstatus:done

Description

@dezren39
dezren39
opened on Oct 27, 2026
Issue body actions

Sub-issue of the design issue #587 (one quota signal, three consumers). Phase 1 of that design — the phase with no open design question inside it. The design issue carries user/review for the overall layering decision; this phase is a pure, behaviour-free derivation that is useful under either decision outcome (it only formalises what windowReport() already computes for reporting).

Task

Add a QuotaSnapshot derivation in packages/core: a pure function that, given the configured plans (packages/core/src/model-plan.ts) and recorded usage (the inputs packages/core/src/model-usage.ts → windowReport() already uses), produces one snapshot per plan window:

interface QuotaSnapshot {
  planID: string
  window: string
  providerID: string
  percent: number | null        // null = unknown, never treated as headroom
  remaining: number | null
  resetAt: number | null        // epoch ms when derivable from the window's reset rule; null otherwise
  observedAt: number
  stale: boolean                // observedAt older than the configured max age
}

Contract rules (from #587):

  • One configured max-age defines stale, shared by all future consumers (per-plan override allowed, one definition).
  • A window with no limit, or no derivable usage (e.g. no windowHours — see fix(core): route_usage silently omits plan quota windows that have no windowHours — monthly/reset-rule windows never appear #550), yields percent: null — never a guessed number.
  • Pure and deterministic: same plan + usage inputs + clock ⇒ same snapshots. No I/O, no selection-path changes, nothing in model-route.ts reads snapshots yet.

Acceptance criteria

  • Snapshot derivation exists in packages/core alongside model-usage.ts, reusing windowReport()'s percent/remaining computation rather than duplicating it.
  • Unit tests (run from packages/core, per repo AGENTS.md) cover: normal window (percent + remaining correct against a hand-computed fixture), missing limit → percent: null, missing windowHours → percent: null, observation older than max-age → stale: true, fresh observation → stale: false, reset rule that yields a resetAt and one that does not (resetAt: null).
  • No behaviour change anywhere: no routing, gating, or UI code consumes snapshots in this issue.
  • bun run check from the repo root passes (or failures are pre-existing on devtoday/main and named in the closing note).

Context

  • Design: design(core): one quota signal, three consumers — shared QuotaSnapshot and weight-layer contract for #566/#567/#568 #587 and files/designs/opencode-quota-signal-routing.md in the keep-the-four-repos-healthy goal workspace.
  • Consumers waiting on this contract: Quota-aware session placement: filter by quota % and session type (root vs subsession) #566 (placement gates), Native quota intelligence: burn-rate estimation and dynamic reprioritization to consume quota before reset #568 (burn-rate controller).
  • Evidence: model-usage.ts windowReport() already derives percent/remaining/resetRule for reporting; model-plan.ts owns QuotaWindow (limit, unit, windowHours, reset rule).

Activity

Next
  1. dezren39
    added
    kind/featureNew feature or capability request
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/corePackage: core (pkgs/ or apps/ in this repo)
    on Oct 27, 2026
  2. developing-today commented on Oct 27, 2026

    @developing-today
    developing-todayBot
    on Oct 27, 2026 – with developing.today
    More actions

    OPENCODE-96

  3. dezren39
    added
    effort/mMedium: expected under 1 day of work
    source/design-architectFiled by the repo design architect job
    on Oct 27, 2026
  4. dezren39
    added a parent issue on Oct 27, 2026
    • design(core): one quota signal, three consumers — shared QuotaSnapshot and weight-layer contract for #566/#567/#568 #587
  5. dezren39 commented on Oct 27, 2026

    @dezren39
    dezren39
    on Oct 27, 2026
    Author
    More actions

    🤖 Agent note · filed

    • Agent: repo design architect job (repo-design-architect, split rotation — opencode pass)
    • Session / ID: cron repo-design-architect run 2026-10-27 08:54 CDT; queue packet dedupe repo-health:v1:triage:developing-today/opencode:issue:588
    • Found via: filed this run
    • Task: Phase 1 implementation issue of design design(core): one quota signal, three consumers — shared QuotaSnapshot and weight-layer contract for #566/#567/#568 #587, filed as its sub-issue and enqueued to repo-health-opencode-pilot with queue/queued.
    • Expectation: effort/m; "done" = QuotaSnapshot derivation + staleness contract landed with tests, no behaviour change.
    • Links: design design(core): one quota signal, three consumers — shared QuotaSnapshot and weight-layer contract for #566/#567/#568 #587
  6. dezren39
    added
    queue/claimedA queue worker has claimed the task for this item
    work/assignedAn agent holds this item via the queue (claimed task)
    status/in-progressActively being worked
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 27, 2026
  7. 2 remaining items

  8. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedA queue worker has claimed the task for this item
    on Oct 27, 2026
  9. dezren39 commented on Oct 27, 2026

    @dezren39
    dezren39
    on Oct 27, 2026
    Author
    More actions

    Phase 1 implemented in PR #615: new packages/core/src/quota-snapshot.ts derives one QuotaSnapshot per plan window reusing windowReport() (no duplicated arithmetic), with the single staleness definition (1h default max age, per-plan override), percent: null for missing limit and for missing windowHours, and resetAt from an explicit resetAt or a daily HH:MM UTC rule (null for rolling/free-text). Nothing consumes snapshots yet — no behaviour change. Laptop verification: 6/6 new tests, 17/17 model-usage/model-plan neighbours, core typecheck and lint clean. Parked in the queue pending PR CI.

  10. dezren39
    added
    queue/claimedA queue worker has claimed the task for this item
    status/in-progressActively being worked
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 27, 2026
  11. developing-today
    added
    status:done
    and removed
    status:in-review
    on Oct 27, 2026
  12. developing-today
    closed this as completedon Oct 27, 2026
  13. dezren39
    removed
    status/in-progressActively being worked
    queue/claimedA queue worker has claimed the task for this item
    work/assignedAn agent holds this item via the queue (claimed task)
    on Oct 27, 2026
  14. dezren39 commented on Oct 27, 2026

    @dezren39
    dezren39
    on Oct 27, 2026
    Author
    More actions

    Merged: PR #615 squash-merged as ae79a36. CI on head d7a7c4e: typecheck, nix-eval, affected-packages, build (linux+windows), check-duplicates SUCCESS; unit (linux/windows) failures log-verified as exactly the 2 known #565 TUI permission-focus flakes per OS. e2e and pr-standards still QUEUED at merge (infra backlog). Queue task 1412 completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/corePackage: core (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/featureNew feature or capability requestpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobstatus:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.