feat: add kilo_user_id to welcome Typeform survey hidden fields#384
feat: add kilo_user_id to welcome Typeform survey hidden fields#384kiloconnect[bot] wants to merge 1 commit intodevfrom
Conversation
- Add id field to KilocodeProfile type and profile API parsing - Create buildWelcomeSurveyUrl helper in kilo-gateway - Create welcome-survey module in VS Code extension - Open welcome survey after successful login with email + kilo_user_id - Update server routes schema to include profile id
| kiloUserId: profileData.profile.id, | ||
| }) | ||
| vscode.env.openExternal(vscode.Uri.parse(surveyUrl)) | ||
| } |
There was a problem hiding this comment.
WARNING: Survey opens on every login, not just first-time signup
This code runs unconditionally after every successful login. Returning users who re-authenticate (e.g., token expired) will get the welcome survey opened in their browser every time. Consider gating this behind a check — e.g., a globalState flag like kiloSurveyShown, or a backend signal indicating the user is newly created.
// Example approach:
const alreadyShown = this.context.globalState.get<boolean>("kiloSurveyShown")
if (!alreadyShown && profileData?.profile.email) {
const surveyUrl = buildWelcomeSurveyUrl({ ... })
vscode.env.openExternal(vscode.Uri.parse(surveyUrl))
this.context.globalState.update("kiloSurveyShown", true)
}| * @param options.kiloUserId - Kilo internal user ID | ||
| * @returns Fully-qualified Typeform URL with hidden fields as query params | ||
| */ | ||
| export function buildWelcomeSurveyUrl(options: { email: string; kiloUserId?: string }): string { |
There was a problem hiding this comment.
SUGGESTION: Duplicate code with packages/kilo-vscode/src/services/welcome-survey.ts
This function is identical to the one in the vscode package. While the vscode extension can't depend on @kilocode/kilo-gateway directly (it's bundled separately), having two copies means bug fixes or URL changes need to be applied in both places. Consider extracting this into a shared utility package (e.g., @opencode-ai/util) that both can depend on, or at minimum add a comment cross-referencing the other copy.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (9 files)
|
Summary
Add
kilo_user_idas a hidden field to the Typeform welcome/onboarding survey so survey responses can be linked back to users without relying on PII (email).Changes
kilo-gateway
src/types.ts— Add optionalidfield toKilocodeProfileinterfacesrc/api/profile.ts— Parseidfrom the backend profile API response (user.idor top-levelid)src/api/survey.ts(new) —buildWelcomeSurveyUrl()helper that constructs the Typeform URL withemailandkilo_user_idhidden fieldssrc/index.ts— ExportbuildWelcomeSurveyUrlsrc/server/routes.ts— Addidto the Profile zod schemakilo-vscode
src/services/welcome-survey.ts(new) — LocalbuildWelcomeSurveyUrl()for the VS Code extensionsrc/KiloProvider.ts— After successful login, open the welcome survey URL with bothemailandkilo_user_idhidden fieldssrc/services/cli-backend/types.ts— Addid?toKilocodeProfilewebview-ui/src/types/messages.ts— Addid?toProfileData.profileHow it works
After a user completes the login flow, the extension builds a Typeform URL like:
and opens it in the user's default browser via
vscode.env.openExternal().Built for joao by Kilo for Slack