GeezerVison is showing github.com — feat(usage-hub): GitHub billing collector on the unified usage endpoint (#1051) by dezren39 · Pull Request #2236 · developing-today/code
Conversation
dezren39
commented
Oct 29, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
GitHub billing collector for the usage hub (#1051, GitHub half)
Queue task 2986 (resume of the 06:26Z park, whose design groundwork this PR executes). Triage task 2315 established the premise: the old per-product billing endpoints are gone (410), but the unified endpoint answers with the existing gh OAuth token.
What lands
scripts/collect-github-billing.ts — the daily collector: GET /users/{user}/settings/billing/usage?year&month via gh api, appends per-day §4 snapshot records to the writers' outbox (same drain path as append-usage-snapshots.ts). --print dry-runs; records carry their usage date so re-runs dedupe in the store.
src/sources/github-billing.ts — pure aggregation (group-by date): Actions minutes, Codespaces core-hours, storage GB-hours, gross/net USD, under service github with card metric ids where they exist (codespaces-hours).
- Unit extension (design decision (a) from the park note): snapshot units gain
minutes / hours / gb-hours (model.ts, snapshots.ts UNITS) and snapshot-records.ts UNIT_MAP gains minutes/hours — the GitHub card's minutes/hours metrics were previously skipped by the snapshot pipeline. gb-hours is deliberately its own unit: the endpoint bills storage in GB-hours, which is not GB, and silently storing it as gb (or minutes as count) would corrupt the series.
Verification
- New tests (
test/github-billing.test.ts, 5): aggregation, month totals, record shape/zero-skipping, store validation of the new units. All pass (laptop).
- Full aggregator suite on the laptop: 346 pass / 1 fail — the one failure (
actions.test.ts, attention badges) also fails on clean main (verified separately); pre-existing, unrelated.
- Typecheck clean (laptop, worktree with node_modules linked from the primary).
- Live endpoint (sandbox gh, 2026-10-29 ~10:40Z): 104 items for Oct 2026, Actions minutes 3,973 (accrual since the 3,629 @02:22Z triage read and 3,661 @07:10Z), net $0.00 — the collector's aggregates are checked against this read in the task completion.
Runtime home — one finding
The endpoint needs gh's user scope (404 without it). The sandbox gh has it; the laptop's gh does not (gist/read:org/repo/workflow), so the collector's daily run belongs in the sandbox-side writer context (like append-usage-snapshots under stewardship) until the laptop auth gains user interactively. Noted in the script header; the script's error message names the scope when gh fails.
Out of scope
The Vercel half of #1051 stays blocked on Drew connecting the Vercel connector; #1051 keeps user/escalated for that half. The October baseline entry is already recorded in provider-quota-registry.md (prior holder, verified).
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
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.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
…nt (#1051)
Daily collector for the usage hub (hub design §2.2/§5): scripts/collect-github-billing.ts reads GET /users/{user}/settings/billing/usage via the existing gh OAuth token (user scope; the old per-product billing endpoints are gone, 410) and appends per-day snapshot records to the writers outbox. Aggregation lives in src/sources/github-billing.ts (pure): Actions minutes, Codespaces core-hours, storage GB-hours, gross/net USD per day under service github.
Snapshot units extended with minutes/hours/gb-hours (model.ts, snapshots.ts UNITS) and snapshot-records UNIT_MAP gains minutes/hours, so the GitHub card minutes/hours metrics stop being skipped by the snapshot pipeline. GB-hours is deliberately its own unit: the endpoint bills storage in GB-hours, which is not GB.
Runtime home: a context whose gh carries the user scope (today the sandbox-side writer home, like append-usage-snapshots); the laptop gh lacks it and 404s — noted in the script header.
coderabbitai
Bot
commented
Oct 29, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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 34 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:
d8038358-cede-4607-93b8-c2164c27fa2a
Commits
-
Reviewing files that changed from the base of the PR and between 24901e7 and c77b017.
Files selected for processing: 6
-
pm-stack/aggregator/scripts/collect-github-billing.ts
pm-stack/aggregator/src/model.ts
pm-stack/aggregator/src/snapshot-records.ts
pm-stack/aggregator/src/snapshots.ts
pm-stack/aggregator/src/sources/github-billing.ts
pm-stack/aggregator/test/github-billing.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
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-29T12:25:12.686996Z |
c77b017 |
New commits |
ℹ️ 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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: b71ab823c1
ℹ️ 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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…lling classification (Codex P2 x2 on #2236)
This was referenced Oct 29, 2026
Parked again — merge queue stalled repo-wide (queue task 2986, openchamber scheduled lane)
Head c77b0179, mergeStateStatus: CLEAN, Codex re-review clean, both P2 threads resolved, targeted tests 7/7 on the laptop. The PR has been at merge-queue position 3 since 12:35Z (AWAITING_CHECKS), and this is not specific to it: across the repo's last 30 workflow runs zero are in_progress, while merge_group nix ci runs for queue heads (2220, 2252, 2236, 2293, 2297, 2303) have sat queued 15+ minutes. GitHub PR-branch runs (e.g. 40868118355 for #1820) are likewise 23/28 jobs queued.
So the remaining step is purely runner availability. Resume: when PR 2236 shows MERGED, complete the queue task as fixed_merged for the GitHub half, strip queue/* and status/* from #1051, and leave the Vercel half on user/escalated (connector not_connected — Drew's action).
— repo-worker-code (openchamber scheduled lane), queue task 2986
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 9, 2026
This was referenced Nov 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|