Skip to content

feat(apps): every Cloud app run tells Cloud which app started it - #2055

Closed
vqt123 wants to merge 6 commits into
vinh/apps-telemetryfrom
vinh/apps-cloud-tag
Closed

vqt123 wants to merge 6 commits into
vinh/apps-telemetryfrom
vinh/apps-cloud-tag

Conversation

@vqt123

@vqt123 vqt123 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: Every Cloud run an app page starts carries extra_data.comfy_app = { id, model?, where: 'cloud' }, so Cloud can count app runs and say which app ran.

Why A Cloud app run today posts only the prompt and the sign-in token. Cloud keeps the whole extra_data with the job, so the tag reaches Cloud's records with no Cloud change.

Before / After

  • Before: an app's Cloud run looks like any other run.
  • After: Desktop takes the id from the address of the page that started the run: the slug in /apps/<id>/. It sends the id only when that slug is on the catalog's Desktop app list (/api/v1/catalog/items?type=app&surface=desktop_starters). Otherwise the tag is left off and the run still goes. A page cannot name another app.
  • The page passes only the model: run(workflow, { model }). A model that is not a short slug is left out. The bridge version goes to 3. Pages that call run(workflow) keep working and are tagged by their address. An app option from an older page is ignored.

Chosen behaviour, different from the ticket:

  • The ticket says to use the catalog reader that shows the app cards (feat(apps): show the apps as Desktop cards from the Comfy content catalog #1997). That reader sits higher in this stack, so this PR reads the Desktop app list itself. It asks once, keeps the answer for an hour, and sends no tag when the catalog cannot be read.
  • The ticket says the model must be one of the app's model choices. The catalog has no model list per app, so the model keeps the slug check.

Seen in production by: none yet; the tab is not in a release.

Not run: The four changed test files were run locally (appsRun, desktopApps, guards, wiring); CI runs the rest. The tag was not read back from a Cloud job. A test drives the run handler from a page address and checks the request body. The 2026-11-12 smoke test (Remove Background on This computer and on Comfy Cloud, in a dev build of the Apps stack) was before this change and was not repeated.

Rule bent: none.

Ref BE-26266

The bridge's run takes an optional second argument, run(workflow,
{ app, model }). When the page names its app, the /prompt body carries
extra_data.comfy_app = { id, model?, where: 'cloud' } next to the auth
token. Cloud keeps the whole extra_data in the job's workflow_json, so
the tag reaches Cloud's records with no Cloud change.

- app and model must be slugs (/^[a-z0-9][a-z0-9._-]{0,63}$/, the same
  pattern the app events use, now in guards.ts). A bad app sends no
  tag; a bad model is left out of it; the run still goes either way.
- A page that passes nothing (every page today) posts the body as
  before, with no tag.
- The bridge version goes to 3 so a page can tell this Desktop apart.

No catalog check: the ticket asks for the id to be on the catalog's
Desktop app list, but that list is read by src/main/apps/catalog.ts in
Comfy-Desktop#1997, which is not on this base. The slug check stands in
until both land together.

Ref BE-26266
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Apps run bridge now derives Cloud app metadata from the Apps page URL and desktop app catalog. It supports optional model options and includes app metadata in the Cloud prompt body when the app is listed.

Changes: Cloud App Run Tagging

Layer / File(s) Summary
App metadata and catalog lookup
src/main/apps/guards.ts, src/main/apps/guards.test.ts, src/main/apps/desktopApps.ts, src/main/apps/desktopApps.test.ts, src/main/apps/appEvents.ts
Adds app slug validation, URL and catalog app-ID extraction, Cloud tag and prompt-body helpers, and cached desktop app ID lookup. Tests cover metadata validation, catalog parsing, caching, and failure cases.
Apps-page run bridge
src/preload/appsPreload.ts, src/main/apps/appsView.ts, src/main/apps/appsRun.test.ts, src/main/apps/wiring.test.ts
The preload run method accepts optional model options. The Apps run handler validates the page URL, derives an app tag, and builds the Cloud prompt body. Tests cover run tagging and bridge wiring.

Sequence Diagram(s)

sequenceDiagram
  participant AppsPreload
  participant AppsViewIPC
  participant AppsViewRun
  participant DesktopAppCatalog
  participant CloudPrompt
  AppsPreload->>AppsViewIPC: invoke run with workflow and optional model
  AppsViewIPC->>AppsViewRun: pass validated Apps page URL
  AppsViewRun->>DesktopAppCatalog: get cached desktop app IDs
  AppsViewRun->>CloudPrompt: post workflow, token, and optional app tag
Loading
Merge Risk: Minimal · up to 66a7a

Cloud runs started from an Apps page now carry an app tag only when the page's app is on the Desktop catalog list. If the catalog cannot be read, runs proceed untagged. No actionable merge risk was found.

Pre-merge checks: Passed 2

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.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0ec3b313-267b-4b22-9103-a4ab38f3edd0
Commits

Reviewing files that changed from the base of the PR and between 3418068 and 66a7a7f.

Files selected for processing: 9

  • src/main/apps/appEvents.ts
  • src/main/apps/appsRun.test.ts
  • src/main/apps/appsView.ts
  • src/main/apps/desktopApps.test.ts
  • src/main/apps/desktopApps.ts
  • src/main/apps/guards.test.ts
  • src/main/apps/guards.ts
  • src/main/apps/wiring.test.ts
  • src/preload/appsPreload.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@vqt123
vqt123 added this pull request to stack #2058 November 12, 2026 23:03
…ainst the catalog

A Cloud run's extra_data.comfy_app.id came from the page's own run()
options, so any page could name another app or an unknown one. The id
now comes from the address of the page that sent the run (the slug in
/apps/<id>/), and Desktop sends it only when that slug is on the
catalog's Desktop app list
(/api/v1/catalog/items?type=app&surface=desktop_starters). Otherwise the
tag is left off and the run still goes.

The catalog reader that shows the app cards sits higher in this stack,
so this change reads the list itself: one request, kept for an hour,
an empty list when the catalog cannot be read. The page now passes only
{ model }; an app option from an older page is ignored. The catalog has
no per-app model list, so model keeps the slug check.

Ref BE-26266
# Conflicts:
#	src/main/apps/appsView.ts
#	src/main/apps/wiring.test.ts
# Conflicts:
#	src/main/apps/appsView.ts
#	src/main/apps/guards.test.ts
@vqt123
vqt123 marked this pull request as ready for review November 13, 2026 05:03
@vqt123
vqt123 requested review from a team as code owners November 13, 2026 05:03
@vqt123 vqt123 self-assigned this Nov 13, 2026
@vqt123
vqt123 requested a review from benceruleanlu November 13, 2026 05:43
@vqt123 vqt123 closed this Nov 15, 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.

2 participants