Skip to content

feat: add askgh_repo_index_requested PostHog event - #1658

Draft
msukkari wants to merge 3 commits into
mainfrom
cursor/askgh-repo-index-posthog-event-5251
Draft

msukkari wants to merge 3 commits into
mainfrom
cursor/askgh-repo-index-posthog-event-5251

Conversation

@msukkari

@msukkari msukkari commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

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, with properties that identify the requester.

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
isAnonymous boolean Whether the requester is anonymous (not authenticated)
anonymousCreatorId string? Anonymous session ID (only present when isAnonymous is true)
repoId number The created/existing repo ID in the database

Querying in PostHog

Find all index requests for a specific repo:

askgh_repo_index_requested where repoName = 'torvalds/linux'

Find all anonymous vs signed-in requests:

askgh_repo_index_requested broken down by isAnonymous

Find requests by anonymous session:

askgh_repo_index_requested where anonymousCreatorId = '<session_id>'

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 captureEvent helper with proper user identity handling
  • Anonymous users get tracked via anonymousCreatorId (same session cookie used for anonymous chat ownership)
  • Signed-in users get tracked via their PostHog distinct_id
Open in Web Open in Cursor 

Summary by cubic

Tracks successful Ask GH repo index requests in PostHog so we can attribute who requested indexing.

  • Emits askgh_repo_index_requested after the index request is processed, capturing owner, repo, repoName, and repoId.
  • Requester identity is handled by PostHog's built-in distinct ID from captureEvent, so no custom identity properties are tracked.

Written for commit a86cf5b. Summary will update on new commits.

Review in cubic

Emit a new PostHog event when Ask GH requests a repo index via
POST /api/experimental/add-github-repo. The event includes:

- owner: GitHub repo owner
- repo: GitHub repo name
- repoName: Combined owner/repo string
- isAnonymous: Whether the requester is authenticated
- anonymousCreatorId: Anonymous session ID (when anonymous)
- repoId: Created repo ID

This enables tracking who requested indexing of repos through Ask GH.

Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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

Comment @coderabbitai help to get the list of available commands.

cursoragent and others added 2 commits September 15, 2026 04:07
Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
Remove identity properties (isAnonymous, anonymousCreatorId, userId, email)
since PostHog's built-in distinct_id from captureEvent already handles
requester identification. Keep only repo fields: owner, repo, repoName, repoId.

Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.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.

2 participants