Closing the Notch during a usage check blocks usage checks for 5 minutes
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 77/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- swift
- Ambito
- backend, mobile-dev
Direzione di ricerca
Riproduci prima il problema abilitando l’utilizzo di AI, aprendo brevemente il Notch e riaprendolo; poi segui fetch e read in CatNotchCore/AiLimits.swift per confermare in che modo la cancellazione influisce sulla lettura e sul back-off. Aggiungi i due casi di cancellazione a CatNotchCoreTests/AiLimitsTests.swift, verificando che non venga impostato alcun back-off e che la lettura precedente rimanga invariata. Esegui i test esistenti di AiLimits e conferma che passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[!NOTE]
This issue was raised by Claude (AI code review), not from a user report. Before you start, confirm the problem really exists: reproduce it, or trace the code path yourself. If it does not reproduce, comment here with what you checked and we will close it.The fix ideas and file names below are suggestions, not requirements. If a different or larger change is the right fix, go with it and explain why in the PR. The maintainer will review and merge.
Labels: bug, good first issue, ready-for-agent · Difficulty: easy (about 1 to 2 hours)
Problem
The AI usage numbers on Home are fetched when the Notch opens (spec 0041 AC-1). The fetch runs in a SwiftUI .task(id:) (CatNotch/NotchBody.swift:711), so closing the Notch cancels it. The cancellation reaches URLSession.data, which throws URLError.cancelled. fetch in CatNotchCore/AiLimits.swift:214-216 turns any error into .failed(.unavailable), and read then sets blockedUntil to now plus 5 minutes (AiLimits.swift:200-202).
So hovering the Notch open and closing it quickly blocks usage checks for 5 minutes. You get stale numbers, or "Tap to retry" on a first launch with no cache. The retry tap is also ignored while a poll is in flight (CatNotch/UsageModel.swift:49, the refreshing guard), so the spinner turns and nothing is checked again.
Steps to reproduce
Turn on AI usage, hover the Notch open and move away within a second, then open it again. The numbers are not refreshed for 5 minutes.
Expected outcome
A cancelled fetch (CancellationError or URLError.cancelled) is "no reading": it does not set blockedUntil and does not replace the last good reading.
Relevant files
CatNotchCore/AiLimits.swift(fetch,read)CatNotch/UsageModel.swiftCatNotchCoreTests/AiLimitsTests.swift- Spec:
docs/specs/0041-usage-refresh-on-open.md
Acceptance criteria
- A test in
AiLimitsTests.swiftwheresendthrowsCancellationError(and one withURLError(.cancelled)) shows no back-off is set and the previous reading is kept. - Existing
AiLimitstests still pass.
- Lingua principale
- Swift
- Stelle
- 1
- Fork
- 1
- Merge medio
- 3h 11m
- PR unite (30g)
- 28
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di thecharydev/catnotch
-
Claude settings.json can be overwritten when unreadable, and a symlinked one becomes a plain fileApertabug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
thecharydev/catnotch#66 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
thecharydev/catnotch#41 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
thecharydev/catnotch#40 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
thecharydev/catnotch#39 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
thecharydev/catnotch#74 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di thecharydev/catnotch
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
openwatersio/slackwater-ios#976 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
difficulty: beginner documentation help wanted networking
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
openwatersio/slackwater#591 ·
I maintainer di solito rispondono entro 1 giorno