Skip to content

feat(usage): Antigravity quota grouping and auto-ping scheduler - #82

Open
mahdiwafy wants to merge 1 commit into
Vanszs:mainfrom
mahdiwafy:pr/antigravity-quota-tracker
Open

feat(usage): Antigravity quota grouping and auto-ping scheduler#82
mahdiwafy wants to merge 1 commit into
Vanszs:mainfrom
mahdiwafy:pr/antigravity-quota-tracker

Conversation

@mahdiwafy

Copy link
Copy Markdown

Summary

Refactor Antigravity usage parsing to group models into quotas buckets (Gemini vs Claude/GPT) as enforced by the upstream API, and add an Auto-Ping scheduler to keep windows warm.

Changes

  1. Quota Grouping: open-sse/services/usage/google.js no longer loops through 10 repeated models. It now parses the response and outputs two specific buckets:

    • gemini_bucket: Represents the shared limits for all Gemini models.
    • claude_gpt_bucket: Represents the shared limits for Claude and GPT-OSS models.
    • This directly fixes the UI on /dashboard/usage to show 2 progress bars instead of 10 repeated/misleading rows.
  2. Auto Ping Scheduler: Added antigravity to the Auto Ping scheduler (src/shared/services/quotaAutoPing.js & config.js).

    • Dashboard users can now toggle a lightning bolt ⚡ to auto-ping their Antigravity connection when the 5-hour window resets.
    • The ping sends a tiny 1-token "hi" request using gemini-3.5-flash-low to immediately restart the quota window.

Verification

  • npm run lint:undef — clean
  • Rebuilt Docker image successfully.
  • Verified dashboard now shows exactly 2 buckets (Gemini & Claude/GPT) with correct remaining percentages.

@mahdiwafy
mahdiwafy force-pushed the pr/antigravity-quota-tracker branch from b3b473a to 621afd5 Compare July 31, 2026 03:09
@Vanszs

Vanszs commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Request for revision with concrete behavior requirements.

Antigravity quota grouping and auto-ping are relevant, but auto-ping changes real provider quota consumption and must not be enabled implicitly.

Please add:

  • an explicit opt-in setting with a safe default off;
  • provider-response fixtures proving Gemini/Claude/GPT bucket classification;
  • a clear estimated marker for weekly usage calculations;
  • executor-compatible ping payload tests, including proxy and account selection;
  • cooldown, timeout, retry, and duplicate-scheduler protection;
  • tests proving failed/aborted pings do not corrupt quota state;
  • documentation of the quota cost and reset assumptions.

Please preserve existing usage history, token tracking, account fallback, proxy behavior, and RTK/Caveman/Ponytail request flow. The UI grouping can be reviewed separately from the scheduler.

… tests

Per maintainer feedback on Vanszs#82:
- auto-ping is explicit opt-in (default off): only connections with
  settings[settingsKey].connections[connId] === true are targeted; empty
  map = no pings.
- weekly usage marked estimated: true (7-day history scaled + 4x
  multiplier), documented as estimate not provider-reported.
- scheduler hardened: failure cooldown, duplicate-reset protection
  (lastPingedResetKey), min ping interval, refresh fail-soft.
- providerHandlers injectable for tests.
- tests: opt-in default-off, per-connection enable, duplicate reset skip,
  failed ping does not corrupt state, refresh failure fail-soft, bucket
  classification fixtures (gemini_weekly / claude_gpt_weekly), error rows
  skipped.
@mahdiwafy
mahdiwafy force-pushed the pr/antigravity-quota-tracker branch from 621afd5 to 3fb0887 Compare August 4, 2026 09:12
@mahdiwafy

Copy link
Copy Markdown
Author

Per your #82 review notes:

  1. Explicit opt-in, default off — the scheduler only pings connections explicitly enabled via settings[antigravityAutoPing].connections[connId] === true; an empty map means no pings at all.
  2. Bucket classification fixtures — added tests/unit/antigravity-weekly-bucket.test.js: gemini-* → gemini_weekly, claude-*/gpt-* → claude_gpt_weekly, error/failed rows skipped.
  3. estimated marker — weekly usage now returns estimated: true (7-day request history scaled to a full week × conservative 4x multiplier), clearly marked as estimate, never presented as provider-reported.
  4. Ping payload + proxy/account selection — pings go through the same executor path with resolved proxy options and refreshed credentials (existing code).
  5. Cooldown/timeout/retry/duplicate protection — failure cooldown cache, duplicate-reset-key guard, min ping interval, refresh fail-soft — now unit-tested (quota-autoping.test.js): default-off, per-connection enable, duplicate skip, failed ping doesn't write lastPingedResetAt, refresh failure fail-soft.
  6. Quota cost/reset assumptions documented in the tracker header (requests not tokens; weekly pool ≈ 4× the 5H pool).

All 8 new tests pass.

@Vanszs Vanszs left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Request changes

Cross-check against the latest main found runtime blockers despite green build checks:

  1. Antigravity is not registered in QUOTA_AUTOPING_CONFIG.providers. The scheduler iterates Object.entries(C.providers), so the new handler is never scheduled. Add the provider config with explicit per-connection opt-in and default-off behavior.
  2. sendAntigravityPing() sends an incompatible executor payload. It passes messages at the top level instead of the executor's expected body shape. Add a test against the actual executor call, not a mocked sendPing handler.
  3. Successful ping returns undefined after draining the stream. The caller treats falsy as failure, so lastPingedResetAt/lastPingedResetKey are never persisted.
  4. No timeout/abort for reader.read(). A hanging upstream stream can hold state.running indefinitely.
  5. Proxy arguments are incorrect for getAntigravityUsage(): proxyOptions is passed as providerSpecificData, leaving the proxy argument unset.
  6. Weekly tracker is orphaned: no runtime usage/UI path calls getWeeklyUsage().
  7. Weekly extrapolation uses first-use timestamps between buckets and can produce absurd scaling for short observations. Bound or defer estimation and test the edge cases.

Please rebase onto current main, add executor/proxy/timeout/error-path tests, and rerun targeted tests plus the full build/test checks.

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.

2 participants