graphify icon indicating copy to clipboard operation
graphify copied to clipboard

Document Gemini free-tier quota behavior (daily cap vs per-minute) — retries currently waste time against an unrecoverable wall

Open AutogenousEngine opened this issue 3 months ago • 0 comments

Summary

When GEMINI_API_KEY/GOOGLE_API_KEY is set, SKILL.md directs the pipeline to graphify.llm.extract_corpus_parallel(files, backend="gemini"). On a free-tier key, two different quota errors can occur, and only one of them is recoverable by retrying:

  1. generativelanguage.googleapis.com/generate_content_free_tier_input_token_count (per-minute, GenerateContentInputTokensPerModelPerMinute-FreeTier) — recoverable; waiting ~60s and reducing max_concurrency clears it.
  2. generativelanguage.googleapis.com/generate_content_free_tier_requests (per-day, GenerateRequestsPerDayPerProjectPerModel-FreeTier, observed limit: 20 requests/day on gemini-3-flash) — not recoverable by retrying, backing off, or reducing concurrency. Every retry against this wall just burns another one of the ~20 daily requests for no benefit.

I spent three retry cycles (with backoff, then with max_concurrency=1) before recognizing the second error was a hard daily cap, not a transient rate limit, and falling back to subagent dispatch.

Proposed fix

  • Document both error classes explicitly in the skill's Gemini section, with the literal string to match on (generate_content_free_tier_requests vs generate_content_free_tier_input_token_count).
  • Instruction: on the daily-cap error, stop retrying immediately and fall back to subagent dispatch for the remaining uncached files — do not attempt another extract_corpus_parallel call, even with reduced concurrency.
  • Worth noting in the docs generally: check_semantic_cache / save_semantic_cache key their cache entries to the extraction prompt fingerprint. The Gemini backend's internal prompt differs from references/extraction-spec.md (used by subagent dispatch), so partial progress made via Gemini is not visible to a subsequent subagent-based run's cache check (0 hits, all files re-treated as uncached). If a provider switch mid-run is a supported recovery path, it might be worth either (a) documenting that a provider switch means starting over on caching, or (b) unifying the cache key so partial progress carries over.

AutogenousEngine avatar Aug 17 '26 22:08 AutogenousEngine