Skip to content

fix(workflow): persist Cloud sidebar files and verify save identity - #1046

Open
wealthwiselabs wants to merge 4 commits into
mainfrom
esun/fix/workflow-save-sidebar
Open

wealthwiselabs wants to merge 4 commits into
mainfrom
esun/fix/workflow-save-sidebar

Conversation

@wealthwiselabs

@wealthwiselabs wealthwiselabs commented Oct 21, 2026 •

Copy link
Copy Markdown

comfy workflow save --where cloud created a workflow record without the userdata file listed by the Cloud sidebar. Save now writes workflows/<name>.json and returns a record ID only after unique-name and matching-content read-back. A failed/stale mirror leaves the successful file save intact with an explicit null-ID warning.

  • Adds --no-overwrite; documents same-name replacement and the ignored description field. Hidden names and the favorites index are refused.
  • Deletion removes both file and record only after unique association, content and authenticated ownership checks; ambiguous associations remain untouched and partial cleanup is actionable.
  • Does not invent a private workflow deep link. The saved file opens through the Cloud Workflows sidebar.

Backend behavior was checked read-only against the userdata and workflow service implementations. Tests cover save/list/get/delete, stale mirroring, duplicate names, another member's record, and partial failure. No live Cloud writes were performed. Filename association and deletion remain separate API calls; the backend has no atomic conditional-delete operation.

Validation

  • 207 focused tests passed on the rebased branch, including error-code registry and command-reference guards. Full Ruff lint/format checks and git diff --check pass.
  • Companion fixes and the Run on Cloud skill passed 1,934 affected tests together before this rebase.
  • The earlier broad-suite snapshot was not clean: 10,297 passed, 16 skipped, 56 failed. Two stale discovery assertions were corrected and pass. Remaining failures include existing tests that read a live localhost ComfyUI catalog and previously known dependency-version/certificate cases. Representative catalog failures reproduce on clean main. No clean full-suite or live Cloud acceptance claim.

Related skill: #1008. This fix is independent and targets main.

Monitoring follow-up (October 27)

Verify mirrored workflow JSON recursively with JSON type semantics. Boolean/number differences (true vs 1, false vs 0, including nested values) withhold the saved record ID and refuse deletion before either DELETE request. Equivalent numeric representations (1 and 1.0) and reordered object keys remain compatible. Twelve regressions reproduced stale IDs and unsafe deletions before the fix.

The identity fix is isolated in fe4acd5f69. A separate test-only commit 45b878ef46 corrects invalid LATENT-to-IMAGE success fixtures, mocks the actual catalog/loader transport boundaries, and compares actual platform trust-root sets. Validation remains active and real unexpected catalog calls fail; no production behavior, dependencies or checks were relaxed. The existing user-authored main merge is preserved.

Fresh validation supersedes the earlier non-clean broad-suite snapshot above: 10,949 passed, 40 skipped, zero failures or test-file exclusions, using lockfile-matching dependencies and verified imports from this checkout. All 641 focused tests, full Ruff lint/format, ADR validation, whitespace checks and normal commit hooks pass. The exact source was frozen throughout the full run and the committed fixture patch matches its start/end checksum. CLA remains a contributor action; no authorship or allowlist changes.

Summary by CodeRabbit

  • New Features
    • Cloud workflow saves now appear as files in the Workflows sidebar, with same-name saves replacing existing files by default. Use --no-overwrite to prevent replacement.
    • Cloud save and delete operations provide warnings when workflow records cannot be safely matched, or cleanup is incomplete.
  • Bug Fixes
    • Added clearer error reporting for existing workflows, ambiguous matches, unresolved records, and incomplete deletion.
  • Documentation
    • Updated workflow-saving help and guidance to describe Cloud file behavior and overwrite options.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4d054af and 45b878e.

