Skip to content

test: pin that print_workflow drops canvas groups - #896

Open
claude[bot] wants to merge 3 commits into
mainfrom
test/pm-907-print-workflow-groups
Open

claude[bot] wants to merge 3 commits into
mainfrom
test/pm-907-print-workflow-groups

Conversation

@claude

@claude claude Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

RCA for an in-app agent report: the agent's canvas read (print_workflow / read_workflow in cloud's services/agent loop) never mentions groups or frames, even when one is visibly drawn on the canvas with a title bar, and the agent will confidently assert none exist.

Root cause is here, in comfy_cli/workflow_print.py's render_py:

raw_nodes = workflow.get("nodes") or []
...
links = workflow.get("links") or []

workflow["groups"] is never read anywhere in this module — the renderer's own docstring says as much ("Renders the ComfyUI UI-save-format workflow (nodes[] + links[])..."). So canvas groups are structurally absent from the one text representation of the graph the agent's LLM turn is given, regardless of what's actually on the canvas.

Change

Adds test_sd15_groups_are_visible_in_the_source, using the existing sd15_ui_workflow.json fixture, which already carries three real titled groups ("Step 1 - Load model", "Step 2 - Prompt", "Step 3 - Image size"). None of their titles appear in render_py's output today.

FAILED tests/comfy_cli/test_workflow_print.py::test_sd15_groups_are_visible_in_the_source
AssertionError: assert 'Step 1 - Load model' in '...'
1 failed, 54 passed in 0.54s

Intentionally red (red-green-fix pattern) — this PR is test-only, pinning the repro. A follow-up should render workflow["groups"] (title + member/bounding info) into the printed source, e.g. as a # group "Sampling": nodes 3, 7, 9 comment block, and make this test green.

Verification

  • ruff check . / ruff format --check . — pass on the changed file
  • pytest tests/comfy_cli/test_workflow_print.py — 54 passed, 1 failed (the new test, as intended)

🤖 Generated with Claude Code

https://claude.ai/code/session_01GsW1eCwZpRD9ZA9DM8pdY3

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e9e3f2b4-fa78-4855-a987-3692b8b4d5a1

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.

render_py only reads workflow["nodes"] and workflow["links"]; it never
looks at workflow["groups"]. This is the tool the in-app agent calls to
read the canvas (print_workflow / read_workflow in cloud's agent loop),
so a group box drawn on screen with a title is invisible to the agent
and it can wrongly assert no groups exist.

The bundled sd15 fixture already carries three real titled groups; this
pins that none of them reach the rendered source today. Intentionally
red pending a fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GsW1eCwZpRD9ZA9DM8pdY3
@claude
claude Bot force-pushed the test/pm-907-print-workflow-groups branch from b3c3de2 to b337542 Compare September 19, 2026 05:23
@claude claude Bot changed the title test: pin that print_workflow drops canvas groups (PM-907) test: pin that print_workflow drops canvas groups Sep 19, 2026
A bare failing assert makes CI report "build failing" forever on every
future run with no way to tell an expected repro failure from a real
regression. xfail(strict=True) reports it as xfailed while render_py
still drops workflow["groups"], and flips to a hard failure the moment
render_py starts reading it, so un-xfailing becomes the signal that the
fix landed.

@christian-byrne christian-byrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now add fix commit that verified test toggles result

@christian-byrne christian-byrne self-assigned this Sep 20, 2026
render_py never read workflow["groups"], so a titled canvas group was
structurally invisible to the one text view of the graph the in-app
agent's canvas read (print_workflow / read_workflow) is given, even
when the group box is visibly drawn with a title bar.

Each group now gets a trailing `# group <id> "<title>": nodes <a>, <b>`
comment, alongside the existing note-comment convention. Membership is
computed with the same any-overlap rule LiteGraph's own
LGraphGroup.recomputeInsideNodes uses against the group's bounding box
and each node's pos/size — there's no separate member-id list
serialized on the group itself. Applies to a subgraph definition's own
groups too, not just the top-level workflow.

Un-xfails test_sd15_groups_are_visible_in_the_source (verified stable
across repeated runs) and strengthens it to also pin the exact
membership per group, hand-verified against the fixture's node
pos/size. The three "does this touch the sd15 golden" tests that
filter out "# note" lines now filter out "# group" lines too.
@claude

claude Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Fixed — render_py now reads workflow["groups"] and emits a trailing # group <id> "<title>": nodes <a>, <b> comment for each one, computed with the same any-overlap rule LiteGraph's LGraphGroup.recomputeInsideNodes uses against the group's bounding box (there's no separate member-id list serialized on the group itself). Applies to a subgraph definition's own groups too, not just the top-level workflow.

test_sd15_groups_are_visible_in_the_source is un-xfailed and strengthened to pin the exact per-group membership (hand-verified against the fixture's node pos/size), not just that the titles appear somewhere. Verified stable across 5 repeated runs.

ruff check / ruff format --check / full pytest all green locally (the 5 failures in an unrelated full-suite run — test_http_only_openers.py, test_http.py, test_node_deps.py, test_error_envelope_where.py — are pre-existing/environment-only; confirmed identical with this diff stashed out).

CI on this PR is green apart from Run Tests on GPU Runners (linux), which fails on test_progressive_conflict / test_node_uv_sync_standalone_conflict (tests/e2e/test_e2e_uv_compile.py) with [UnifiedDepResolver] rejected path separator: 'git+https://github.com/facebookresearch/sam2' from comfyui-impact-pack's new sam2 dependency — the same pre-existing uv-compile resolver issue currently failing identically on main and on #897, unrelated to this change.

This branch has not been deployed

No deployments
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