Repository navigation
Conversation
legendik
force-pushed
the
feat/copilot-usage
branch
from
September 30, 2026 09:06
ec70746 to
dfa647e
Compare
Contributor
|
- Rewrite the transcript fallback for the real event format: count user-typed user.message prompts, and take tokens and cost from the cumulative session.shutdown modelMetrics as the increase since the previous shutdown. Replies after the last shutdown count on their output tokens alone. - Remove the 20,000-row store cap. Rows stream through a shared running total, so lifetime totals cover the whole store. - Stop counting tokens twice: store and shutdown input already includes cache reads and writes, and output already includes reasoning tokens. - Read the live quota snapshot as AI credits, not nano units. - Leave an unconfigured plan unknown instead of defaulting to Pro. - Pin the test timezone and cover the transcript fallback, a store past the old cap, an unset plan, and a mocked live quota.
- Split each shutdown's usage over the days its replies landed on: output by each day's reply output, input, cache, and cost by reply count. A session that spans midnight or a month boundary no longer books everything on the shutdown's day. - Wait out UTC midnight at the start of the test, so "today" and the allowance month cannot change mid-run, and cover a segment that spans midnight.
Contributor
|
Thank you! Brought in with your authorship in #14040, reindented to two spaces, with the plan and allowance taken from GitHub's live answer and the last allowance kept through a failed check until it resets. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds GitHub Copilot as a fourth agent in the agents panel, alongside Claude, Codex, and Fireworks. Ships the
omarchy-agent-usage-copilotcollector, panel icons, and test coverage — the plugin itself is untouched, since a new collector is all a new agent needs.How it works
Local stats. The Copilot CLI's session store (
~/.copilot/session-store.db) records every billed request in itsassistant_usage_eventstable: day, model, session, token split, and cost in nano AI units. The collector snapshots the WAL-mode database via SQLite's online backup API (no copying of db +-walsiblings, no blocking the writer) and aggregates in Python. CLI versions whose store predates that table fall back to scanning session transcripts under~/.copilot/session-state. Neither source needs the network. HonorsCOPILOT_HOMEfor non-default installs, likeCLAUDE_CONFIG_DIR/CODEX_HOMEin the other collectors.Monthly allowance. The meter is an allowance of AI credits. When GitHub's internal quota endpoint (the one the editor plugins use) answers, the account-wide figure is authoritative — it counts every machine, IDE, and agent on the entitlement, and provides the plan label and reset date. The probe needs a token from
COPILOT_QUOTA_TOKEN,GH_TOKEN,GITHUB_TOKEN, orgh auth token; every failure is soft and falls back to this machine's CLI spend against a plan allowance from~/.config/omarchy/agents/copilot.json:{ "plan": "pro", "monthlyCredits": 1500, "remote": true }plan ( free / student / pro / pro+ / max / business / enterprise ) picks a default allowance; monthlyCredits overrides it; remote turns the quota probe off. A meter labeled "(est.)" is the local estimate; a plain "Monthly allowance" is the live account figure. A machine that never ran the CLI reports nothing and the panel stays hidden, per the plugin's contract.
Follows the sibling collectors' conventions: same --force / --limits-only freshness contract, versioned cache envelope, atomic cache writes, and auth guidance surfaced in authHelpText .