Commit Graph

89 Commits

Author SHA1 Message Date
Tinh To
af888a74d0 Merge pull request #284 from Qwinty/feat/quota-checker-v2
feat: add quota check and account management to auth login
2026-01-25 21:52:32 +07:00
phuctruong
b39ce4bd60 fix: prevent toast spam for rate limit warnings
- Move rateLimitToastCooldowns to module level (persists across requests)
- Add allAccountsRateLimitedToastShown flag to show toast only once per event
- Add cleanup for toast cooldown map to prevent memory growth

Fixes #263
2026-01-24 23:24:19 +07:00
Maxim Esipov
a06b0996ac fix: show correct position in account toast for enabled accounts
Toast was showing absolute account index (e.g., 3/2) when some accounts
were disabled. Now calculates position among enabled accounts only.
2026-01-24 13:31:58 +03:00
Maxim Esipov
9a85cb272b feat: add quota check and account management to auth login
- Add enabled field to AccountMetadataV3 for account enable/disable
- Add getEnabledAccounts/getTotalAccountCount methods to AccountManager
- Add quota.ts with quota checking logic via fetchAvailableModels API
- Integrate 'Check quotas' and 'Manage accounts' options into auth menu
- Display quota status for Claude, Gemini 3 Pro, and Gemini 3 Flash
- Add standalone check-quota.mjs script for manual verification
- Update tsconfig to exclude temp_research folder
2026-01-24 13:08:03 +03:00
Tinh To
456d8bff82 Merge pull request #272 from PhucTruong-ctrl/feature/rate-limit-improvements
Feature/rate limit improvements
2026-01-22 22:25:37 +07:00
phuctruong
3dcabfb8b6 fix: address review feedback - remove redundant reset, fix usageMetadata format
- Remove redundant capacityRetryCount reset (auto-resets on endpoint switch)
- Fix synthetic usageMetadata to use correct SSE format: {response: {usageMetadata: {...}}}
2026-01-22 22:14:21 +07:00
phuctruong
d8d389bae2 fix(toast): add 5s debounce for rate limit warning toasts
Prevents toast spam when multiple 429s occur in quick succession.
Same message type won't show again within 5 seconds.

