Skip to content

Expand desktop launch analytics, usage retries, and v2 notice - #4620

Open
icedevera wants to merge 4 commits into
feat/launch-analytics-drivefrom
feat/launch-analytics-desktop
Open

icedevera wants to merge 4 commits into
feat/launch-analytics-drivefrom
feat/launch-analytics-desktop

Conversation

@icedevera

@icedevera icedevera commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Problem

Desktop usage reporting sent a narrow set of v1 events, dropped usage batches permanently on transient network or 5xx/429 errors, lacked activation and tool-invocation metrics (app_active_heartbeat, app_update_event, workspace_added, feature_used, tool_invoked, crash_signal), and did not re-notify upgraded installs before sending expanded usage data.

Change

Stacked on #4616 (feat/launch-analytics-drive), companion to #4611 (feat/launch-analytics-site).

  • Shared PostHog helpers (reportingConfig.ts, telemetry.ts): Reuses posthogProject and rateLimitMs from @dohc/service-http/telemetry so desktop and Drive services share one batch-endpoint derivation and rate-limit parser.
  • Schema v2 & bounded usage retries (telemetry.ts): Adds base properties (schema_version: 2, server_kind), per-event uuid for PostHog deduplication, bounded exponential backoff + Retry-After handling for transient usage failures, and immediate abort + generation invalidation when usageReports turns off (so an aborted batch can never requeue after toggling off and back on). Error reports remain unlinkable with fresh random distinct_id per report.
  • Downgrade-safe v2 notice & prior crash dedupe (telemetry.ts, useReportsNotice.ts, ReportsSettings.tsx): Leaves reporting.json (ReportingState.strict()) unchanged so older nightlies keep working on downgrade, and tracks usageNoticeVersion: 2 and lastCrashSeq in sibling reporting-notice.json. Upgraded installs keep their existing installId and see updated v2 notice wording once before expanded usage events leave.
  • Closed-enum launch events (telemetry.ts, main.ts, electronUpdater.ts, desktopWindows.ts, cliUsage.ts, cliServer.ts):
    • app_launched (recorded after settings apply so has_agents_configured reflects real settings, plus bucketed workspace counts), app_active_heartbeat (once per UTC day on renderer activity), app_update_event (firing install_started once before quit()/quitAndInstall()), workspace_added (deduping mount_share alreadyAdded), workspace_opened (createWorkspaceOpenTriggers preserving overlapping auto_restore and deep_link triggers via synchronous onTarget window binding), feature_used (renderer IPC writes, skipping collections-refused), tool_invoked (CLI/MCP writes plus failed/refused reads with exhaustive compile-time read/write classification and refusal handling for collections-refused, automationPress confirmations, and MembersResult refusals), and UTC-hour-coarsened crash_signal (filtering non-crash unhandled rejections).
    • Keeps local usageStore.ts strictly local and decoupled from telemetry.
  • Docs (docs/reference/usage-and-error-reports.md, docs/engineering/desktop-release.md): Documents the v2 event catalog, honest crash_signal correlation limits, and ALLOWED_TELEMETRY_KEYS alignment.

Risk & rollback: reporting.json is unchanged; reverting this PR leaves reporting-notice.json unused and harmless.

Verification

Tested on commit de9fc5851 (Windows):

  • pnpm fmt — clean
  • pnpm lint — 0 warnings, 0 errors across 4,717 files
  • pnpm --filter @dohc/desktop typecheck — passed across all 10 tsconfigs
  • Targeted Vitest suite (reportingConfig.test.ts, telemetry.test.ts, cliUsage.test.ts, usageBoundary.test.ts, cliServer.analytics.test.ts, cliAccount.test.ts, electronUpdater.test.ts, desktopWindows.test.ts, ReportsSettings.test.tsx, useReportsNotice.test.tsx, DesktopWorkspaceShell.reports.test.tsx) — 11 files, 136/136 tests passed (verified after final edits on cliUsage.test.ts, cliServer.analytics.test.ts, telemetry.test.ts)
  • pnpm --filter @dohc/desktop run test:scripts:isolated — 137/137 passed (0 failed, including check-error-symbolication.test.mjs)

Unverified locally: Full Electron desktop launch and live PostHog ingestion (desktop first-run notice UI and Electron Playwright verification follow in the companion PR 4; full GitHub CI checks run on this PR).

Council review

Reviewer Model Verdict Score Round
Claude Opus claude-opus-5-5 approve 8/10 R1
Gemini Neon gemini-4-neon approve 9/10 R2
GPT Sol gpt-6.2-sol approve 9/10 R3

Created with Gemini 4 Neon in T3 Code.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b9caab26-f0be-41e4-a67c-07281a8452a1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T07:34:47.767028Z de9fc58 PR opened
🔒 Security Review ✅ Completed 2026-11-25T07:34:37.352266Z de9fc58 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de9fc58512

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/telemetry/telemetry.ts Resolved
Comment thread apps/desktop/src/telemetry/telemetry.ts Resolved
Comment thread apps/desktop/src/telemetry/telemetry.ts Resolved
Comment thread apps/desktop/src/telemetry/telemetry.ts Resolved

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