Skip to content

fix: inject PostHog config into release builds - #426

Merged
dimavedenyapin merged 1 commit into
mainfrom
task/posthog-build-env-injection
Jul 20, 2026
Merged

fix: inject PostHog config into release builds#426
dimavedenyapin merged 1 commit into
mainfrom
task/posthog-build-env-injection

Conversation

@dimavedenyapin

Copy link
Copy Markdown
Contributor

Summary

  • Inline PostHog telemetry configuration into the Electron main bundle at build time through electron.vite.config.ts.
  • Pass POSTHOG_KEY and telemetry settings into all release pnpm build jobs for macOS, Windows, and Linux.
  • Attach Windows and Linux release jobs to the release environment so environment-scoped secrets and vars are available consistently.
  • Preserve runtime environment overrides for local/dev runs.

Release setup

  • Add POSTHOG_KEY as a GitHub Environment secret on the release environment.
  • Optional GitHub Environment variables: POSTHOG_HOST, TELEMETRY_ENABLED, TELEMETRY_FLUSH_BATCH_SIZE, TELEMETRY_MAX_BUFFERED_EVENTS.
  • Release builds now compile those values into the packaged app during pnpm build; runtime env vars can still override them when present.

Test plan

  • pnpm install --frozen-lockfile --ignore-scripts (local Node 26 workaround; CI uses Node 22 with scripts enabled)
  • pnpm typecheck
  • pnpm exec eslint electron.vite.config.ts src/main/analytics-service.ts
  • POSTHOG_KEY=phc_build_test POSTHOG_HOST=https://us.i.posthog.com TELEMETRY_ENABLED=true TELEMETRY_FLUSH_BATCH_SIZE=20 TELEMETRY_MAX_BUFFERED_EVENTS=1000 pnpm build
  • Verified the built main bundle contains the dummy build key, confirming build-time inlining works.

Generated with Codex

@dimavedenyapin
dimavedenyapin merged commit bb3e90b into main Jul 20, 2026
1 check passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant