feat: add PostHog telemetry - #424
Merged
Merged
Conversation
dimavedenyapin
added a commit
that referenced
this pull request
Jul 27, 2026
…nflicts) Brings the transcript stack up to date with main (10 commits: PostHog analytics #424/#425/#426, codex fixes #423/#427, releases) and resolves the conflicts for the #421 → main merge. Key resolutions: - agent-manager.ts resumeAdapterSession / replayMissedTranscriptPartsBeforeIdle: keep our event-sourced model (resume never replays history to the renderer; clients render the durable projection) AND keep main's #427 assistantTextKeys codex reconciled-text dedup. In the idle-replay path both dedup layers now run — main's assistantTextKeys AND our projection-content dedup — which are complementary against the codex agent-msg_/agent-item id-scheme mismatch. - Renderer + mobile agent-store: took our projection-cache rewrite and re-applied main's PostHog telemetry (agent_session_status_changed, agent_output_batch_received, agent_approval_requested, agent_created/updated/deleted, agent_session_stopped). - use-agent-session.ts: kept the "Starting…"/pendingSend send flow AND main's agent_message_sent analytics in both send branches. - agent-manager.test.ts: kept BOTH codex-dedup regression tests (projection-content and assistantTextKeys) as separate cases, since both mechanisms now exist. Verified: typecheck clean, build ✓, full suite 1579 passing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
POSTHOG_KEYis configured;POSTHOG_HOSTand telemetry buffering controls can be overridden through environment variables.Local setup
export POSTHOG_KEY=<project-key>.export POSTHOG_HOST=https://us.i.posthog.com,export TELEMETRY_ENABLED=true,export TELEMETRY_FLUSH_BATCH_SIZE=20,export TELEMETRY_MAX_BUFFERED_EVENTS=1000.pnpm dev; events flush from the main process to${POSTHOG_HOST}/batch/.TELEMETRY_ENABLED=falseor omitPOSTHOG_KEY.Release environment setup
POSTHOG_KEYas a repository or environment secret for the release environment.POSTHOG_HOST,TELEMETRY_ENABLED,TELEMETRY_FLUSH_BATCH_SIZE, andTELEMETRY_MAX_BUFFERED_EVENTS.env: { POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}, POSTHOG_HOST: ${{ vars.POSTHOG_HOST }}, TELEMETRY_ENABLED: ${{ vars.TELEMETRY_ENABLED }}}.Test plan
pnpm typechecknode node_modules/eslint/bin/eslint.js src/main/analytics-service.ts src/main/index.ts src/main/agent-manager.ts src/main/ipc-handlers.ts(passes with one existing warning insrc/main/agent-manager.ts)Generated with Codex