Skip to content

fix(usage): deliver CLI telemetry without next-day return - #5271

Open
huangruiteng wants to merge 2 commits into
mainfrom
codex/usage-same-day-batches
Open

huangruiteng wants to merge 2 commits into
mainfrom
codex/usage-same-day-batches

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

CLI telemetry previously depended on a later UTC-day invocation, so a short-lived installation could report its heartbeat but never deliver any command results. This change attempts the first measured result immediately and sends subsequent buffered deltas on eligible activity at least 15 minutes apart, including across midnight.

The existing TypeScript usage-statistics owner retains consent, opt-outs, local locking and the identifier-free aggregate payload. Heartbeat and aggregate claims start their requests under the same short lock after persistence; network waits stay outside it. Existing daily buffers remain readable. No collector migration or new configuration is required. App Device defaults and the English/Chinese documentation explain the new cadence; Goal-duration snapshots retain their daily schedule.

Validation:

  • 56 TypeScript/collector tests passed: first failed result, same-day batching, midnight spacing, expiry/upgrade, concurrent claims, disable, clock rollback, malformed buffers, HTTP redirects/timeouts and real SQLite ingestion.
  • 29 Python tests passed, including the real CLI → detached TypeScript → HTTP path, unchanged command output, nonblocking delivery, proxy support and the shared App settings API.
  • Control-plane typecheck and packaged Chat frontend build passed. Vite retains its existing large-chunk advisory.
  • Ego Lite checked the packaged settings against an isolated real settings backend: English/Chinese copy, desktop/narrow layout, keyboard toggle, disabled payload readback and return navigation. The existing collapsed details and controls are retained; the cadence sentence replaces the stale daily-delivery claim. No public landing/first-screen layout changed.
  • Diff whitespace and public-boundary scan passed. Local runtime state, browser artifacts and generated bundles are excluded.

Tradeoff: this is still lossy, activity-triggered diagnostics. Quiet sessions can leave an unsent tail, failed batches are not retried, and aggregate receipt dates/versions cannot be joined to installation counts. Active installations may send up to one batch per 15 minutes instead of one per day; more frequent requests can expose more network timing correlation. Payload fields and recipient authority are unchanged.

Future-facing pass: reused the existing typed owner and locking seam, removed the aggregate dependency on the daily heartbeat claim, and added no parallel sender, scheduler, version dimension or identity field.

This changes runtime behavior and is left for maintainer review and merge. It does not update installed clients or deploy a release.

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant