Repository navigation
fix(stats): record requests on the v2 path and persist immediately (2.4.3) - #73
Merged
Merged
Conversation
The report always said "sin actividad" because nothing on the v2 path wrote to EngineStatsManager, the 1.5s save debounce dropped one-shot runs, and a long-lived server never re-read the file. - Count each response where it happens, before the pending-queue early return that swallowed the success after a rotation: success on the serving account, 429/403 as a rate limit, other failures as errors, 404 entitlement misses excluded from health. - Write counters synchronously so `opencode run` leaves a trace. - Reload the file when another process wrote it, keeping unsaved increments.
Automated verification
typechecktestsbuild |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
antigravity_statsy/antigravity-statsmostrabanSin actividad registrada auncon cualquier volumen de trafico. Verificado: no era falta de datos, era que nadie los escribia.Causa (tres fallos encadenados)
EngineStatsManager. Solo actualizaba elAccountManager. Los unicos que escribian eranplugin.ts(interceptor v1) yrotation.ts(seleccion v1).opencode runtermina antes de que dispare el timer, asi que esas peticiones no dejaban rastro.getData()yformatStatsReport()leian memoria; si otro proceso escribia el archivo, no lo veia.Cambios
http.responseantes delreturntemprano cuando la cola de pendientes esta vacia: despues de una rotacion por 429, la peticion que finalmente responde 200 es justo la que hay que contar, y antes se perdia.lastAttemptBySession), no con la cola: el hook de retry tambien hace dequeue, lo que desalineaba la atribucion.429/403se cuentan como rate limit; un404de entitlement no se cuenta como error (es falta de capacidad, no salud de la cuenta); el error de transporte solo se cuenta cuando no hubo respuesta HTTP, para no duplicar.refreshFromDisk()recarga el archivo si otro proceso lo escribio y respeta incrementos sin guardar.Verificacion
Prueba real con las tres cuentas del pool (dos Free con la semana en 0%, una con grant):
Antes de esta prueba el archivo no existia. Coincide con la cuota medida: las dos Free devuelven 429 y la que tiene cuota sirve la peticion.
npx tsc --noEmitlimpio.npx vitest run: 43 archivos, 1154 tests, 25 todo (+4 nuevos sobre conteo, persistencia, recuperacion entre procesos y formato del reporte).npm run buildydist/regenerado en el mismo commit.