Prevent unfinished run windows from hiding standalone usage

Chiusa
#15,023 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@atomantic ci sta già lavorando.

Dal 6/11/2026.

  • #15105 di @atomantic — integrata

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

area:devtools bug effort:high in-progress model:heavy plan

Problem

loadRunWindows in server/services/usageInteractiveScan.js uses now as the upper bound of every saved run without endTime. A stale, already-dead run can therefore suppress unrelated later standalone sessions in the same workspace. The interactive scan then advances its watermark past the excluded events, so a later correction to run metadata alone cannot recover them. Read-only source/ledger comparison attributed missing standalone counts to this behavior.

This is separate from #3211's historical run-lifecycle closure fix.

Chosen approach

Determine run ownership from existing authoritative process/runner lifecycle state. Keep demonstrably active windows excluded. Do not invent an end time, kill runs, or rely on an age-only heuristic. Treat ambiguous lifecycle windows as unresolved coverage and retain recoverable scan intervals instead of permanently advancing away from them.

Add an explicit date-bounded preview/replay for previously skipped intervals. Apply only provable missing attribution and preserve uncertain totals. Use existing scan/cursor and worker structures with bounded processing rather than a global runtime scan. Reuse compressed/archive source discovery from #15022 when available, but keep the raw-source regression and lifecycle fix independently testable.

Affected areas

server/services/usageInteractiveScan.js and its tests, the existing authoritative runner-state helper, usageBackfillWorker.js, and the existing reconciliation report/action.

Acceptance criteria

  • An active run still excludes matching interactive events.
  • A stale dead run with null endTime does not exclude unrelated later sessions in the same workspace.
  • Unknown lifecycle state remains visible and recoverable instead of silently discarding coverage.
  • Scan interruption/retry does not lose intervals or double count.
  • Existing completed-window overlap behavior is preserved.
  • Preview does not mutate live history; any repair is explicit, limited to proven attribution and idempotent.
  • Tests use synthetic fixtures and do not invoke providers, alter live run records or execute a historical migration.

hardwareRequirements: []

Dispatch: model:heavy for lifecycle/accounting ownership; effort:high for active, unknown, dead and replay tests. Planner attribution is omitted because no verified planner-model identifier was supplied.

Lingua principale
JavaScript
Stelle
38
Fork
32
Merge medio
32m
PR unite (30g)
994

Preparare l'ambiente

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 atomantic/PortOS

Tutte le issue di atomantic/PortOS

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.