Skip to content

Commit 5f2a1c8

Browse files
feat: track subagent mode globally in all PostHog events
Move subagent tracking from a single event property to the ph() function so every PostHog event is automatically tagged with subagent: true/false. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4a50528 commit 5f2a1c8

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

codeflash/optimization/optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def rank_by_dependency_count(
486486
def run(self) -> None:
487487
from codeflash.code_utils.checkpoint import CodeflashRunCheckpoint
488488

489-
ph("cli-optimize-run-start", {"subagent": is_subagent_mode()})
489+
ph("cli-optimize-run-start")
490490
logger.info("Running optimizer.")
491491
console.rule()
492492
if not env_utils.ensure_codeflash_api_key():

codeflash/telemetry/posthog_cf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from codeflash.api.cfapi import get_user_id
99
from codeflash.cli_cmds.console import logger
10+
from codeflash.lsp.helpers import is_subagent_mode
1011
from codeflash.version import __version__
1112

1213
_posthog = None
@@ -36,7 +37,7 @@ def ph(event: str, properties: dict[str, Any] | None = None) -> None:
3637
return
3738

3839
properties = properties or {}
39-
properties.update({"cli_version": __version__})
40+
properties.update({"cli_version": __version__, "subagent": is_subagent_mode()})
4041

4142
user_id = get_user_id()
4243

0 commit comments

Comments
 (0)