Repository navigation
Support for Github Copilot with the omarchy quickshell agents plugin - #7798
wellatleastitried wants to merge 29 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a fourth usage provider — GitHub Copilot — to the Omarchy Quickshell "agents" bar widget, which already displays usage for Claude, Codex, and Fireworks. It follows the plugin's established contract: the panel is display-only and simply renders whatever JSON record a bin/omarchy-agent-usage-<agent> collector prints, so adding a provider means shipping a collector plus enabling it in the manifest. The new collector reads the local Copilot SQLite session store (~/.copilot/session-store.db) and aggregates token usage by day and model into the shared record schema.
Changes:
- New
bin/omarchy-agent-usage-copilotPython collector that readssession-store.dband emits daily totals, per-model breakdown, and 7-day history as JSON. - Enables
copilotby default inshell/plugins/agents/manifest.jsonand updates the widget description. - As noted in the PR, Copilot exposes no usage limits, so
limitsis intentionally left empty.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bin/omarchy-agent-usage-copilot |
New collector reading the Copilot session-store DB and emitting the shared usage-record JSON. |
shell/plugins/agents/manifest.json |
Enables the copilot provider by default and updates the panel description text. |
Notes not attached to changed lines: the plugin README.md "Data" table lists each collector (claude, codex, fireworks) but was not updated to include copilot, and no assets/copilot.svg mark is shipped (the panel falls back to the bar glyph, which is supported).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Add omarchy-agent-usage-copilot collector script with dual data sources - Reads session history from ~/.copilot/session-store.db for usage tracking - Fetches quota/limits from copilot_internal/user API using OAuth tokens - Includes copilot.svg and copilot-light.svg icons for bar widget - Update manifest.json to include copilot as an enabled provider by default - Copilot agent displays in the agents widget with usage and quota info The collector merges local historical token usage (per-model breakdown, 7-day stats) with account quota information from the official GitHub API.
b18d722 to
4b052c5
Compare
|
FYI: I noticed PR #7893 was submitted with a similar objective, just missing tokens per day and per model usage. |
|
Thanks for the heads up — closed #7893 in favor of this one, since you've also got the token/session stats from One thing to flag before a maintainer review does: your quota code's |
|
@gustavobragac I appreciate the warning. I will be sure to address that! |
…ctiveDays, remove dead code, add tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (3)
Previously missed (3) — in code that hasn't changed since the last review.
test/shell.d/agent-usage-copilot-scanner-test.sh:66
- This assertion locks in both incompatible behaviors:
todayTokensByModelmust contain numeric totals, while the detailedmodelUsage.inputTokensmust exclude cache tokens that are reported separately. Update the fixture expectations so the test catches both panel-schema regressions.
# Test 3: Model usage is tracked with correct schema
model_usage=$(jq '.todayTokensByModel.["gpt-4"]' <<<"$result")
[[ $(jq -r '.inputTokens' <<<"$model_usage") == "180" ]] ||
fail "Copilot collector tracks todayTokensByModel with per-model breakdown" "$result"
pass "Copilot collector tracks todayTokensByModel with per-model breakdown"
test/shell.d/agent-usage-copilot-scanner-test.sh:129
- The quota fixture uses a JSON number for
entitlement, so it does not exercise the string-valued field returned by the current Copilot contract and misses the production failure above. Model the raw response with a numeric string.
"entitlement": 100,
test/shell.d/agent-usage-copilot-scanner-test.sh:92
- This creates two temporary directories outside
TEST_HOME, but the EXIT trap only removesTEST_HOME, so every test run leaks both directories. Use unused paths beneath the already-trapped fixture directory instead.
result_empty=$(HOME="$(mktemp -d)" COPILOT_HOME="$(mktemp -d)" "$ROOT/bin/omarchy-agent-usage-copilot")
…ion as it is based on a false premise, but the TEST_HOME bug is fixed and the todayTokensByModel schema change are implemented
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
test/shell.d/agent-usage-copilot-scanner-test.sh:3
- This test omits the repository's required
set -euo pipefailpreamble, so failures in unguarded setup commands and unset-variable mistakes can be silently carried into later assertions. Add the standard strict-mode line before sourcingbase-test.sh(seedocs/testing.md:38-46).
#!/bin/bash
source "$(dirname "$0")/base-test.sh"
|
Resolves: #8425 |
get_oauth_token() only checked editor plugin config (apps.json/hosts.json/oauth.json under ~/.config/github-copilot), so machines using only the standalone Copilot CLI never got quota data even with a valid seat. The quota API accepts any GitHub token carrying Copilot entitlement, so an authenticated gh CLI works as a fallback via 'gh auth token'. Also softened AUTH_HELP text to mention the gh CLI path, and added scanner-test coverage for both the fallback succeeding and failing closed with no gh CLI available. Co-authored-by: JulianCodespoti <85543181+JulianCodespoti@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Automated duplication check: this pull request looks similar to #9945, which covers the same Copilot usage collector. I keep that one open and close this one to consolidate review. If you feel this is the wrong decision, please open the PR again with a note on the difference. |
|
I appreciate the cleanup, but I had already identified and documented the duplicates (#8972 #9945) in my own comment on this PR. Since this was opened first includes and comprehensive test coverage (Tests 12-13 in the scanner-test), I'd prefer this one stay open for review rather than consolidating into a later PR. Additionally, the collector from this PR has been tested in-depth, as it is currently a plugin listed on the the plugin marketplace where people have been able to use it and test it themselves. @bjarneo Would you be able to reopen this? Or should I open a new PR that references this one? |

Adds support for displaying GitHub Copilot token usage and statistics in the
agents bar widget, alongside Claude, Codex, and Fireworks providers.
Changes
bin/omarchy-agent-usage-copilotreads from~/.copilot/session-store.dbshell/plugins/agents/manifest.jsonto include copilot as anenabled provider by default
7-day history
ghsession as a fallbackImplementation Details
aggregates token usage (input, output, cache read/write) by date and model.
integration with the existing panel UI.
Preview