Skip to content

feat(telemetry): tag execution events with source_layer="comfyui"#963

Draft
deepme987 wants to merge 1 commit into
mainfrom
deepme987/desktop/execution-source-layer
Draft

feat(telemetry): tag execution events with source_layer="comfyui"#963
deepme987 wants to merge 1 commit into
mainfrom
deepme987/desktop/execution-source-layer

Conversation

@deepme987

Copy link
Copy Markdown
Collaborator

Summary

Every event emitted from src/main/lib/executionTap.ts (the 6 comfy.desktop.execution.* event families) originates in the ComfyUI Python subprocessexecutionTap exists purely to parse proc.stdout / proc.stderr. Today they all land in PostHog without any way to filter engine-origin from shell-origin.

This PR adds source_layer: 'comfyui' to the shared baseContext, so the tag is present on every emission with zero risk of any event family being missed.

PostHog filter for triage becomes:

event = 'comfy.desktop.execution.error'
  AND properties.source_layer = 'comfyui'

Why a property and not a new event-name namespace?

Considered renaming to comfy.desktop.comfyui.execution.* (matches the existing comfy.desktop.comfyui.boot_started / boot_log / exited namespace). Decided against for now because:

If we later want the cleaner namespace, the property tag makes a backfill migration easy.

Scope

Covers all 6 emissions in executionTap.ts:

  • comfy.desktop.execution.started
  • comfy.desktop.execution.completed
  • comfy.desktop.execution.first_completed
  • comfy.desktop.execution.error (validation path)
  • comfy.desktop.execution.error (traceback path)
  • comfy.desktop.execution.session_summary

Diff is 2 files, +34/-1.

Test plan

  • New test asserts source_layer === 'comfyui' on every event family this tap emits (executionTap.test.ts)
  • All 11 existing executionTap tests still green
  • Full unit suite: 1867/1867 pass
  • pnpm typecheck clean
  • pnpm lint clean
  • After merge: confirm in PostHog that properties.source_layer is populated on new events and the triage filter above returns expected volume

Follow-ups (not in this PR)

  • Investigate the error_bucket = 'other' win32 cluster — 1,454 users producing ~21.5 errors/user each in the last 24h suggests a single common failure pattern that isn't being classified. Worth a sample-and-fingerprint pass.

Every event emitted from executionTap originates in the ComfyUI Python
subprocess (parsed from its stdout/stderr). Adding source_layer to the
shared baseContext makes engine-origin errors filterable in PostHog
without renaming the event family — so existing dashboards keep working
while triage gets a clean filter:

    event = 'comfy.desktop.execution.error'
      AND properties.source_layer = 'comfyui'

Covers all six emissions (started / completed / first_completed /
error x2 / session_summary). A new test asserts the tag is present on
every event family this tap emits.
@deepme987 deepme987 self-assigned this Jun 6, 2026
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