feat: add askgh_repo_index_requested PostHog event
Fixes SOU-2252
Summary
Add a new PostHog event (askgh_repo_index_requested) that fires when Ask GH requests that a repo be indexed through the POST /api/experimental/add-github-repo endpoint.
Problem
On the public app (app.sourcebot.dev), repos can be indexed via Ask GH but there was no PostHog event that attributes who requested the index. We couldn't answer "who requested indexing of torvalds/linux?"
Solution
Emit a PostHog event at the moment an Ask GH index is requested. Requester identity is handled automatically by PostHog's distinct_id (via captureEvent / tryGetPostHogDistinctId), so the event payload only needs repo context.
Event Name
askgh_repo_index_requested
Properties
| Property | Type | Description |
|---|---|---|
owner | string | GitHub repository owner |
repo | string | GitHub repository name |
repoName | string | Combined owner/repo string for easy filtering |
Requester identity (signed-in vs anonymous) is inferred from PostHog's built-in distinct_id.
Querying in PostHog
Find all index requests for a specific repo:
askgh_repo_index_requested where repoName = 'torvalds/linux'
Find requests by a specific user:
Filter by distinct_id (user id for signed-in, install id for anonymous).
Where it fires
packages/web/src/features/workerApi/actions.ts - in the addGithubRepo server action, after the backend successfully processes the repo index request.
Testing
- The event uses the existing
captureEventhelper which automatically handles identity viatryGetPostHogDistinctId - Signed-in users are identified by their user id; anonymous requests collapse to the install id


Summary by cubic
Tracks successful Ask GH repo index requests in PostHog so we can attribute who requested indexing.
- Emits
askgh_repo_index_requestedafter the index request is processed, capturingowner,repo, andrepoName. - Requester identity is handled by PostHog's built-in distinct ID from
captureEvent, so no custom identity properties are tracked.
Summary by CodeRabbit
- Analytics
- Added tracking for GitHub repository indexing requests, including the repository owner, repository, and repository name.
- Repository indexing requests continue to use the existing response validation and HTTP error handling.