Skip to content

feat(telemetry): add autoresearch usage tracking#193

Open
bbsngg wants to merge 1 commit intomainfrom
feat/autoresearch-telemetry
Open

feat(telemetry): add autoresearch usage tracking#193
bbsngg wants to merge 1 commit intomainfrom
feat/autoresearch-telemetry

Conversation

@bbsngg
Copy link
Copy Markdown
Contributor

@bbsngg bbsngg commented Apr 17, 2026

Summary

  • Adds dedicated autoresearch_* telemetry events covering the full usage funnel: hub discovery → pack/workflow selection → configuration → message submission → backend run lifecycle
  • New helper src/utils/autoresearchTelemetry.ts with micro-batched queue (reuses existing /api/telemetry/events pipeline and isTelemetryEnabled() opt-out)
  • Backend server/routes/auto-research.js emits autoresearch_run_started, _task_completed, _finished (with outcome + duration), and _cancel_requested via enqueueTelemetryEvent
  • Backfills data-telemetry-id on autoresearch buttons so existing ui_click events gain semantic identifiers as a backup data lane

Why

Existing telemetry only captures generic DOM events (ui_click, ui_change, ui_submit) plus agent_dialogue_meta. It cannot answer core product questions: which pack are users picking? Which workflow is most used? Does the config flow convert? Are autoresearch runs finishing or failing? This PR closes that gap with a focused event set.

Privacy

  • User input content is never sent — only input_length, command (from scenario_id), and attachment_count
  • project_path is SHA256-hashed (first 16 chars) before emission
  • API keys / env var values are dropped; only key names and filled-count are reported
  • Server-side sanitizer (server/routes/telemetry.js BLOCKED_EVENT_KEYS) continues to strip content / prompt / output / message / context as a second line of defense

Events added

Frontend (source: autoresearch-ui): autoresearch_hub_opened, _hub_viewed, _dropdown_toggled, _pack_expanded, _workflow_selected, _scenario_clicked, _config_section_opened, _mcp_selected, _configure_clicked, _configure_result, _guide_toggled, _guide_dismissed, _message_sent

Backend (source: auto-research-backend): autoresearch_run_started, _run_task_completed, _run_finished (outcome: completed/failed/cancelled + duration_ms), _run_cancel_requested

Test plan

  • npm run typecheck passes
  • npm run build passes
  • Backend module imports without errors
  • Manual: start dev server, open Auto Research hub via sidebar, expand a pack, select a workflow in chat dropdown, verify POSTs to /api/telemetry/events contain the new event names and no user content
  • Manual: toggle Settings → Data Transfer off, repeat above, verify no requests are sent
  • Manual: trigger a full autoresearch run (start → task completes → finish), verify backend emits autoresearch_run_started and _run_finished with correct outcome
  • Manual: cancel an active run, verify autoresearch_run_cancel_requested is emitted

🤖 Generated with Claude Code

Adds dedicated autoresearch_* telemetry events covering the full usage
funnel: hub discovery, pack/workflow selection, configuration, message
submission, and backend run lifecycle (started / task_completed /
finished / cancel_requested). Also backfills data-telemetry-id on key
DOM elements so existing ui_click events gain semantic identifiers.

Privacy: user input content is never sent — only input_length, command
name (from scenario_id), and attachment counts. Project paths are
SHA256-hashed. Existing server-side sanitizer continues to strip any
content/prompt/output fields as a second line of defense.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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