Expand the anonymous product event catalog - #425
Merged
Conversation
This was referenced Aug 8, 2026
TheGreatAxios
changed the base branch from
cl-5743-batch-the-telemetry-transport
to
main
August 9, 2026 00:07
Two upcoming event catalogs turn telemetry volume from one event per turn into one per tool call, which the previous transport would have answered with an unbounded set of concurrent per-event POSTs. Queueing behind one request bounds both sockets and memory when the endpoint is unreachable.
Dropping the singleton on opt-out left the outgoing instance's batch timer armed, so events captured before the toggle would still reach the network afterwards. Opting out speaks to activity already generated, not only to activity still to come.
Adds slash-command, skill, plugin, sub-agent, permission, compaction, and crash events to the telemetry catalog. Every identifier these events would naturally carry is named by someone other than us — an MCP server key is a settings key, a skill is a directory in the repo, a plugin id and an agent profile are author-chosen — so each is mapped to a fixed first-party enum at the emission site and reported as "custom" when it matches nothing. Emission takes Telemetry as an injected dependency rather than reading the process-wide handle, so a module built without one is silent by construction.
The auth_failure event reused error_class, which everywhere else means the JS error constructor name. One column carrying two incompatible meanings cannot be analysed, and it made the documented error_class guarantee false: the value shipped was a local send-failure kind that never passed through the classifier.
TheGreatAxios
force-pushed
the
cl-5722-expand-product-event-catalog
branch
from
August 9, 2026 00:34
56ae4c9 to
33a7896
Compare
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.
Replaces #416, rebased onto
cl-5743-batch-the-telemetry-transport(session id + batched transport).The defect this fixes
#416 sent five user-authored identifiers to PostHog, each behind a comment asserting it was already a safe enum. The comments were false:
permission_kindwas the raw tool id, which for MCP tools ismcp__<server>__<tool>where<server>is the operator's own settings key; skill names, plugin ids, and agent profile ids are all project- or author-chosen. A sixth of the same class was found and fixed:slash_command'scommand_namecame from a registry plugins also write into.Every such value is now mapped to a fixed first-party enum at the emission site (
src/telemetry/classify.ts) and reported ascustomwhen it matches nothing, withmcpas its own bucket forpermission_kind. There is no first-party list of skills or plugins to match against, soskill_usedcarries no name at all andplugin_loadedcarries onlyorigin— the discovery tier.Also
getSessionId()from the base branch instead of re-declaring it.parent_session_iddropped: sub-agents run in-process on the same session id, so it always restatedsession_id.plugin_useddropped: it fired at startup over every enabled plugin and observed nothing about use, whichplugin_loadedalready measures honestly.compactionno longer fires on no-ops, and its invertedtriggerlabel is replaced by the compactor's actualmode.crashreports only language-defined error types by name; an application or plugin error subclass buckets tocustom.permission_promptsites in the gate are one helper. They are mutually exclusive andbuildRequestsyields at most one request per call, so a prompt is counted once.Telemetryas an injected dependency, matching Emit PostHog AI observability events in privacy mode #417, rather than reading the process-wide handle.Test plan
tests/unit/telemetry-product-events.test.tsdrives each real emission site with a deliberately identifying input (mcp__acme-internal__deploy, a skill directory named after a company, a plugin manifest id containing a path, a project agent profile, a plugin-registered command) and asserts both the bucketed value and that the raw string appears nowhere in the serialized request body.bun run typecheck— 0 errors (base: 0)bun run buildbun run test— 4278 pass, 1 unrelated flake insrc/tui-opentui/markdown-rows.test.ts(passes in isolation, no file it touches is in this diff)bun test ./src ./tests ./evals --randomize— 4279 pass, 0 failBranch updated by rebase (authorized)
This PR branch was rebased onto
mainand force-updated. The pre-rebase head was56ae4c98a. Those commits remain fetchable from that SHA.This updates the branch behind this pull request; it does not bypass review. The PR still merges through review as normal. A plain push is refused after a rebase rewrites history, which is the only reason a force update was needed. Authorized by the operator.
Why the rebase was necessary
#412 was squash-merged to
main, and #423 was squash-merged into its own base branchcl-5727-posthog-identity-session-linkingafter that branch had already merged. The #423 squash therefore never reachedmain:maincarries three telemetry events, no/batch/endpoint and nodiscard().Rebasing this branch with
cl-5743-batch-the-telemetry-transportas the upstream would have silently dropped the entire batching transport and the opt-out discard, without raising a conflict. The rebase instead used the top of the squashed #412 commits as the upstream, so only genuinely duplicated work was dropped. The batching commits replayed with zero conflicts, which is the evidence that this was the correct shape.This PR is currently the only path by which the batching transport and the opt-out discard reach
main.cl-5727-posthog-identity-session-linkingmust not be deleted until this lands.