Skip to content

fix(assets): ask Comfy Cloud for the exact asset total in assets library ls and models search - #1148

Merged
vqt123 merged 1 commit into
mainfrom
vinh/assets-capped-total
Nov 15, 2026
Merged

vqt123 merged 1 commit into
mainfrom
vinh/assets-capped-total

Conversation

@vqt123

@vqt123 vqt123 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: comfy assets library ls and comfy models search now send capped_total=false on GET /api/assets, so the total they print stays an exact count.

Why Comfy Cloud's GET /api/assets takes a capped_total parameter. With capped_total=false the server returns the exact total. Without it, the server may return a capped count instead. Both commands print the server's total as an exact number. Comfy Cloud already accepts the parameter, so the output today is the same.

Before and after

Before: comfy --json assets library ls --where cloud sends GET /api/assets?limit=20. It forwards whatever total the server returns.

After: it sends GET /api/assets?limit=20&capped_total=false. The total it forwards is the exact count.

comfy models search --where cloud changes the same way on its two one-page answers: no --text, and a single-word --text that matches on the first page. Both report the server's total with total_is_lower_bound: false. When search scans several pages, it counts its own matches, so the scan requests do not send the parameter.

Calls left as they are

These GET /api/assets calls do not read total: the hash suggestions in assets library ensure, the model lookup in assets library upload, models show, and the model lookup in workflow check. Job calls (/api/jobs) are unchanged.

Tests

  • tests/comfy_cli/command/test_assets_library.py: new test_asks_for_the_exact_total. It checks that ls sends capped_total=false.
  • tests/comfy_cli/command/models/test_search.py: new test_one_page_answers_ask_for_the_exact_total (both one-page answers send it) and test_a_scan_does_not_ask_for_the_exact_total (scan requests do not).

Not run: the test suite and lint (CI runs them). No request was sent to Comfy Cloud with this build.

Rule bent: none.

Summary by CodeRabbit

  • Bug Fixes
    • Asset listings and cloud searches now report more accurate totals, including for filtered results.
    • Listing counts now match the asset rows included in the results, rather than counting rows that are excluded.

…rary ls` and `models search`

Both commands report the server's `total` from GET /api/assets as an exact count. Send `capped_total=false` so Comfy Cloud keeps answering with the exact count rather than a capped one. The scan in `models search` counts its own matches and does not send it.
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Asset listing and one-page cloud searches now request uncapped server totals. Asset listing counts filtered rows. Multi-page token scans continue to count matches locally without requesting an uncapped server total.

Changes: Asset total requests

Layer / File(s) Summary
Asset listing totals
comfy_cli/command/assets_library.py, tests/comfy_cli/command/test_assets_library.py
The listing query requests capped_total=false. The emitted count uses filtered asset rows. The test checks that the query keeps the name_contains filter.
Cloud search totals
comfy_cli/command/models/search.py, tests/comfy_cli/command/models/test_search.py
One-page cloud searches request capped_total=false. Tests cover searches with and without a text filter, and confirm that multi-page token scans omit the parameter.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: skishore23, mattmillerai

Merge Risk: Minimal · up to f9b35

The change asks the server for exact totals in asset listing and one-page model searches. No concrete defect was found. The only open question is whether Comfy Cloud honors the parameter, which cannot be checked from this repository.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the fix and both affected commands: it asks Comfy Cloud for the exact asset total in assets library ls and models search. The changeset matches this. ls_cmd sends `capped_total=f…
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.
Architecture Decision Compliance Passed The PR changes four files: comfy_cli/command/assets_library.py, comfy_cli/command/models/search.py, and two test files. It adds a capped_total=false query parameter to the GET /api/assets requ…
Full details: Title check

Explanation

The title names the fix and both affected commands: it asks Comfy Cloud for the exact asset total in assets library ls and models search. The changeset matches this. ls_cmd sends capped_total=false, and _cloud_search sends it for one-page searches, with multi-page scans omitting it. The title is specific and concise. Its length (97 characters) is slightly long but acceptable.

Full details: Architecture Decision Compliance

Explanation

The PR changes four files: comfy_cli/command/assets_library.py, comfy_cli/command/models/search.py, and two test files. It adds a capped_total=false query parameter to the GET /api/assets requests made by assets library ls and by the one-page answers in models search. It does not touch docs/adr/. The repo has 14 ADRs (excluding TEMPLATE.md). Of these, 11 are Accepted and 1 is Proposed (COVERAGE-0010). I checked the ADRs that mention /api/assets, total, paging, or search. - No Accepted ADR is contradicted. AUTOMATION-0003 governs the envelope/event output dialect. The diff leaves the output schema unchanged. KNOWLEDGE-0005, SIDEBAR-0009, SIDEBAR-0013, TRANSFER-0011 and TRANSFER-0012 cover other commands and do not constrain the total query parameter or the search behavior changed here. - COVERAGE-0010 (Proposed) is directional only. It mentions /api/assets for model lists and states that library models carry no content hash. The diff does not touch workflow check or hash logic, so the Proposed ADR is not in conflict. I note it here as directional guidance only. - No durable boundary needs a new ADR. The change adds one reversible query parameter in two call sites. The PR description states the reason (Comfy Cloud already accepts it, the total is printed as exact, and scan paths are left unchanged). This fits the "local and reversible" exception, so no ADR is required. Verdict: no finding under the Architecture decision compliance criteria.

Finishing Touches

Generate unit tests (beta)

  • 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

Commits

Reviewing files that changed from the base of the PR and between 4f554bb and f9b35f7.

Files selected for processing: 4

  • comfy_cli/command/assets_library.py
  • comfy_cli/command/models/search.py
  • tests/comfy_cli/command/models/test_search.py
  • tests/comfy_cli/command/test_assets_library.py

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

@vqt123 vqt123 self-assigned this Nov 15, 2026
@vqt123
vqt123 requested a review from james00012 November 15, 2026 03:50

@james00012 james00012 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve.

Reviewed at f9b35f7.

@vqt123

vqt123 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @james00012. The approval lists no findings, so nothing changes.

@vqt123
vqt123 merged commit 545d576 into main Nov 15, 2026
19 checks passed
@vqt123
vqt123 deleted the vinh/assets-capped-total branch November 15, 2026 13:35
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants