Skip to content

Conversation

@christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented Nov 1, 2025

Summary

Deduplicates workflow run telemetry and keeps a single source of truth for execution while retaining click analytics and attributing initiator source.

  • Keep execution tracking in one place via trackWorkflowExecution()
  • Keep click analytics via trackRunButton(...)
  • Attribute initiator with trigger_source = 'button' | 'keybinding' | 'legacy_ui'
  • Remove pre‑tracking from keybindings to avoid double/triple counting
  • Update legacy UI buttons to emit both click + execution events (they bypass commands)

Problem

PR #6499 added tracking at multiple layers:

  1. Keybindings tracked via a dedicated method and then executed a command
  2. Menu items tracked via a dedicated method and then executed a command
  3. Commands also tracked execution

Because these ultimately trigger the same command path, this produced duplicate (sometimes triplicate) events per user action and made it hard to attribute initiator precisely.

Solution

  • Remove redundant tracking from keybindings (and previous legacy menu handler)
  • Commands now emit both:
    • trackRunButton(...) (click analytics, includes trigger_source when provided)
    • trackWorkflowExecution() (single execution start; includes the last trigger_source)
  • Legacy UI buttons (which call app.queuePrompt(...) directly) now also emit both events with trigger_source = 'legacy_ui'
  • Add ExecutionTriggerSource type and wire trigger_source through provider so EXECUTION_START matches the most recent click intent

Telemetry behavior after this change

  • RUN_BUTTON_CLICKED (click analytics)
    • Emitted when a run is initiated via:
      • Button: trigger_source = 'button'
      • Keybinding: trigger_source = 'keybinding'
      • Legacy UI: trigger_source = 'legacy_ui'
  • EXECUTION_START (execution lifecycle)
    • Emitted once per run at start; includes trigger_source matched to the click intent above
    • Paired with EXECUTION_SUCCESS / EXECUTION_ERROR from execution handlers

Benefits

  • ✅ Accurate counts by removing duplicated run events
  • ✅ Clear initiator attribution (button vs keybinding vs legacy UI)
  • ✅ Separation of “intent” (click) vs. “lifecycle” (execution)
  • ✅ Simpler implementation and maintenance

Files Changed (high level)

  • src/services/keybindingService.ts: Route run commands with trigger_source = 'keybinding'
  • src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue: Send trigger_source = 'button' to commands
  • src/scripts/ui.ts: Legacy queue buttons emit trackRunButton({ trigger_source: 'legacy_ui' }) and trackWorkflowExecution()
  • src/composables/useCoreCommands.ts: Commands emit trackRunButton(...) + trackWorkflowExecution(); accept telemetry metadata
  • src/platform/telemetry/types.ts: Add ExecutionTriggerSource and optional trigger_source in click + execution payloads
  • src/platform/telemetry/providers/cloud/MixpanelTelemetryProvider.ts: Carry trigger_source from click → execution and reset after use
  • src/stores/commandStore.ts: Allow commands to receive args (for telemetry metadata)
  • src/extensions/core/groupNode.ts: Adjust command function signatures to new execute signature

Related

┆Issue is synchronized with this Notion page by Unito

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 1, 2025
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 11/03/2025, 02:33:48 AM UTC

🔗 Links


🎉 Your Storybook is ready for review!

@github-actions
Copy link

github-actions bot commented Nov 1, 2025

🎭 Playwright Test Results

⚠️ Tests passed with flaky tests

⏰ Completed at: 11/03/2025, 02:45:13 AM UTC

📈 Summary

  • Total Tests: 499
  • Passed: 466 ✅
  • Failed: 0
  • Flaky: 3 ⚠️
  • Skipped: 30 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 457 / ❌ 0 / ⚠️ 3 / ⏭️ 30
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 6 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@github-actions
Copy link

github-actions bot commented Nov 1, 2025

Bundle Size Report

Summary

  • Raw size: 12.2 MB baseline 12.2 MB — 🟢 -699 B
  • Gzip: 2.48 MB baseline 2.48 MB — 🟢 -140 B
  • Brotli: 1.95 MB baseline 1.95 MB — 🟢 -45 B
  • Bundles: 58 current • 58 baseline • 13 added / 13 removed

Category Glance
Data & Services 🟢 -1 kB (10.4 kB) · App Entry Points 🔴 +169 B (3.27 MB) · UI Components 🔴 +111 B (12.6 kB) · Graph Workspace 🔴 +24 B (725 kB) · Vendor & Third-Party ⚪ 0 B (5.32 MB) · Other ⚪ 0 B (2.55 MB) · + 3 more

Per-category breakdown
App Entry Points — 3.27 MB (baseline 3.27 MB) • 🔴 +169 B

Main entry bundles and manifests

File Before After Δ Raw Δ Gzip Δ Brotli
assets/index-DoRSRY3L.js (new) 2.89 MB 🔴 +2.89 MB 🔴 +597 kB 🔴 +451 kB
assets/index-COlNwHvv.js (removed) 2.89 MB 🟢 -2.89 MB 🟢 -597 kB 🟢 -451 kB
assets/index-K3aYY2vi.js (new) 382 kB 🔴 +382 kB 🔴 +76.6 kB 🔴 +62.1 kB
assets/index-DaOuAGY0.js (removed) 381 kB 🟢 -381 kB 🟢 -76.6 kB 🟢 -62.1 kB
assets/index-DIfTPEeR.js (removed) 1.75 kB 🟢 -1.75 kB 🟢 -577 B 🟢 -485 B
assets/index-ttZPki58.js (new) 1.75 kB 🔴 +1.75 kB 🔴 +576 B 🔴 +490 B

Status: 3 added / 3 removed

Graph Workspace — 725 kB (baseline 725 kB) • 🔴 +24 B

Graph editor runtime, canvas, workflow orchestration

File Before After Δ Raw Δ Gzip Δ Brotli
assets/GraphView-CbDUY5xW.js (new) 725 kB 🔴 +725 kB 🔴 +142 kB 🔴 +109 kB
assets/GraphView-dfDlrqOc.js (removed) 725 kB 🟢 -725 kB 🟢 -142 kB 🟢 -109 kB

Status: 1 added / 1 removed

Views & Navigation — 8.18 kB (baseline 8.18 kB) • ⚪ 0 B

Top-level views, pages, and routed surfaces

File Before After Δ Raw Δ Gzip Δ Brotli
assets/UserSelectView-BzRL0rM7.js (new) 8.18 kB 🔴 +8.18 kB 🔴 +2.48 kB 🔴 +2.17 kB
assets/UserSelectView-dbYPiq5X.js (removed) 8.18 kB 🟢 -8.18 kB 🟢 -2.48 kB 🟢 -2.17 kB

Status: 1 added / 1 removed

Panels & Settings — 293 kB (baseline 293 kB) • ⚪ 0 B

Configuration panels, inspectors, and settings screens

File Before After Δ Raw Δ Gzip Δ Brotli
assets/CreditsPanel-BRX4tMUE.js (new) 22.9 kB 🔴 +22.9 kB 🔴 +5.45 kB 🔴 +4.76 kB
assets/CreditsPanel-oYQxYABq.js (removed) 22.9 kB 🟢 -22.9 kB 🟢 -5.45 kB 🟢 -4.76 kB
assets/KeybindingPanel-BtqMN4G7.js (removed) 15.3 kB 🟢 -15.3 kB 🟢 -3.78 kB 🟢 -3.33 kB
assets/KeybindingPanel-T5r0EHYz.js (new) 15.3 kB 🔴 +15.3 kB 🔴 +3.78 kB 🔴 +3.33 kB
assets/ExtensionPanel-Ch1OWEYP.js (new) 12.1 kB 🔴 +12.1 kB 🔴 +2.84 kB 🔴 +2.49 kB
assets/ExtensionPanel-q3uwLA-3.js (removed) 12.1 kB 🟢 -12.1 kB 🟢 -2.84 kB 🟢 -2.49 kB
assets/AboutPanel-CJupU_lb.js (removed) 10.3 kB 🟢 -10.3 kB 🟢 -2.67 kB 🟢 -2.34 kB
assets/AboutPanel-DxAr03k6.js (new) 10.3 kB 🔴 +10.3 kB 🔴 +2.68 kB 🔴 +2.34 kB
assets/ServerConfigPanel-BDc7SXmC.js (new) 8.23 kB 🔴 +8.23 kB 🔴 +2.18 kB 🔴 +1.91 kB
assets/ServerConfigPanel-D7mln8d9.js (removed) 8.23 kB 🟢 -8.23 kB 🟢 -2.18 kB 🟢 -1.91 kB
assets/UserPanel-BwcaRQQ3.js (removed) 7.94 kB 🟢 -7.94 kB 🟢 -2.07 kB 🟢 -1.81 kB
assets/UserPanel-CHob7oaI.js (new) 7.94 kB 🔴 +7.94 kB 🔴 +2.07 kB 🔴 +1.81 kB
assets/settings-0O6mq5to.js 24.3 kB 24.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-BYaBy7dC.js 20.4 kB 20.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-C3vygQN4.js 25.7 kB 25.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-CbKYXyH0.js 22.7 kB 22.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-CCholIsI.js 25 kB 25 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DFX7vRkK.js 19.8 kB 19.8 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-INJLrcmT.js 31.3 kB 31.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-iR6BKRXe.js 23.7 kB 23.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-YjQmudNE.js 23.5 kB 23.5 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 6 added / 6 removed

