Skip to content

feat(validate): report partner_nodes (paid) + spends_credits in comfy validate (BE-4328) - #590

Open
mattmillerai wants to merge 2 commits into
mainfrom
matt/be-4328-validate-partner-nodes
Open

feat(validate): report partner_nodes (paid) + spends_credits in comfy validate (BE-4328)#590
mattmillerai wants to merge 2 commits into
mainfrom
matt/be-4328-validate-partner-nodes

Conversation

@mattmillerai

Copy link
Copy Markdown
Collaborator

ELI-5

Before you run a workflow, comfy validate tells you if it's structurally OK. But some nodes are "partner-API" (paid) nodes — running them spends Comfy credits. Until now validate never told you that; the only way to find out was to try to run it and hit a credential error. This PR makes validate preview the spend: it now reports which paid nodes a workflow uses (partner_nodes) and a simple spends_credits yes/no flag, so an agent (or a human) can answer "will this cost me credits?" without running anything. It's purely informational — it never changes whether validation passes.

What changed

comfy validate now, after loading the graph (and after any UI→API conversion), runs the same partner-node detection comfy run already uses — the authoritative api_node: true flag from object_info, with a partner/... category-prefix fallback (_detect_partner_nodes, reused from comfy_cli/command/run/preflight.py). Two fields are added to the emitted payload:

  • partner_nodes — sorted list of the workflow's partner-API node class_types. Always present; [] when none.
  • spends_creditsbool(partner_nodes).

In pretty (non---json) mode, when non-empty, a yellow line prints after the valid/invalid verdict:

⚠ uses partner-API (paid) nodes that spend Comfy credits: <comma-joined names>

Both fields are documented in a new comfy validate --json section in docs/json-output.md.

Advisory only — this is pure visibility. No exit-code change, no gate; validate stays advisory and the enforcement gate remains in comfy run (this ticket is independent of that gate). Detection runs over the loaded object_info, so offline --input mode works unchanged and fails open (empty list) when the object_info lacks api_node flags — the same posture comfy run takes.

Tests

Extended tests/comfy_cli/command/test_validate_command.py (11 pass):

  1. API workflow with an api_node: true node → partner_nodes contains it, spends_credits true, exit 0 (otherwise-valid).
  2. No partner nodes → partner_nodes: [], spends_credits: false.
  3. Category-prefix fallback (partner/video/…, no api_node flag) → detected.
  4. UI-format workflow → detection runs on the converted graph.
  5. Invalid workflow with a partner node → both errors and partner_nodes present, exit 1 (from the error, not the partner node).

Also verified tests/comfy_cli/command/test_run.py, cql/test_engine.py, test_run_template.py, and tests/comfy_cli/output/ (envelope schemas) all still pass; ruff check + ruff format --check clean.

Judgment calls

  • Detection reuses the "private" _detect_partner_nodes — imported from comfy_cli.command.run.preflight exactly as the ticket specified (also re-exported from comfy_cli.command.run), keeping one source of truth for detection across run and validate.
  • docs/json-output.md had no existing validate section (the doc is comfy run-centric and never documented validate's payload). Rather than document just the two fields in a non-existent section, I added a concise comfy validate --json section covering the full validate payload (including the pre-existing converted_from_ui / converted_node_count fields), with the two new fields called out.
  • Not a capability-denial change (negative-claim falsification N/A): this diff only adds visibility — no "unsupported"/deny/dead-end path.

… validate (BE-4328)

comfy validate now previews credit spend read-only: after the graph is
loaded (and any UI->API conversion has run), it detects partner-API (paid)
nodes with the same authoritative api_node:true / partner-category
detection comfy run uses, and adds two always-present payload fields:
partner_nodes (sorted list, [] when none) and spends_credits (bool).

Pretty mode prints an informational yellow line after the verdict when
non-empty. Detection stays advisory — no exit-code change, no gate (the
enforcement gate lives in comfy run). Offline --input mode is unchanged:
detection is a pure function over the loaded object_info and fails open
(empty list) when the flags are absent.
@mattmillerai mattmillerai added the agent-coded PR authored by the agent-work loop label Jul 24, 2026
@mattmillerai
mattmillerai marked this pull request as ready for review July 24, 2026 06:28
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 10 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f7a5eea1-fc02-4a14-bf67-9beffe308aae

📥 Commits

Reviewing files that changed from the base of the PR and between 85b62da and 60b9313.

📒 Files selected for processing (3)
  • comfy_cli/cmdline.py
  • docs/json-output.md
  • tests/comfy_cli/command/test_validate_command.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch matt/be-4328-validate-partner-nodes
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch matt/be-4328-validate-partner-nodes

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

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jul 24, 2026
@mattmillerai mattmillerai added the cursor-review Request Cursor bot review label Jul 24, 2026

@github-actions github-actions 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.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

Found 2 finding(s).

Severity Count
🟡 Medium 1
🟢 Low 1

Panel: 5/8 reviewers contributed findings.

Reviewers that did not contribute: kimi-k2.5:adversarial (empty), claude-opus-4-8-thinking-xhigh:edge-case (parse_error), kimi-k2.5:edge-case (empty)

Comment thread comfy_cli/cmdline.py Outdated
Comment thread comfy_cli/cmdline.py
…328)

Partner-node class_type strings come from the workflow / object_info and
can contain Rich-markup metacharacters (e.g. `[/yellow]` or `Node[Paid]`).
Interpolated raw into the paid-nodes advisory f-string, an odd name raised
MarkupError and crashed `comfy validate` in pretty mode. Escape each name
with rich.markup.escape before joining. Adds a pretty-mode regression test.

Addresses cursor-review finding (raised by 4 of 8 reviewers).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-coded PR authored by the agent-work loop cursor-review Request Cursor bot review enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant