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
-8
View File
@@ -17,7 +17,6 @@ import { injectServerAuthIntoClient, log, logLegacyPluginStartupWarning } from "
import { installAgentSortShim } from "./shared/agent-sort-shim"
import { detectExternalSkillPlugin, getSkillPluginConflictWarning } from "./shared/external-plugin-detector"
import { startBackgroundCheck as startTmuxCheck } from "./tools/interactive-bash"
import { createPluginPostHog, getPostHogDistinctId } from "./shared/posthog"
const serverPlugin: Plugin = async (input, _options): Promise<Hooks> => {
installAgentSortShim()
@@ -36,13 +35,6 @@ const serverPlugin: Plugin = async (input, _options): Promise<Hooks> => {
const pluginConfig = loadPluginConfig(input.directory, input)
const posthog = createPluginPostHog()
const distinctId = getPostHogDistinctId()
try {
posthog.trackActive(distinctId, "plugin_loaded")
} catch {
// telemetry failure is non-fatal, silently ignore
}
if (pluginConfig.openclaw) {
await initializeOpenClaw(pluginConfig.openclaw)
}