Repository navigation
Conversation
…endpoint fallback - Restrict cache write permissions to 0600 (owner only) - Make Secret Service token retrieval read-only to avoid corrupting keyring - Eliminate ambient environment variable OAuth refresh flow - Add dual endpoint fallback (daily-cloudcode-pa and cloudcode-pa) - Fix race condition during advisory lock file open
|
Great PR! During security testing on an active Omarchy system, we identified a few security and reliability improvements in
Submitted these fixes as a PR to your branch at edgseu#1 so you can easily pull them in! |
security(agent-usage): harden token handling, cache permissions, and endpoint fallback
Author
|
Thanks for the patch @Klebiano, updated the pr. |
One malformed or NaN quota bucket discarded every limit the endpoint returned and could leak NaN into the JSON output; buckets are now skipped individually. An ok probe with no quota buckets (error-shaped 200 or an API change) wiped previously good limits from the cache; the cache now keeps serving and the cached tier wins over one derived from an error body. Open-ended cached limits (no reset time) expire after 24 hours instead of rendering indefinitely. Antigravity CLI history counts prompts only, skipping assistant/response rows. ready matches the sibling collectors' contract, and dead code from the security hardening was removed. Tests: quota-parser unit tests with a stubbed endpoint (malformed/NaN buckets, canary-to-production fallback), cache preservation and open-ended expiry, the owner-only cache permission, keyring read-only and append-mode lock pins, and the documented test header.
Member
|
Automated duplication check: this pull request looks similar to #8479, which covers the same Antigravity 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. |
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
Expands the built-in
omarchy.agentsbar widget and collector ecosystem with official support for Google Gemini / Antigravity.Previously, the agents panel supported Claude Code, Codex, and Fireworks. This PR adds Gemini rate-limit monitoring, plan tier detection, session token tracking, and per-model breakdowns.
Changes
bin/omarchy-agent-usage-gemini: New usage collector adhering to the sibling collector contract (--force,--limits-only, versioned JSON). Probes the Google Cloud Code (Antigravity) API for 5-hour and weekly quota windows and reset timestamps; parses session files from~/.pi/agent/sessions/and~/.omp/agent/sessions/for google/gemini/antigravity providers; scans~/.gemini/antigravity-cli/history.jsonlfor prompt counts (assistant/response rows skipped); queries localopencode.dbread-only for assistant token metrics including reasoning and cache reads/writes.shell/plugins/agents/manifest.json: Addedgeminiprovider default.shell/plugins/agents/Main.qml: Model name prefix handling and token counting support (google-antigravity/gemini-2.5-pro→Gemini 2.5 Pro).shell/plugins/agents/assets/gemini.svg: Branded vector asset.test/shell.d/agent-usage-gemini-scanner-test.sh: Scanner, cache, security-contract, and quota-parser tests.Security
Carries the review hardening from @Klebiano, now pinned by tests: cache files written owner-only (0600, atomic replace), the keyring is strictly read-only (
secret-tool lookup, neverstore), the quota endpoint falls back from the canary host to production, and the scan lock opens in append mode so active flock handles survive.Robustness
readymatches the sibling collectors' contract (local stats or limits), and dead code from the security hardening was removed.Notes for reviewers
write_json/read_fresh_jsonare duplicated across the sibling collectors; a shared helper module is a sensible follow-up across all of them.opencode.dbresolution ignoresXDG_DATA_HOME— same as the claude sibling; worth fixing cross-cutting later.Verification
test/shell.d/agent-usage-gemini-scanner-test.sh— 11/11 assertions pass (including quota-parser unit tests with a stubbed endpoint and cache-permission checks).test/shell.d/agent-usage-update-test.sh,test/shell.d/agents-panel-test.sh,test/shell.d/agent-usage-claude-scanner-test.sh— pass.test/cli— passes (116 assertions).