Files selected for processing: 11
  • CHANGELOG.md
  • comfy_cli/command/workflow.py
  • comfy_cli/error_codes.py
  • comfy_cli/skills/comfy/SKILL.md
  • tests/comfy_cli/command/test_pretty_print_sanitize.py
  • tests/comfy_cli/command/test_run.py
  • tests/comfy_cli/command/test_run_json.py
  • tests/comfy_cli/command/test_run_prompt.py
  • tests/comfy_cli/command/test_workflow_saved.py
  • tests/comfy_cli/output/test_error_envelope_where.py
  • tests/comfy_cli/test_http.py

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

Walkthrough

Workflow saves now write named files under workflows/ on local and Cloud routes. Cloud saves resolve matching workflow records when their content can be verified. Cloud deletion verifies and removes associated files and records. The pull request also updates command test fixtures and validation assertions.

Changes: Saved workflow file behavior

Layer / File(s) Summary
Save naming, overwrite, and command contract
comfy_cli/command/workflow.py, comfy_cli/error_codes.py, CHANGELOG.md, comfy_cli/skills/comfy/SKILL.md, tests/comfy_cli/command/test_workflow_saved.py
Save input validation handles workflow paths and overwrite conflicts. Command help, error descriptions, changelog, skill instructions, and local-save tests cover file-backed saves and overwrite behavior.
Cloud file save and record verification
comfy_cli/command/workflow.py, comfy_cli/error_codes.py, tests/comfy_cli/command/test_workflow_saved.py, tests/comfy_cli/command/test_pretty_print_sanitize.py
Cloud saves write a userdata workflow file. Record IDs and versions are returned only after matching names and workflow content are verified. Tests cover unresolved records, warnings, and save output.
Cloud file and record deletion
comfy_cli/command/workflow.py, tests/comfy_cli/command/test_workflow_saved.py
Cloud deletion verifies the file and record association before cleanup. Tests cover ambiguous associations, record-only workflows, and incomplete cleanup.

Run command test fixtures

Layer / File(s) Summary
Run workflow and object-info fixtures
tests/comfy_cli/command/test_run.py, tests/comfy_cli/command/test_run_json.py, tests/comfy_cli/command/test_run_prompt.py
Run tests now use EmptyImage workflow nodes and updated object-info fixtures. Prompt tests load frozen catalog data and build the default workflow.

Other test updates

Layer / File(s) Summary
Validation and certificate assertions
tests/comfy_cli/output/test_error_envelope_where.py, tests/comfy_cli/test_http.py
Validation tests mock object-info loading and check the route mode. HTTP tests compare SSL context certificates with the platform fixture.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant UserdataAPI
  participant WorkflowAPI
  CLI->>UserdataAPI: POST workflow file
  UserdataAPI-->>CLI: Return file receipt
  CLI->>WorkflowAPI: List records matching the filename
  WorkflowAPI-->>CLI: Return candidate records
  CLI->>WorkflowAPI: Fetch candidate workflow content
  WorkflowAPI-->>CLI: Return workflow JSON
  CLI-->>CLI: Return verified metadata or an unresolved-record warning
Loading
sequenceDiagram
  participant CLI
  participant UserdataAPI
  participant WorkflowAPI
  CLI->>WorkflowAPI: Read record and verify ownership
  WorkflowAPI-->>CLI: Return record details
  CLI->>UserdataAPI: Read and verify associated file
  UserdataAPI-->>CLI: Return file content
  CLI->>UserdataAPI: Delete verified file
  UserdataAPI-->>CLI: Return file deletion result
  CLI->>WorkflowAPI: Delete associated record
  WorkflowAPI-->>CLI: Return record deletion result
Loading

Possibly related PRs

  • Comfy-Org/comfy-cli#1008: Both changes persist Cloud workflows as files, verify corresponding workflow records, and coordinate file and record deletion.

Suggested reviewers: skishore23, mattmillerai

Merge Risk: Minimal · up to 45b87

Cloud workflow saves now write sidebar-visible files and return a record ID only after verifying it. Deletion refuses ambiguous associations. No concrete merge-blocking issue was found. The summaries note that no clean full-suite or live Cloud run is claimed, but that is normal validation uncertainty and not a specific defect.