Fixes issue #263 - 'Rate limited' toast appearing too frequently
2026-01-22 21:56:33 +07:00
phuctruong
d14343e7ee feat(rate-limit): regenerate fingerprint after capacity retry exhaustion
Proposal 2: When max capacity retries (3) are exhausted, regenerate
the account fingerprint to get a fresh device identity before trying
the next endpoint. This may help bypass per-device throttling.
2026-01-22 21:51:40 +07:00
phuctruong
76a0b912d7 feat(rate-limit): add configurable request timing jitter
- Add request_jitter_max_ms config option (default: 0 = disabled)
- Apply random delay before API requests to break predictable cadence
- Helps avoid detection of automated request patterns
2026-01-22 21:32:44 +07:00
Noe
83e2f0e82d chore: bump version to 1.3.1-beta.2 and remove unused googleSearch config 2026-01-22 11:26:23 +00:00
Noe
331842ef4d Merge remote-tracking branch 'origin/dev' into googleSearch 2026-01-22 11:22:58 +00:00
tctinh
b9fc394cf5 hive: merge 05-add-exponential-backoff-for-503529 (squashed) 2026-01-22 13:35:54 +07:00
tctinh
f8ab8ca03a hive: merge 04-enhance-duration-parsing-for-go-format (squashed) 2026-01-22 13:35:54 +07:00
tctinh
c183fc2769 hive: merge 02-implement-cachefirst-scheduling-mode (squashed) 2026-01-22 13:34:11 +07:00
tctinh
6ab5c56ccc hive: merge 03-add-failure-count-ttl-expiration (squashed) 2026-01-22 13:34:10 +07:00
tctinh
760bed217b Merge branch 'dev' of github.com:NoeFabris/opencode-antigravity-auth into spoof-improve 2026-01-22 12:57:46 +07:00
tctinh
f72f8f1077 hive: merge 03-add-fingerprint-to-debug-output (squashed) 2026-01-22 12:56:45 +07:00
tctinh
c3b116c5b4 hive: merge 02-persist-fingerprint-per-account (squashed) 2026-01-22 12:56:44 +07:00
Tinh To
9f62bfd823 Merge branch 'dev' into fix/issue-263-redesign
Signed-off-by: Tinh To <88414894+tctinh@users.noreply.github.com>
2026-01-22 12:51:44 +07:00
phuctruong
c883db4eef fix(ratelimit): remove duplicate sleep call 2026-01-22 12:08:10 +07:00
phuctruong
256c68aa7e fix(ratelimit): implement capacity retry limit to prevent infinite loops (Greptile review) 2026-01-22 12:04:39 +07:00
phuctruong
8df4735039 fix(ratelimit): correct loop retry logic and prevent state pollution (CodeRabbit review) 2026-01-22 11:53:25 +07:00
phuctruong
64d93f0c32 fix(ratelimit): refine logic based on AI review (remove 500, fix state pollution) 2026-01-22 11:47:25 +07:00
phuctruong
7450cce86e fix(ratelimit): implement robust handling for capacity/5xx errors (parity with Antigravity-Manager) 2026-01-22 11:02:59 +07:00
tctinh
734c0c0160 hive: merge 02-fix-lastused-timing (squashed) 2026-01-21 22:21:17 +07:00
Noe
3557760917 feat(search): implement google_search tool for web search with enhanced capabilities and deprecate legacy configurations 2026-01-21 00:04:10 +00:00
tctinh
814709c8e6 fix: v1.3.1 bugfixes - Zod v4 upgrade, keep_thinking, tool params, auth headers, quiet_mode
Changes:
- Upgraded to Zod v4 and adjusted schema generation for compatibility
- Fixed keep_thinking=true failing without debug mode (signature validation)
- Fixed tool calls failing for tools with no parameters (default args to {})
- Aligned auth headers with official Gemini CLI to reduce account issues
- Fixed quiet_mode not suppressing all toast notifications
2026-01-19 11:13:02 +07:00
Tinh To
cd6147b57c Merge pull request #195 from bentcc/feat/configurable-rate-limit-delays
feat: add configurable rate limit retry delays [vibe by AI]
2026-01-19 09:10:28 +07:00
Tinh To
7119ef6371 Merge pull request #226 from starkdmi/fix/image-retry-loop
Fix image retry loop
2026-01-19 09:10:10 +07:00
Romanok
4d30357918 fix: improve interactive account menu reliability 2026-01-18 05:43:15 +05:00
Dmitry Starkov
2431459664 Fix image quota wait time calculation 2026-01-17 18:59:36 +03:00
tctinh
36bac6314a refactor: remove unnecessary toast notification for thinking recovery in quiet mode 2026-01-17 04:30:14 +07:00
tctinh
1c0e331a72 Merge branch 'dev' of github.com:NoeFabris/opencode-antigravity-auth into dev 2026-01-17 00:33:00 +07:00
Noe
80efd94658 fix: update documentation and code comments for hybrid strategy implementation 2026-01-16 17:19:49 +00:00
tctinh
2313ade500 hive: merge 01-fix-capacity-exhausted-handling-to-respect-switchonfirstratelimit (squashed) 2026-01-16 22:25:03 +07:00
Noe
e698fa4f62 Improves Claude thinking block handling
Refactors how Claude thinking blocks are handled to improve reliability and address signature validation issues.

- Removes the deprecated `KEEP_THINKING_BLOCKS` constant and associated environment variable.
- Introduces runtime configuration for `keep_thinking` to control whether thinking blocks are preserved.
- Implements logic to inject a sentinel value (`SKIP_THOUGHT_SIGNATURE`) when a thinking block's signature is invalid or missing, allowing the API to bypass validation. This addresses scenarios like cache misses, session mismatches, and plugin restarts.

This change enhances the robustness of Claude integrations by providing a mechanism to handle signature issues gracefully.
2026-01-16 12:15:26 +00:00
tctinh
aea358f240 Revert "Merge pull request #194 from IsraelAraujo70/fix/treat-resource-exhausted-as-capacity"
This reverts commit 4e39d9881f, reversing
changes made to a0d924584e.
2026-01-16 17:58:41 +07:00
Ben Tin
2845cd9682 feat: add configurable rate limit retry delays
Add two new configuration options to allow users to tune rate limit behavior:

- default_retry_after_seconds: Default retry delay when API doesn't return
  a retry-after header (default: 60s, configurable 1-300s)
- max_backoff_seconds: Maximum cap for exponential backoff delay
  (default: 60s, configurable 5-300s)

These options help users who want faster retries at the cost of potentially
hitting more 429 errors, or users who prefer longer delays to preserve
prompt cache by staying on the same account.

