Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

opencodego: background refresh reports 100% free quota, manual refresh shows real quota

Chiusa
#4,805 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@egigoka ci sta già lavorando.

Dal 27/10/2026.

  • #4806 di @egigoka — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
swift
Ambito
backend, devtools

Direzione di ricerca

Read Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift and the refresh pipeline’s applyProviderRefreshSuccess behavior to understand how a local estimate can replace an authoritative snapshot. Then inspect Tests/CodexBarTests/OpenCodeGoWebOverlayTests.swift and run the named regression test; done means background refresh preserves the prior snapshot when the web overlay is transiently unavailable, while the documented exemptions retain their fallback behavior. A linked open pull request (#4806) is already pursuing this fix.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2

Symptom

With the opencode-go provider in auto mode, every background (timer) refresh shows 100% free quota. A manual Refresh Now immediately loads the real quota. The next background tick clobbers it back to 100% free.

Root cause

OpenCodeGoLocalUsageFetchStrategy.snapshot(context:) (Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift) unconditionally returns its local-only fallback (quotaIsAuthoritative=false, published as .estimated) when the web overlay is unavailable. The pipeline (applyProviderRefreshSuccess) then publishes that estimate over the last good authoritative snapshot.

Background ticks run under ProviderInteractionContext.background, where BrowserCookieAccessGate skips browser import (no-UI Keychain preflight) and CookieHeaderCache.observeForConditionalMutation can report .keychainTemporarilyUnavailable. So in the background there is usually no cookie, the web overlay resolves to nil, and the strategy publishes a pure-local estimate. A local DB with no recent costs yields 0% used percents, i.e. "100% free". Manual refresh runs as .userInitiated, the cookie import succeeds, and the real quota loads.

Deterministic repro (no UI screenshots possible — needs a real account plus a timed background tick)

New regression test background refresh preserves prior snapshot when cached web overlay is transiently unavailable (Tests/CodexBarTests/OpenCodeGoWebOverlayTests.swift) run against base 5f93dc306 fails exactly the buggy way — old code returns a local estimate with rollingUsagePercent: 0.0 instead of failing so the prior snapshot is preserved:

Expectation failed: an error was expected but none was thrown ...
  sourceLabel: "local", ... rollingUsagePercent: 0.0 ...
  dataConfidence: estimated

Fix (PR to follow)

In background auto-mode refreshes, throw instead of publishing a non-authoritative local-only result when a web overlay may still be reachable (cached session exists or Keychain read was gated). The failure path preserves the prior authoritative snapshot; the next manual refresh retries the overlay with interaction allowed. Exempt when the cookie cache is definitively empty (first-run/logged-out users keep the local estimate), when cookieSource is manual/off, and manual refreshes (unchanged fallback UX).

Lingua principale
Swift
Stelle
22.8k
Fork
2.2k
Merge medio
21h 49m
PR unite (30g)
368

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di steipete/CodexBar

Tutte le issue di steipete/CodexBar

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.