Skip to content

Expose ComfyUI telemetry bridge#1069

Open
benceruleanlu wants to merge 2 commits into
bl/comfy-desktop-bridge-typesfrom
bl/mar-240-desktop-telemetry-bridge
Open

Expose ComfyUI telemetry bridge#1069
benceruleanlu wants to merge 2 commits into
bl/comfy-desktop-bridge-typesfrom
bl/mar-240-desktop-telemetry-bridge

Conversation

@benceruleanlu

@benceruleanlu benceruleanlu commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • expose window.__comfyDesktop2.Telemetry.capture from the ComfyUI preload bridge
  • route hosted frontend telemetry through the existing telemetry:capture IPC path
  • allow primitive arrays for event properties while keeping person properties scalar-only
  • scrub string entries inside telemetry arrays before PostHog capture

Paired change

Validation

  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build
  • pnpm run test

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

Copy link
Copy Markdown

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.

Reviewed commit: a043880e14

ℹ️ 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".

Comment thread src/preload/comfyPreload.ts Outdated
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1045154d-a2ae-4325-9b6d-fad1e0f2c9f4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR extracts ComfyDesktop bridge types into a reusable npm package, extends telemetry to support array-valued properties while enforcing primitives-only validation for person attributes, implements PII redaction for string array elements, and exposes a new renderer-side Telemetry bridge with error-safe IPC forwarding.

Changes

Bridge Types Extraction and Telemetry Enhancement

Layer / File(s) Summary
ComfyDesktop bridge type contracts
src/types/comfyDesktopBridge.ts
Defines reusable TypeScript interfaces for terminal, logs, telemetry, and download-progress bridges with proper subscription lifecycles, event handlers returning unsubscribe functions, and a top-level aggregate bridge with optional nested sub-bridges and theme reporting.
Bridge types package build and publication
tsconfig.comfy-desktop-bridge-types.json, scripts/generate-comfy-desktop-bridge-types.mjs, packages/comfyui-desktop-bridge-types/*, .eslintignore, package.json
Establishes build infrastructure: TypeScript config for declaration-only output, Node.js script to compile and copy generated types into a reusable npm package with ES module metadata, and npm script binding.
IPC validation filters for telemetry properties
src/main/lib/ipc/registerTelemetryHandlers.ts
Dual-filter approach: asProps allows primitives or arrays (general events), asPersonProps restricts to primitives only (user/person attributes). Handlers switch to asPersonProps—you could say they're getting arrayed for stricter validation!
Array-aware PII redaction and privacy test
src/main/lib/telemetry.ts, src/main/lib/telemetry.test.ts
scrubProperties now redacts sensitive string elements in array fields while preserving non-strings and using structural sharing. Test verifies Windows user paths in model_paths arrays become [REDACTED] while other entries stay intact.
Renderer-side telemetry and bridge wiring
src/preload/comfyPreload.ts
Imports bridge types from shared module; refactors Terminal and Logs listeners with proper IpcRendererEvent typing and consistent unsubscribe returns. New Telemetry bridge wraps ipcRenderer.send in try/catch, and __comfyDesktop2 API gains onDownloadProgress subscription and validated bridge export.

Suggested reviewers

  • deepme987
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bl/mar-240-desktop-telemetry-bridge
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch bl/mar-240-desktop-telemetry-bridge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/lib/ipc/registerTelemetryHandlers.ts`:
- Around line 37-53: The asProps/isTelemetryValueArray validation currently
accepts unbounded renderer-controlled objects and arrays; limit work done at the
IPC boundary by enforcing caps: in asProps, stop iterating after a maxKeys
threshold (e.g., 50) and ignore additional keys; in isTelemetryValueArray, cap
checked/retained array length to maxArrayLen (e.g., 20) and only validate/trust
up to that many items; when accepting string TelemetryValue (checked by
isTelemetryValue), truncate strings to a maxStringLen (e.g., 200) before
assigning into the returned mainTelemetry.TelemetryContext; update references to
isTelemetryValue/isTelemetryValueArray and the out assignment logic so oversized
inputs are skipped/truncated rather than fully processed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ba60f3b5-b89b-4700-a918-679fae3bbba1

📥 Commits

Reviewing files that changed from the base of the PR and between c77f4f2 and db68fab.

📒 Files selected for processing (4)
  • src/main/lib/ipc/registerTelemetryHandlers.ts
  • src/main/lib/telemetry.test.ts
  • src/main/lib/telemetry.ts
  • src/preload/comfyPreload.ts

Comment thread src/main/lib/ipc/registerTelemetryHandlers.ts Outdated
@benceruleanlu benceruleanlu force-pushed the bl/mar-240-desktop-telemetry-bridge branch from db68fab to adeae82 Compare June 15, 2026 17:52
@CLAassistant

CLAassistant commented Jun 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@benceruleanlu benceruleanlu changed the base branch from main to bl/comfy-desktop-bridge-types June 15, 2026 17:53
@coderabbitai coderabbitai Bot requested a review from deepme987 June 15, 2026 17:53
@benceruleanlu benceruleanlu force-pushed the bl/mar-240-desktop-telemetry-bridge branch 2 times, most recently from 1af49ec to db8fe8f Compare June 15, 2026 20:23
@benceruleanlu benceruleanlu force-pushed the bl/mar-240-desktop-telemetry-bridge branch from db8fe8f to 80fd10e Compare June 15, 2026 21:06
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.

4 participants