The hardcoded 60-second values are now configurable while maintaining
backward compatibility with existing configurations.
2026-01-16 18:19:34 +08:00
Noe
d91cc28aa4 feat: add Google Search (Grounding) configuration and integration 2026-01-16 00:07:06 +00:00
IsraelAraujo70
46a944607c fix: resolve merge conflicts with upstream/dev
- Added SERVICE_CAPACITY_EXHAUSTED rate limit reason type
- Updated parseRateLimitReason to detect "resource has been exhausted" without quotaResetTime as SERVICE_CAPACITY_EXHAUSTED
- Added progressive backoff tiers for service capacity exhaustion (5s, 10s, 20s, 30s, 60s)
- Integrated global capacity tracking with upstream/dev's rate limit system
- For SERVICE_CAPACITY_EXHAUSTED: uses global in-memory cooldown (not persisted)
- For other rate limits: uses upstream/dev's account-level tracking
2026-01-15 16:01:18 -03:00
IsraelAraujo70
5353321fdf fix: corrigir revisão de código (logic, style, docs)
- Logic: capacity exhausted agora força nova seleção de conta (break ao invés de continue)
- Style: separar função de leitura de mutação (recordAndGetCapacityBackoff + calculateCapacityBackoffDelay)
- Docs: adicionar JSDoc para funções de capacity (5 funções)
2026-01-15 13:36:32 -03:00
IsraelAraujo70
bbfb06f411 fix: tratar Resource has been exhausted como capacity temporária
Problema: Quando o servidor retorna 429 com mensagem "Resource has been
exhausted" sem quotaResetTime, o plugin marca todas as contas como
rate-limited permanentemente no antigravity-accounts.json, mesmo sendo
um problema de capacidade temporária do backend.

Solução:
- Distinguir entre quota esgotada (persiste) e capacity exhausted (global)
- Capacity exhausted usa cooldown em memória por família/modelo (não persiste)
- Fluxo de quota real permanece inalterado (429 com quotaResetTime continua)

Arquivos:
- src/plugin.ts: adiciona capacidade global e helpers
2026-01-15 13:18:58 -03:00
Tinh To
7811ff002d Merge pull request #177 from frankekn/fix/model-name-transform-and-rate-limit-reason
fix: model name transformation and rate limit reason classification
2026-01-14 11:12:03 +07:00
CypherpunkSamurai
fbcf56d599 fix: refund tokens in case of network/io
Signed-off-by: CypherpunkSamurai <CypherpunkSamurai@users.noreply.github.com>
2026-01-14 02:25:13 +05:30
CypherpunkSamurai
e99f2d71ca feat: add more rotation method
add more rotation method like hybrid

Signed-off-by: CypherpunkSamurai <CypherpunkSamurai@users.noreply.github.com>
2026-01-14 01:42:34 +05:30
Frank Yang
41ad0e0a76 fix: correct parseRateLimitReason argument order and pass serverRetryMs
- Fix parseRateLimitReason(message, reason) -> parseRateLimitReason(reason, message)
- Pass serverRetryMs to calculateBackoffMs and markRateLimitedWithReason
- Add void prefix to async executeSave() in setTimeout
- Add catch block to prevent unhandled promise rejections
- Update stale test comments
2026-01-13 23:39:06 +08:00
Frank Yang
b6f3ed8293 fix: model name transformation and rate limit reason classification
- Fix double-prefix bug in resolveModelForHeaderStyle() where 'antigravity-gemini-3-flash' was being sent to API instead of 'gemini-3-flash'
- Add parseRateLimitReason() to classify rate limit errors (QUOTA_EXHAUSTED, RATE_LIMIT_EXCEEDED, MODEL_CAPACITY_EXHAUSTED, SERVER_ERROR)
- Add calculateBackoffMs() with different backoff strategies per reason type
- Add markRateLimitedWithReason() to track consecutive failures per account
- Add markRequestSuccess() to reset failure counter on success
- Add shouldTryOptimisticReset() and clearAllRateLimitsForFamily() for smarter rate limit recovery
- Integrate markRateLimitedWithReason in plugin.ts rate limit handling
- Add comprehensive tests for all new functions

Fixes #103
2026-01-13 23:01:17 +08:00
tctinh
3445cdaa88 feat: progressive rate limit retry with switch_on_first_rate_limit config
- Replace SHORT_RETRY_THRESHOLD_MS with progressive retry logic
- First 429: wait 1s, then switch account (if switch_on_first_rate_limit=true)
- Second 429: wait 5s, then switch (if switch_on_first_rate_limit=false)
- Single account: exponential backoff (1s, 2s, 4s... max 60s)
- Add switch_on_first_rate_limit config option (default: true)
- Update README with new config documentation

Fixes NoeFabris/opencode-antigravity-auth#147
2026-01-08 22:36:13 +07:00
tctinh
815068ff05 feat: add pid_offset_enabled config option (disabled by default)
- Add pid_offset_enabled config option (default: false)
- Add env var override OPENCODE_ANTIGRAVITY_PID_OFFSET_ENABLED
- Make PID-based account offset opt-in instead of always-on
- Update README with documentation

Fixes #122
2026-01-06 09:45:46 +07:00
tctinh
eedafe5947 feat: smart account routing with error differentiation
- Add account_selection_strategy config: sticky, round-robin, hybrid
- Fix capacity vs quota error handling (Issue #111)
- Capacity errors: escalating backoff (5s→60s), retry same account
- Quota errors: switch to next account immediately
- Add touchedForQuota state tracking for hybrid strategy
- Add comprehensive tests for all strategies
2026-01-05 22:53:22 +07:00