UI Components — 12.6 kB (baseline 12.5 kB) • 🔴 +111 B

Reusable component library chunks

File Before After Δ Raw Δ Gzip Δ Brotli
assets/ComfyQueueButton-BtyPuAsN.js (new) 11.3 kB 🔴 +11.3 kB 🔴 +2.83 kB 🔴 +2.52 kB
assets/ComfyQueueButton-BvFzN-zZ.js (removed) 11.2 kB 🟢 -11.2 kB 🟢 -2.78 kB 🟢 -2.46 kB
assets/UserAvatar.vue_vue_type_script_setup_true_lang-CY-Afo9h.js 1.29 kB 1.29 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 1 added / 1 removed

Data & Services — 10.4 kB (baseline 11.4 kB) • 🟢 -1 kB

Stores, services, APIs, and repositories

File Before After Δ Raw Δ Gzip Δ Brotli
assets/keybindingService-CxVcCZue.js (removed) 8.61 kB 🟢 -8.61 kB 🟢 -2.08 kB 🟢 -1.78 kB
assets/keybindingService-DpPd4rs-.js (new) 7.6 kB 🔴 +7.6 kB 🔴 +1.84 kB 🔴 +1.59 kB
assets/serverConfigStore-BXxesUPS.js 2.79 kB 2.79 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 1 added / 1 removed

Utilities & Hooks — 1.07 kB (baseline 1.07 kB) • ⚪ 0 B

Helpers, composables, and utility bundles

File Before After Δ Raw Δ Gzip Δ Brotli
assets/mathUtil-CTARWQ-l.js 1.07 kB 1.07 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
Vendor & Third-Party — 5.32 MB (baseline 5.32 MB) • ⚪ 0 B

External libraries and shared vendor chunks

File Before After Δ Raw Δ Gzip Δ Brotli
assets/vendor-other-DTJaZ2wB.js 3.22 MB 3.22 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-primevue-PESgPnbc.js 517 B 517 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-three-JDoAqkQm.js 1.37 MB 1.37 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-tiptap-BovKm-bo.js 232 kB 232 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-vue-CE9hyBb0.js 92.4 kB 92.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-xterm-BZLod3g9.js 407 kB 407 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
Other — 2.55 MB (baseline 2.55 MB) • ⚪ 0 B

Bundles that do not match a named category

File Before After Δ Raw Δ Gzip Δ Brotli
assets/commands-B2KZRBmX.js 15.1 kB 15.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-Bw-ckyga.js 13.9 kB 13.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-C_NmM85I.js 13.8 kB 13.8 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-CuozCW4W.js 14 kB 14 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DGfVUJCR.js 16.2 kB 16.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-dOJNDogK.js 14.5 kB 14.5 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DwiE551e.js 14.7 kB 14.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-Fw7mvqSy.js 13.1 kB 13.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-FXnO1W4Q.js 13.2 kB 13.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-B2H4r1yK.js 70.7 kB 70.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-BfrcYvru.js 59.4 kB 59.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-BhRi1J0e.js 68.4 kB 68.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-BUG9wuyt.js 80.3 kB 80.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-C0hL5eRA.js 76.4 kB 76.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-CkKZCT7r.js 58.7 kB 58.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-D1RQ0Vb_.js 66.3 kB 66.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DdyfZOXg.js 67.6 kB 67.6 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DPE2NqRw.js 92.9 kB 92.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-3I1vPgv4.js 181 kB 181 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-B2huPGKQ.js 190 kB 190 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-BWugyUzd.js 215 kB 215 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-bXqu6Stq.js 194 kB 194 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-CtB2M3sY.js 229 kB 229 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-D-rCrn-T.js 200 kB 200 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-D38DSnl1.js 179 kB 179 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-DAsU52ON.js 192 kB 192 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-DnGONaA_.js 196 kB 196 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

@DrJKL DrJKL self-assigned this Nov 1, 2025
DrJKL
DrJKL previously approved these changes Nov 1, 2025
DrJKL
DrJKL previously approved these changes Nov 1, 2025
@benceruleanlu benceruleanlu added needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch branch:rh-test labels Nov 1, 2025
@benceruleanlu benceruleanlu changed the title fix(telemetry): remove redundant run tracking to prevent double-tracking fix(telemetry): remove redundant run tracking; keep click analytics + single execution event Nov 2, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Nov 2, 2025
@benceruleanlu
Copy link
Member

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Christian Byrne and others added 10 commits November 2, 2025 00:17
Summary:
- Remove trackRunTriggeredViaKeybinding() and trackRunTriggeredViaMenu() methods
- Remove duplicate tracking calls from keybindings, menu, and legacy UI
- Keep only trackWorkflowExecution() in commands for centralized tracking

Problem:
The previous implementation added tracking at multiple levels:
1. Keybindings tracked, then called command
2. Menu tracked, then called command
3. Command also tracked
This caused double (or triple) tracking for the same user action.

Solution:
- Commands already call trackWorkflowExecution() when executing
- Keybindings and menu items call commands, so they inherit tracking
- Legacy UI buttons call app.queuePrompt() directly, so they keep tracking
- No need to distinguish button/keybinding/menu - all are workflow executions

Files changed:
- src/services/keybindingService.ts: Remove tracking before command execution
- src/stores/menuItemStore.ts: Remove tracking before command execution
- src/scripts/ui.ts: Change trackRunTriggeredViaMenu to trackWorkflowExecution
- src/platform/telemetry/types.ts: Remove unused methods and event constants
- src/platform/telemetry/providers/cloud/MixpanelTelemetryProvider.ts: Remove implementations
The Vue queue button was calling both trackRunButton() and then
executing the command which calls trackWorkflowExecution(), causing
double-tracking.

Now all paths (button, keybinding, menu) go through the command as
the single centralized gateway for tracking.
Corrected the tracking to use trackRunButton() (app:run_button_click) instead
of trackWorkflowExecution() (execution_start).

Key difference:
- trackRunButton() = User initiates a run (button/keybinding/menu)
- trackWorkflowExecution() = Execution actually starts (WebSocket event)

Now all paths converge on trackRunButton() in the command:
1. Button → command → trackRunButton() → app.queuePrompt()
2. Keybinding → command → trackRunButton() → app.queuePrompt()
3. Menu → command → trackRunButton() → app.queuePrompt()
4. Legacy UI → trackRunButton() → app.queuePrompt() (bypasses command)

Also added missing tracking to Comfy.QueueSelectedOutputNodes command.
Following VS Code's command pattern, commands can now accept optional
arguments that get passed through from execute().

Changes:
- ComfyCommand.function now accepts ...args: unknown[]
- commandStore.execute() now accepts ...args and passes them through
- Queue commands (QueuePrompt, QueuePromptFront, QueueSelectedOutputNodes)
  now accept optional metadata: { subscribe_to_run?: boolean }
- Vue queue button passes { subscribe_to_run: false } to track properly
- Keybindings and menu items continue to work without passing args

