Repository navigation
fix(mastra): turn Mastra's PostHog telemetry off by default - #64
Merged
Merged
Conversation
@mastra/core sends usage events to us.posthog.com from every Mastra instance unless MASTRA_TELEMETRY_DISABLED is set, and the mastra CLI does the same for Studio. Nothing in the scaffold set it, so every deployed app reported to a US processor that no project declares. Keur flagged this on a client app as SCH-LEG-003 (PostHog reachable via posthog-node, undeclared). The runtime default lives in server/mastra/index.ts, before new Mastra(), so it covers Nitro, Studio and the production image alike; the Studio task passes the same default to the CLI. Both use ??=, so a project can still opt in with MASTRA_TELEMETRY_DISABLED=false.
christian-at-sevenlab
requested review from
joris-sevenlab and
nielsvanrijn-sevenlab
October 6, 2026 14:19
joris-sevenlab
approved these changes
Oct 7, 2026
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 this changes
Scaffolded apps no longer send Mastra usage telemetry to PostHog by default.
server/mastra/index.tssetsMASTRA_TELEMETRY_DISABLED ??= 'true'beforenew Mastra(), and themastra:studiotask passes the same default to the Mastra CLI.Why
@mastra/coresends feature-usage events (hashed hostname, OS, Node and Mastra versions, which features are used) tous.posthog.comfrom every Mastra instance unlessMASTRA_TELEMETRY_DISABLEDis set to1/true/yes. ThemastraCLI does the same for Studio. Nothing in the scaffold set it, so every deployed app reported to a US third party that no project declares as a processor. Keur flagged it on a client app as SCH-LEG-003 (PostHog reachable viaposthog-node, undeclared).Putting the default in
server/mastra/index.tscovers every path through one line: Nitro, Studio's bundle and the production image.??=keeps an explicitMASTRA_TELEMETRY_DISABLED=falseworking for a project that wants to opt in.Type of change
AI assistance
Agent, service and model, if you know it: Claude Code, Opus 5.5
How much of this is agent-written?
Feature versions
version(nuxt4:mastra2.1.1 → 2.1.2)collectDocsorcollectEnvcontribution, and also bumped the feature that writes the target fileTesting
pnpm tscpassespnpm testpasses (except the WSL-only browser test above, unrelated)Not scaffolded end to end. The same setting (as an image
ENV) runs in a client app built from this stack.Checklist
packages/*/templates/**are LFAnything else
server/mastra/index.tswas customised (most of them, since agents get registered there) will get a.battlestack.patchonpullrather than a clean update. Until that is merged by hand,MASTRA_TELEMETRY_DISABLED=truein the deploy environment does the same job.collectDocs), which would also need anuxt4:docsbump. Happy to add it if you want the opt-in documented there.posthog-nodestays in the dependency tree as a transitive dep of@mastra/core; only the network traffic stops.