fix(desktop): pass Amplitude API key to controller launchd service#763
Merged
fix(desktop): pass Amplitude API key to controller launchd service#763
Conversation
Controller analytics service checks for amplitudeApiKey on startup and silently skips all event tracking when missing. The key was passed as a build-time env var in CI but never injected into the controller's launchd plist, so session_start and skill_use events were never sent in packaged mode.
mrcfps
approved these changes
Apr 2, 2026
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76ca51601b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…aged mode Codex review correctly identified that process.env.AMPLITUDE_API_KEY is empty in packaged Finder launches. Write the key into build-config.json at dist:mac time and read it back via getDesktopRuntimeConfig(), matching the existing pattern for SENTRY_DSN and other build-time values.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Pass
AMPLITUDE_API_KEYenvironment variable to the controller process via launchd plist.Why
Controller's
analytics-service.tschecksamplitudeApiKeyon startup — if missing, it silently skips all event tracking (session_start,skill_use,user_message_sent). The key was injected as a CI build-time env var but never added to the controller's launchd plistEnvironmentVariables, so these events were never sent in packaged desktop builds.How
amplitudeApiKey?: stringtoPlistEnvinterface andLaunchdBootstrapEnvinterfaceAMPLITUDE_API_KEYinto controller plist when present (same pattern asNEXU_HOME,OPENCLAW_GATEWAY_TOKEN)process.env.AMPLITUDE_API_KEYfrom Electron main process to bootstrap envAffected areas
Checklist
pnpm typecheckpassespnpm lintpassesanytypes introduced (useunknownwith narrowing)