Benefits:
- Maximally flexible like VS Code
- Non-breaking (existing callers work unchanged)
- Commands opt-in to args they need
- No forced positional parameters
- Extensible for future metadata needs

Reference: VS Code's executeCommand uses this same pattern
(/tmp/vscode/src/vs/platform/commands/common/commands.ts:26)
Following VS Code's actual implementation, commands now use generics with
proper type widening when stored.

Changes:
- ComfyCommand and ComfyCommandImpl are now generic: ComfyCommand<TArgs>
- Storage uses default (unknown[]): Map<string, ComfyCommandImpl>
- Queue commands are properly typed with specific metadata signature
- Commands array uses type assertion to widen to ComfyCommand[]
- Extension commands wrap functions to match signature
- All formatting and linting applied

This approach:
- Provides type safety at definition time
- Allows flexible args per command
- Storage naturally erases types (like VS Code)
- No casts needed in command bodies
- Extensible for future args

Verified against VS Code source:
/tmp/vscode/src/vs/platform/commands/common/commands.ts

All checks passed:
✅ Lint
✅ Format
✅ Typecheck
✅ Unit tests (2800+ tests)
…) and restore single execution_start; remove duplicate pre-tracking
@christian-byrne christian-byrne force-pushed the fix/simplify-run-telemetry branch 3 times, most recently from 6033d7b to 395d2f0 Compare November 2, 2025 17:50
Restores the queue_run_multiple_batches_submitted tracking that was
accidentally removed during conflict resolution. This tracking was added
in PR #6511 to track when users submit multiple batches.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@christian-byrne christian-byrne force-pushed the fix/simplify-run-telemetry branch from 395d2f0 to e026c25 Compare November 2, 2025 17:55
Changes execute signature from execute(commandId, errorHandler?, ...metadata)
to execute(commandId, { errorHandler?, metadata? })

This eliminates awkward undefined placeholders and makes the API more extensible.
- Update ComfyCommand interface with concrete metadata signature
- Remove type assertion from command registration
- Remove redundant isCloud checks around telemetry calls
Use proper TypeScript type for error parameters instead of any
@christian-byrne christian-byrne merged commit 6fe88db into main Nov 3, 2025
27 checks passed
@christian-byrne christian-byrne deleted the fix/simplify-run-telemetry branch November 3, 2025 03:48
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

@christian-byrne Backport to rh-test failed: Merge conflicts detected.

Please manually cherry-pick commit 6fe88dba546c829c45c1b406dfe3746b8726f8f5 to the rh-test branch.

Conflicting files
  • src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue
  • src/composables/useCoreCommands.ts
  • src/platform/telemetry/providers/cloud/MixpanelTelemetryProvider.ts

christian-byrne added a commit that referenced this pull request Nov 3, 2025
… single execution event (#6518)

Deduplicates workflow run telemetry and keeps a single source of truth
for execution while retaining click analytics and attributing initiator
source.

- Keep execution tracking in one place via `trackWorkflowExecution()`
- Keep click analytics via `trackRunButton(...)`
- Attribute initiator with `trigger_source` = 'button' | 'keybinding' |
'legacy_ui'
- Remove pre‑tracking from keybindings to avoid double/triple counting
- Update legacy UI buttons to emit both click + execution events (they
bypass commands)

PR #6499 added tracking at multiple layers:
1) Keybindings tracked via a dedicated method and then executed a
command
2) Menu items tracked via a dedicated method and then executed a command
3) Commands also tracked execution

Because these ultimately trigger the same command path, this produced
duplicate (sometimes triplicate) events per user action and made it hard
to attribute initiator precisely.

- Remove redundant tracking from keybindings (and previous legacy menu
handler)
- Commands now emit both:
- `trackRunButton(...)` (click analytics, includes `trigger_source` when
provided)
- `trackWorkflowExecution()` (single execution start; includes the last
`trigger_source`)
- Legacy UI buttons (which call `app.queuePrompt(...)` directly) now
also emit both events with `trigger_source = 'legacy_ui'`
- Add `ExecutionTriggerSource` type and wire `trigger_source` through
provider so `EXECUTION_START` matches the most recent click intent

- `RUN_BUTTON_CLICKED` (click analytics)
  - Emitted when a run is initiated via:
    - Button: `trigger_source = 'button'`
    - Keybinding: `trigger_source = 'keybinding'`
    - Legacy UI: `trigger_source = 'legacy_ui'`
- `EXECUTION_START` (execution lifecycle)
- Emitted once per run at start; includes `trigger_source` matched to
the click intent above
- Paired with `EXECUTION_SUCCESS` / `EXECUTION_ERROR` from execution
handlers

- ✅ Accurate counts by removing duplicated run events
- ✅ Clear initiator attribution (button vs keybinding vs legacy UI)
- ✅ Separation of “intent” (click) vs. “lifecycle” (execution)
- ✅ Simpler implementation and maintenance

- `src/services/keybindingService.ts`: Route run commands with
`trigger_source = 'keybinding'`
- `src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue`: Send
`trigger_source = 'button'` to commands
- `src/scripts/ui.ts`: Legacy queue buttons emit `trackRunButton({
trigger_source: 'legacy_ui' })` and `trackWorkflowExecution()`
- `src/composables/useCoreCommands.ts`: Commands emit
`trackRunButton(...)` + `trackWorkflowExecution()`; accept telemetry
metadata
- `src/platform/telemetry/types.ts`: Add `ExecutionTriggerSource` and
optional `trigger_source` in click + execution payloads
- `src/platform/telemetry/providers/cloud/MixpanelTelemetryProvider.ts`:
Carry `trigger_source` from click → execution and reset after use
- `src/stores/commandStore.ts`: Allow commands to receive args (for
telemetry metadata)
- `src/extensions/core/groupNode.ts`: Adjust command function signatures
to new execute signature

- Reverts the multi‑event approach from #6499
- Keeps `trackWorkflowExecution()` as the canonical execution event
while preserving click analytics and initiator attribution with
`trackRunButton(...)`

┆Issue is synchronized with this Notion page by Unito

---------

Co-authored-by: Christian Byrne <c.byrne@comfy.org>
Co-authored-by: Alexander Brown <drjkl@comfy.org>
Co-authored-by: Benjamin Lu <benjaminlu1107@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
christian-byrne added a commit that referenced this pull request Nov 3, 2025
…keep click analytics + single execution event (#6552)

## Summary
Manual backport of #6518 to the `rh-test` branch.

Deduplicates workflow run telemetry and keeps a single source of truth
for execution while retaining click analytics and attributing initiator
source.

- Keep execution tracking in one place via `trackWorkflowExecution()`
- Keep click analytics via `trackRunButton(...)`
- Attribute initiator with `trigger_source` = 'button' | 'keybinding' |
'legacy_ui'
- Remove pre-tracking from keybindings to avoid double/triple counting
- Update legacy UI buttons to emit both click + execution events

## Backport Notes
This backport required manual conflict resolution in:
- `src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue` - Added
batchCount tracking and trigger_source metadata
- `src/composables/useCoreCommands.ts` - Added error handling and
execution tracking
- `src/platform/telemetry/providers/cloud/MixpanelTelemetryProvider.ts`
- Updated trackRunButton signature with trigger_source support

Additionally added:
- `trackUiButtonClicked` method to TelemetryProvider interface
- `UiButtonClickMetadata` type definition
- `UI_BUTTON_CLICKED` event constant

All conflicts resolved intelligently to maintain the intent of the
original PR while adapting to the rh-test branch codebase.

## Original PR
- Original PR: #6518  
- Original commit: 6fe88db

## Testing
- ✅ Typecheck passed
- ✅ Pre-commit hooks passed (lint, format)
- ✅ All conflicts resolved

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6552-Backport-to-rh-test-fix-telemetry-remove-redundant-run-tracking-keep-click-analytics-2a06d73d365081f78e4ad46a16be69f1)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Christian Byrne <c.byrne@comfy.org>
Co-authored-by: Alexander Brown <drjkl@comfy.org>
Co-authored-by: Benjamin Lu <benjaminlu1107@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Christian Byrne <chrbyrne96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch:rh-test needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants