fix(posthog): disable feature flags, remove plugin_loaded event for billing optimization

- Remove plugin_loaded telemetry from index.ts (was 46.5% of all events, ~2.83M/month)
- Add enableLocalEvaluation: false to prevent feature flag polling/decide calls
- Add strictLocalEvaluation: true to prevent server fallback requests
- Add disableRemoteConfig: true to prevent remote config network requests
- Remove 'plugin_loaded' from PostHogActivityReason type
- Update tests: remove stale mocks, add SDK options verification test
- enableExceptionAutocapture: false already present (kept)

Estimated billing reduction: ~$960+/month from feature flag requests,
plus ~2.83M fewer events/month from plugin_loaded removal.
This commit is contained in:
YeonGyu-Kim
2026-05-07 16:44:05 +09:00
parent 10f9559ccc
commit 8586cb8965
5 changed files with 45 additions and 26 deletions
-12
View File
@@ -30,14 +30,6 @@ const mockCreateHooks = mock(() => ({
claudeCodeHooks: undefined,
}))
const mockCreatePluginInterface = mock(() => ({}))
const mockCreatePluginPostHog = mock(() => ({
trackActive: () => {
throw new Error("telemetry failed")
},
shutdown: mock(async () => {}),
}))
const mockGetPostHogDistinctId = mock(() => "plugin-distinct-id")
function installModuleMocks(): void {
mock.module("./cli/config-manager/config-context", () => ({
initConfigContext: mockInitConfigContext,
@@ -98,10 +90,6 @@ function installModuleMocks(): void {
cleanupTempDirectoryClients: mock(async () => {}),
},
}))
mock.module("./shared/posthog", () => ({
createPluginPostHog: mockCreatePluginPostHog,
getPostHogDistinctId: mockGetPostHogDistinctId,
}))
}
describe("oh-my-openagent telemetry isolation", () => {