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(quota-plane): stage-3 S1 — per-tick forecast product (#12695) by dezren39 · Pull Request #12724 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Stage-3 slice S1 for #12695 (epic #12694), implementing design decisions D1/D2 from doc/2026-11-22T22-35-00Z_design_quota-plane-stage-3/ (approved by Drewry 2026-11-22, PR #12702). Does NOT close #12695: acceptance criteria 1 and 3 are one-week live-run evidence that accrues after this deploys on the laptop.

What lands

  • src/quota-forecast.ts (new, pure — the pool-state.ts pattern): builds the per-tick forecast product. Pools keyed by the canonical provider id (the Babysitter live: interval rounds over all OpenCode sessions with verdicts, quota, and pool attribution #1338 keying lesson); per pool/window the quota-analytics.ts projection verbatim (state, ratePtsPerHour, samples, projectedWallAt, durationUntilWallMs, wallsBeforeReset, reason) plus pctNow, the reading's measuredAt, and the window's resetsAt. The pace math is promoted, never reimplemented (D2).
  • scripts/gather-quota.ts: after the snapshot append and the reading-row sink, the tick reads the snapshot store (this tick's appended records merged in), writes quota-forecast.json beside quota-current.json (QUOTA_FORECAST_PATH override), and writes one Turso agent_quota_records ledger row per pool/window (source = "quota-forecast", forecast shape in the payload, INSERT OR IGNORE; rides the existing TURSO_QUOTA_SINK switch). Fail-soft like the pool-state write: any forecast failure logs and never fails the tick; the previous forecast stands and ages.
  • Tests: src/quota-forecast.test.ts (15 tests) + one tick-level test in test/gather-quota.test.ts.

Honesty states, as implemented

  • Only a fresh ok reading is projected — quota-current.ts's overlay rule, including its perf(quota-plane): parallel provider fetching + per-provider timeout budget for the 15-min tick #1268 clause: a retained last-known entry is stale by definition, however recent its measuredAt.
  • A pool/window whose latest reading is stale / retained / errored / lapsed still gets a row: insufficient-history, samples 0, all projection fields null, pctNow: null (a stale percentage is never republished as current), with a reason naming the cause. measuredAt/resetsAt still ride so consumers can apply the design's freshness contract.
  • Thin or unmeasurable history is the oracle's own insufficient-history with its reason, passed through verbatim.
  • Label-only windows (no percentage anywhere, e.g. the DeepSeek CNY balance) get no forecast row — they are not quota windows.
  • Per design §2, v1 is same-period linear pace only: 33 days of history is ~4–5 samples per weekday per window, too thin for weekday profiles, so none are modelled.

Rename join

Snapshot series are joined across the recorded serviceId renames via the explicit forecastSeriesKey mapping in code: antigravity/_antigravity (incl. colon-era antigravity:gemini), command-code/commandcode/_commandcode, meta/meta:high-usage, openai.main/_openai.main — the same join semantics as analytics-store's seriesForWindow (fold + sub-id acceptance + metric aliases + (ts, value) dedupe), so forecast and /quota display fit the same series.

Evidence (sandbox venue)

  • Fail-before: bun test ./src/quota-forecast.test.ts on the branch base (origin/main + test file only) — suite load error, no such module.
  • Pass-after: forecast suite 15/15 (358 expects), including a 60-case generated-series property test against the projectWindow oracle (same inputs → same projection; the acceptance-named oracle) and rename-join / stale / retained / errored honesty cases.
  • Tick-level: the new gather-quota test seeds a 10 pts/h cline-pass burn in a fixture snapshot store and asserts the tick publishes quota-forecast.json with state: "projected", wall before reset. All 9 gather-quota tests pass.
  • Neighbours: quota-analytics + pool-state + quota-gather-map suites 39/39. Full aggregator suite 3195 pass / 4 fail — the 4 are the known pre-existing environmental set (live-source charges, manifest tiers, ETA derivation, planning-doc parse), identical at pristine main (3179 + 16 new = 3195). tsc --noEmit clean. Biome-formatted.
  • Note: the worktree needed bun install before the tick tests could run at all (missing web-push, the aggregator's existing dependency) — pre-existing tests failed identically without it. No new dependencies in this PR.

Next after merge

Deploy rides the normal aggregator install on the laptop; then the acceptance week runs (forecast on every tick, heartbeat-verified; five busiest pools non-degenerate on a majority of ticks). S2 (#12696) consumes this shape for the accuracy ledger.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
felix
feat(quota-plane): stage-3 S1 — per-tick forecast product (#12695)
ee0591f
Publish quota-forecast.json beside quota-current.json on every
gatherer tick, plus one Turso agent_quota_records ledger row per
pool/window (source quota-forecast), per the Stage-3 design D1/D2
(epic #12694).

- src/quota-forecast.ts (new, pure): pools keyed by the canonical
  provider id; per pool/window the quota-analytics projectWindow
  projection verbatim + pctNow/measuredAt/resetsAt. The pace math
  is promoted, never reimplemented (D2).
- Honesty: only a fresh ok reading is projected (quota-current
  overlay rule; retained last-known is stale by definition). A
  stale/errored/lapsed latest reading yields an explicit
  insufficient-history row with a reason — no invented dates, no
  stale percentages republished. Thin history passes the oracle's
  own insufficient-history through.
- Series joined across the recorded serviceId renames via the
  explicit forecastSeriesKey mapping (antigravity/_antigravity,
  command-code/commandcode/_commandcode, meta/meta:high-usage,
  openai spellings), mirroring the analytics-store join so the
  forecast and the /quota display agree on the same inputs.
- gather-quota.ts: forecast step after the snapshot append and the
  reading-row sink, fail-soft like pool-state — a forecast failure
  logs and never fails the tick; the previous forecast stands.
  QUOTA_FORECAST_PATH overrides the output path.
- Tests: 15 unit/property tests against the projectWindow oracle
  (same inputs -> same projection, incl. a 60-case generated-series
  property run) + a tick-level test proving the product lands
  beside quota-current.json from seeded history. No new deps.
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 00:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T00:09:25.701586Z ee0591f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9260b688-04c5-4f20-b6b5-b67013c9b092
Commits

Reviewing files that changed from the base of the PR and between 7e3c3bd and ee0591f.

Files selected for processing: 4

  • pm-stack/aggregator/scripts/gather-quota.ts
  • pm-stack/aggregator/src/quota-forecast.test.ts
  • pm-stack/aggregator/src/quota-forecast.ts
  • pm-stack/aggregator/test/gather-quota.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dezren39 dezren39 mentioned this pull request Nov 23, 2026
impl(quota-plane): stage-3 S1 — forecast product: per-tick quota-forecast from the analytics pace math #12695
Closed
@dezren39
dezren39 merged commit b20d539 into main Nov 23, 2026
2 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the felix/12695-forecast-product branch November 23, 2026 00:07
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Nov 23, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee0591f912

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pm-stack/aggregator/scripts/gather-quota.ts
// leaves the previous quota-current.json standing.
try {
const stored = await new SnapshotStore(snapshotsDir).readAll().catch((): SnapshotRecord[] => []);
const forecast = buildQuotaForecast(file, [...stored, ...fresh], new Date(tickAt));

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 23, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Evaluate forecasts at publication time rather than tick start

When a provider reading is fetched more than 60 seconds after the tick starts, this call incorrectly rejects it as stale: tickAt is captured before the renewal keepers and collectRuns, while entryFromResult preserves the provider's later fetchedAt, and entryFreshness allows only 60 seconds of future skew. Even faster reads have their newly appended history point excluded by projectWindow's p.ts <= now filter because that point occurs after tickAt. Consequently, successful collection can publish insufficient-history for fresh readings or fit a projection without the current sample. Pass the actual forecast computation time as now, retaining tickAt separately for ledger identity.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Nov 23, 2026
doc(#9572): C4 quota forecasting design — prediction record, scoring, methodology log #13268
Merged
C4 — Quota forecasting: exhaustion, downtime, and reset-duration predictions, tracked until accurate #9572
Open
@dezren39 dezren39 added the audit:partial PR partially implemented; gap filed label Nov 24, 2026
This was referenced Nov 24, 2026
Audit programme: seven-lane review of PRs, issues and designs (2026-11-23) #13871
Open
AUDIT-7 Lane 4 — MERGED-PR-AUDIT: merged PRs since 2026-10-23 vs their spawning issues #13879
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

audit:partial PR partially implemented; gap filed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

impl(quota-plane): stage-3 S1 — forecast product: per-tick quota-forecast from the analytics pace math

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — 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.