Pre-merge checks: Passed 4 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Architecture Decision Compliance Warning The PR introduces a durable Cloud workflow file/record ownership model and deletion invariant in comfy_cli/command/workflow.py (the new Cloud save path at lines 1507-1520 and Cloud delete associatio… Add and accept an ADR for the Cloud workflow storage model. Document the sidebar file and mirrored record relationship, exact name/content identity checks, ownership rules, overwrite behavior, partial-cleanup semantics, backend atomicity li…
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: persisting Cloud sidebar files and verifying save identity.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 40 functions across 9 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Architecture Decision Compliance

Explanation

The PR introduces a durable Cloud workflow file/record ownership model and deletion invariant in comfy_cli/command/workflow.py (the new Cloud save path at lines 1507-1520 and Cloud delete association checks at lines 1579-1644). The changed-file inventory contains no ADR addition or amendment. The description explains the backend's lack of atomic conditional deletion, but it does not explain why this durable boundary is local and reversible. No existing accepted ADR directly covers this Cloud storage model. The machine-output changes remain consistent with ADR-AUTOMATION-0003.

Resolution

Add and accept an ADR for the Cloud workflow storage model. Document the sidebar file and mirrored record relationship, exact name/content identity checks, ownership rules, overwrite behavior, partial-cleanup semantics, backend atomicity limits, compatibility contract, and measurable revisit triggers.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@wealthwiselabs
wealthwiselabs marked this pull request as ready for review October 28, 2026 00:12
@github-actions

Copy link
Copy Markdown

🎉 Thank you for your contribution, we really appreciate it! 🎉

Like many open source projects, we require contributors to sign our Contributor License Agreement (CLA). A CLA makes the ownership of contributions explicit, so contributors and the project share a clear understanding of how the code can be used. By signing, you:

  • Confirm that you own your contribution.
  • Keep the right to reuse your own code.
  • Grant us a copyright license to include and share it within our projects.

CLAs are standard practice across major open source projects including those under the Apache Software Foundation and the Linux Foundation. Ours is based on the Apache Software Foundation's CLA. Most importantly, it would enable us to relicense the project under a more permissive license in the future, giving the project and its community greater flexibility.

✍ To sign, please post a new comment on this PR with exactly the following text: ✍


I have read and agree to the Contributor License Agreement


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@comfy-greenlight-bot

comfy-greenlight-bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Swarmhost agentic review

The detailed evaluation is available to employees in the internal Slack review thread.

Evaluation failed to run (author_not_trusted).

Evaluation budget remaining for this pull request: 15 automatic and 15 manual.

Updated by Swarmhost's agentic review process.

@comfy-greenlight-bot

Copy link
Copy Markdown

Swarmhost agentic review

An internal review is in progress. Detailed evaluations are not published on public repositories.

Evaluation budget remaining for this pull request: 15 automatic and 15 manual.

Updated by Swarmhost's agentic review process.

@skishore23 skishore23 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.

KishoreBot (AI), reviewing at Kishore's request. Reviewed commit 1a96cf3.

[P2] Preserve JSON value types when verifying mirrored content.

In _find_mirrored_record, Python's recursive dict/list equality considers JSON true equal to 1 (and false equal to 0). For example, sidebar content {"nodes":[{"id":1,"widgets_values":[1]}]} and record content {"nodes":[{"id":1,"widgets_values":[true]}]} pass the current comparison despite different widget values/types.

With a unique same-name record owned by the current user and a stale mirror after best-effort synchronization, save can report the stale record's UUID as verified. More seriously, _cloud_delete uses this helper to establish content identity before deleting the sidebar file and the record; this mismatch passes its refusal guard. The record-ID and owner checks do not distinguish these two contents.

Please use a recursive JSON comparison that distinguishes booleans from numbers, and add nested bool/number mismatch regressions. Save should withhold the verified record ID; delete should refuse the mismatch without either DELETE request. The integrated #1008 has a type-aware _same_json helper for a similar check that may be reusable.

Evidence: static trace through save, mirrored-record lookup and delete, plus inspection of the regression tests; this reproduction was not executed against Cloud. No independent runtime tests were run. Unit/lint/validation checks currently pass, but CLA fails and build/platform checks are still pending. Requesting changes for the content-identity defect.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants