Skip to content

Support for Github Copilot with the omarchy quickshell agents plugin - #7798

Closed
wellatleastitried wants to merge 29 commits into
omacom:quattrofrom
wellatleastitried:quattro
Closed

wellatleastitried wants to merge 29 commits into
omacom:quattrofrom
wellatleastitried:quattro

Conversation

@wellatleastitried

@wellatleastitried wellatleastitried commented Aug 22, 2026 •

Copy link
Copy Markdown

Adds support for displaying GitHub Copilot token usage and statistics in the
agents bar widget, alongside Claude, Codex, and Fireworks providers.

Changes

  • New collector script: bin/omarchy-agent-usage-copilot reads from
    ~/.copilot/session-store.db
  • Updated shell/plugins/agents/manifest.json to include copilot as an
    enabled provider by default
  • Copilot usage now displays with daily totals, per-model breakdown, and
    7-day history
  • Uses stored OAuth tokens (from sign-ins through third-party plugins like VSCode, copilot.vim, Jetbrains, etc) to query API usage limits OR an authenticated gh session as a fallback

Implementation Details

  • The collector reads from the Copilot session-store SQLite database and
    aggregates token usage (input, output, cache read/write) by date and model.
  • Output follows the same JSON schema as other providers for seamless
    integration with the existing panel UI.

Preview

screenshot-2026-08-27_12-16-03

Copilot AI balanced review requested due to automatic review settings August 22, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-copilot Python collector that reads session-store.db and emits daily totals, per-model breakdown, and 7-day history as JSON.
  • Enables copilot by default in shell/plugins/agents/manifest.json and updates the widget description.
  • As noted in the PR, Copilot exposes no usage limits, so limits is 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 4 changed files in this pull request and generated no new comments.

@wellatleastitried

Copy link
Copy Markdown
Author

FYI: I noticed PR #7893 was submitted with a similar objective, just missing tokens per day and per model usage.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 4 changed files in this pull request and generated no new comments.

@gustavobragac

Copy link
Copy Markdown

Thanks for the heads up — closed #7893 in favor of this one, since you've also got the token/session stats from session-store.db that mine couldn't provide (Copilot really has no local data for that outside the CLI's own store).

One thing to flag before a maintainer review does: your quota code's AUTH_HELP and docstring say the OAuth token is shared with "official Copilot clients (VS Code, JetBrains, CLI)" — I made the same claim initially and it's wrong for the standalone copilot CLI. Checked its binary directly with strings: no reference to ~/.config/github-copilot or apps.json anywhere, only COPILOT_HOME (~/.copilot/ by default, which is also where your session-store.db read already looks — so your two data sources actually come from two different credential stores, not one). Worth scoping that line to editor plugins only (VS Code, JetBrains, copilot.vim).

@wellatleastitried

Copy link
Copy Markdown
Author

@gustavobragac I appreciate the warning. I will be sure to address that!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 5 changed files in this pull request and generated no new comments.

wellatleastitried and others added 2 commits August 23, 2026 16:44
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 5 changed files in this pull request and generated no new comments.

wellatleastitried and others added 2 commits August 23, 2026 17:06
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wellatleastitried
wellatleastitried requested a balanced review from Copilot August 23, 2026 22:25
@wellatleastitried

wellatleastitried commented Aug 23, 2026 •

Copy link
Copy Markdown
Author
screenshot-2026-08-27_12-16-03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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: todayTokensByModel must contain numeric totals, while the detailed modelUsage.inputTokens must 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 removes TEST_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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 pipefail preamble, so failures in unguarded setup commands and unset-variable mistakes can be silently carried into later assertions. Add the standard strict-mode line before sourcing base-test.sh (see docs/testing.md:38-46).
#!/bin/bash

source "$(dirname "$0")/base-test.sh"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 7 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 7 changed files in this pull request and generated no new comments.

@wellatleastitried

wellatleastitried commented Aug 31, 2026 •

Copy link
Copy Markdown
Author

Duplicate/related here: #8972 #9945

@wellatleastitried

Copy link
Copy Markdown
Author

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>
@bjarneo

bjarneo commented Sep 21, 2026

Copy link
Copy Markdown
Member

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.

@bjarneo bjarneo closed this Sep 21, 2026
@wellatleastitried

wellatleastitried commented Sep 21, 2026 •

Copy link
Copy Markdown
Author

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?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants