From 1bab475296d61af5822368a994d6110641614e7b Mon Sep 17 00:00:00 2001 From: Daniil Pokrovsky Date: Fri, 4 Dec 2026 19:10:07 +0700 Subject: [PATCH] feat: implement local-onboarding-funnel-telemetry-fill-gaps-in - Onboarding funnel telemetry: fill gaps in setup events --- docs/code/advanced-settings.md | 13 + packages/code/AGENTS.md | 1 + .../code/src/lib/agent/run-harness-git.ts | 2 + packages/code/src/lib/cli/prompt-abort.ts | 14 + packages/code/src/lib/init/agent-reuse.ts | 35 +- packages/code/src/lib/init/cli.ts | 17 +- packages/code/src/lib/init/try-runtime.ts | 10 +- packages/code/src/lib/init/wizard.ts | 32 +- .../src/lib/init/worker-init-activation.ts | 20 +- .../src/lib/init/worker-init-first-task.ts | 3 + .../code/src/lib/init/worker-init-host.ts | 52 +- packages/code/src/lib/init/worker-init-run.ts | 4 + .../code/src/lib/init/worker-init-steps.ts | 14 +- packages/code/src/lib/init/worker-init-try.ts | 6 + packages/code/src/lib/init/worker-init.ts | 13 +- .../code/src/lib/observability/analytics.ts | 155 +++++- .../src/lib/observability/setup-funnel.ts | 116 +++++ packages/code/src/lib/worker/cli.ts | 7 +- packages/code/tests/analytics.test.ts | 1 + packages/code/tests/setup-funnel.test.ts | 466 ++++++++++++++++++ packages/code/tests/worker-init.test.ts | 17 +- 21 files changed, 962 insertions(+), 36 deletions(-) create mode 100644 packages/code/src/lib/observability/setup-funnel.ts create mode 100644 packages/code/tests/setup-funnel.test.ts diff --git a/docs/code/advanced-settings.md b/docs/code/advanced-settings.md index b3e1c3ba0..1391b3e95 100644 --- a/docs/code/advanced-settings.md +++ b/docs/code/advanced-settings.md @@ -76,6 +76,19 @@ Files you want to keep and show in the dashboard are registered separately as ru | `DEVINTERN_TELEMETRY_DISABLED=1` | Nothing | | `{ "analytics": { "enabled": false } }` in `~/.devintern/settings.json` | One anonymous `analytics_opt_out` event, then nothing | +**Setup events.** While you run `devintern init` or `devintern worker init`, the CLI also sends one anonymous event per setup step, so we can see where people stop. Every event from one run shares a random `setup_id` (new for each run, not tied to you, your repository, or your account). Events carry only step names, the tracker and agent type, pass/fail results, short result codes (for example `agent_missing` or `git_missing`), durations, and yes/no flags (for example whether you took the default tracker). They never include repository names, URLs, queries, paths, email addresses, or tokens. + +| Event | Sent when | +| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `setup_started`, `worker_init_started` | Setup opens | +| `setup_step` | A step finishes: host checks, tracker chosen, credential check, query check, sign-in, service install, first task started | +| `setup_completed`, `worker_init_completed` | Setup finishes | +| `setup_failed`, `setup_declined`, `worker_init_failed` | Setup stops on a problem or you decline to continue, with the last step reached | +| `setup_abandoned` | You leave setup with Ctrl+C or by closing input, with the last step reached | +| `task_run`, `worker_task_run` | A task run ends; they also say whether it opened a pull request | + +`DEVINTERN_TELEMETRY_DISABLED=1` turns all of these off. + See [devintern.com/privacy](https://devintern.com/privacy/). ## Prompt overrides diff --git a/packages/code/AGENTS.md b/packages/code/AGENTS.md index 2f8d9845d..8c34679cf 100644 --- a/packages/code/AGENTS.md +++ b/packages/code/AGENTS.md @@ -126,6 +126,7 @@ Everything under the output directory is a write-only debug artifact. Durable st - **@mention runs** (`review/mention-trigger.ts`): the fleet mention handler passes the triggering comment or review as `address-review --mention :`; the GitHub review adapter re-fetches it and addresses it as feedback (plus any `changes_requested` review), so mentions work on human PRs with no reviews. Relay `pr.review_submitted` on a non-agent PR goes to `relay/mention-handlers.ts` (mention in the body or line comments only); the sweep's third feed reads review bodies of recently updated open PRs. Relay and sweep share `processed_events` ids (`github:mentions` / `comment:`, `review:`); a review body is marked addressed as `review_body`. The relay holds an in-flight claim on that id while its run is going, and the sweep skips (and holds its cursor before) a claimed mention instead of joining the run. The relay acquirer dispatches envelopes in the background (serialized per PR/task/change, `relay/cursor-window.ts` commits the cursor only past settled envelopes), so one long run never holds envelopes for other subjects. `isBotAuthored` (Bot users, `[bot]` logins, bot aliases, `