Skip to content

[backport cloud/1.54] fix: materialize insert_workflow links with numeric ids - #18540

Closed
christian-byrne wants to merge 1 commit into
cloud/1.54from
backport-18458-to-cloud-1.54
Closed

christian-byrne wants to merge 1 commit into
cloud/1.54from
backport-18458-to-cloud-1.54

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor

Summary

Manual backport of #18458 to cloud/1.54. Hosted CI is the verification source; local checks are deferred under the owner resource-safety hold.

Full context for agent readers

Changes

  • What: Carries the numeric insert_workflow link materialization fix and its regression coverage.
  • Dependencies: Pins @comfyorg/comfy-multi-player to upstream commit b475423a0f8b019bbac261ce218dfc016e9aa634, which is required by the fix.

Review Focus

The package conflicts were resolved by retaining the cloud/1.54 workspace topology while applying the required multiplayer pin. The resulting five-file diff matches the original merged change.

<!-- ccr-slack-attribution -->
_Requested by **Jo Zhang** · [Slack
thread](https://comfy-organization.slack.com/archives/C0BGH348Z0C/p1790058330774449?thread_ts=1790058330.774449&cid=C0BGH348Z0C)_

Fixes a bug where an agent's `insert_workflow` batch — several brand-new
nodes plus the links between them, applied as one CRDT op, not a
subgraph paste — materialized the nodes correctly (including widget
values) but dropped every link between them, with no error surfaced.

**Root cause:** `comfy-multi-player`'s `insert_workflow` applier used to
mint a fresh, non-numeric doc id for every node *and* link it inserts
(`remap.ts`'s `derivedId`, e.g. `insert:<opId>:root:link:201`).
`ecsFollowerAdapter.ts`'s `readSemanticLink` narrowed a link's doc id
with `Number(tuple[0])` and required `Number.isInteger` on the result —
a derived string id always failed that check, so the link was treated as
unreadable:
- On the full-reconcile path (a session's first frame, or any frame
after a previously-rejected batch), the unreadable link was silently
filtered out of the batch with no error reported, while every node in
the same batch read and committed fine (`readSemanticNode` has no such
numeric constraint).
- On the incremental path it was worse: the same failed `Number()`
conversion also fed `removeLinks`'s id check, rejecting the *whole*
batch — including the node adds sharing it.

**Fix:** rather than working around the non-numeric derived id in the
frontend, `comfy-multi-player` is pinned to [PR
mint genuine numeric link ids for insert_workflow (ADR-033)"), now
merged to `main` at commit `b475423`, which mints a real numeric link id
for every link an `insert_workflow` batch inserts, upstream.
`ecsFollowerAdapter.ts`'s `readSemanticLink` now just validates that
identity: `resolveLinkId` accepts only a real non-negative safe-integer
link id, and `resolveLinkMapKey` (via `parseLinkId`) cross-checks that
id against the link's own doc map key, retiring any live link whose map
key and tuple id diverge instead of materializing something
inconsistent. `graphMutations.ts` needed no change — its
non-negative-integer guards already accept the validated id.

**Dependency pin:** `@comfyorg/comfy-multi-player` is temporarily
pinned, via a `pnpm-workspace.yaml` catalog entry, to a codeload tarball
of commit `b475423` on comfy-multi-player's `main` branch (where PR #245
has now merged), rather than a published npm version — because that fix
hasn't been published to npm yet. This anchors the pin to a permanent
`main` commit instead of the now-merged (and possibly soon-deleted)
feature branch, so it won't break if that branch is removed. Once
comfy-multi-player publishes a release containing #245, this pin should
be replaced with the released npm version string.

**Not the same bug as #18375:** that fix addresses a `LinkMap`
revision-cache race that only matters when a `connect` displaces an
existing occupant on an already-live slot (e.g. an autogrow hand-wire).
This batch has no existing occupant and no live node for either target
before the op arrives, so that code path never triggers here.

**Tests:** `agentInsertWorkflowLinks.regression.test.ts` covers:
- Initial (full-reconcile) and incremental projection of a link with a
genuine numeric id.
- Collision preservation for ids that formerly collided under the old
hash scheme.
- Malformed ids and map-key/tuple divergence, both retired instead of
materialized.
- Reload, standalone disconnect, and reinsertion of a link.

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

https://claude.ai/code/session_01UqyourCBfi97xzpBx2W7oY

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Amp <amp@ampcode.com>
@christian-byrne christian-byrne added the backport Backporting a PR onto a release candidate label Sep 23, 2026
@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Ignore keyword(s) in the title.

⛔ Ignored keywords (2)
  • [release]
  • [backport

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: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: fc90ba5b-f6b3-46c0-855b-75234410122c

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

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

@vercel

vercel Bot commented Sep 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
billing-web Ignored Ignored Sep 23, 2026 4:47am UTC

Request Review

@datadog-official

datadog-official Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Pipelines

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 8 Pipeline jobs failed

CI: Dist Telemetry Scan | scan — 🔧 Needs a code fix, caused by this PR

View in Datadog · View in GitHub Actions

CI: Lint Format | lint-and-format — 🔧 Needs a code fix, caused by this PR

View in Datadog · View in GitHub Actions

CI: OSS Assets Validation | validate-fonts — 🔧 Needs a code fix, caused by this PR

View in Datadog · View in GitHub Actions

View all 8 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0d1353d | Docs | View more details | Give us feedback!

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/23/2026, 05:08:54 AM UTC

Links

🌐 Website E2E

Tip

All tests passed.

Status ✅ Passed
Report View Report

🎭 Playwright: 🕵🏻 0 passed, 0 failed

📊 Browser Reports
  • chromium: ❌ Deployment failed
  • chromium-2x: ❌ Deployment failed
  • chromium-0.5x: ❌ Deployment failed
  • mobile-chrome: ❌ Deployment failed

📦 Bundle Size

⏳ Size data collection in progress…

⚡ Performance

⚠️ Performance tests failed. Check the CI workflow logs.

🔬 E2E Coverage

⚠️ Coverage collection failed. Check the CI workflow logs.

@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@              Coverage Diff              @@
##             cloud/1.54   #18540   +/-   ##
=============================================
  Coverage              ?   57.82%           
=============================================
  Files                 ?      430           
  Lines                 ?     7682           
  Branches              ?     1868           
=============================================
  Hits                  ?     4442           
  Misses                ?     2905           
  Partials              ?      335           
Flag Coverage Δ
website-unit 57.82% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Superseded by the release-native cloud backport, which removes main-only symbols and has version 1.54-native regression coverage.

christian-byrne added a commit that referenced this pull request Sep 23, 2026
…eric ids (#18549)

## Summary

Release-native backport of [the merged main
fix](#18458):
`insert_workflow` nodes no longer materialize without their links.

<details>
<summary>Full context for agent readers</summary>

## Changes

- Pins `@comfyorg/comfy-multi-player` to published npm version `0.3.4`,
which mints numeric link IDs for `insert_workflow`.
- Adds a version 1.54-native integration regression proving a three-node
inserted workflow stores canonical numeric IDs and projects both links.
- Preserves the live `cloud/1.54` package version (`1.54.14`) and
removes the obsolete codeload build allowance.

## Review focus

This intentionally omits the main-branch-only `AgentCrdtProjection` and
`parseLinkId` changes that made [the generated cloud
backport](#18540) fail
to compile. The version 1.54 adapter already accepts the upstream
numeric IDs.

The original branch-native targeted integration suite, ESLint,
formatting, typecheck, and pre-push Knip passed before the
npm-source/version correction. Hosted checks are requalifying the
corrected exact head.

Backport of [the merged main
fix](#18458).
Supersedes [the generated cloud
backport](#18540).

</details>
@DrJKL DrJKL added agent Comfy Agent product, integration, tests or product documentation agent-backport Agent changes targeting a stable cloud/core release branch agent-crdt Agent document synchronization, graph projection or CRDT operations agent-test-unit Touches Agent-related unit/component tests or their support labels Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Comfy Agent product, integration, tests or product documentation agent-backport Agent changes targeting a stable cloud/core release branch agent-crdt Agent document synchronization, graph projection or CRDT operations agent-test-unit Touches Agent-related unit/component tests or their support backport Backporting a PR onto a release candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants